Skip to content

Commit

Permalink
Hello, world!
Browse files Browse the repository at this point in the history
  • Loading branch information
selectdev committed Mar 16, 2024
0 parents commit ee29d59
Show file tree
Hide file tree
Showing 43 changed files with 6,549 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[unstable]
build-std = ["std", "panic_abort"]
#build-std-features = ["panic_immediate_abort"]

[target.x86_64-unknown-linux-gnu]
rustflags = ["-Z", "mir-opt-level=3", "-C", "target-cpu=native"]
44 changes: 44 additions & 0 deletions .github/rust.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"problemMatcher": [
{
"owner": "cargo-common",
"pattern": [
{
"regexp": "^(warning|warn|error)(\\[(\\S*)\\])?: (.*)$",
"severity": 1,
"message": 4,
"code": 3
},
{
"regexp": "^\\s+-->\\s(\\S+):(\\d+):(\\d+)$",
"file": 1,
"line": 2,
"column": 3
}
]
},
{
"owner": "cargo-test",
"pattern": [
{
"regexp": "^.*panicked\\s+at\\s+'(.*)',\\s+(.*):(\\d+):(\\d+)$",
"message": 1,
"file": 2,
"line": 3,
"column": 4
}
]
},
{
"owner": "cargo-fmt",
"pattern": [
{
"regexp": "^(Diff in (\\S+)) at line (\\d+):",
"message": 1,
"file": 2,
"line": 3
}
]
}
]
}
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Check build

on: [push, pull_request]

jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: clippy, rust-src

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Add problem matchers
run: echo "::add-matcher::.github/rust.json"

- name: Run clippy
run: cargo clippy --target=x86_64-unknown-linux-gnu

rustfmt:
name: Formatting
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt

- name: Add problem matchers
run: echo "::add-matcher::.github/rust.json"

- name: Run cargo fmt
run: cargo fmt -- --check
50 changes: 50 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Docker Images
on: [push]

jobs:
build-docker-image:
strategy:
matrix:
target-cpu: ["znver3", "znver2", "skylake", "haswell", "sandybridge", "x86-64"]

name: Build for ${{ matrix.target-cpu }}
env:
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_TARGET_ACCOUNT: ${{ secrets.DOCKERHUB_TARGET }}

runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Login to DockerHub
uses: docker/login-action@v2
if: env.DOCKER_USERNAME
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Convert GITHUB_REPOSITORY into lowercase
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Build Docker Image
run: |
docker build -t gateway-proxy:${{ matrix.target-cpu }} --build-arg TARGET_CPU=${{ matrix.target-cpu }} .
- name: Create manifest and push it
if: env.DOCKER_USERNAME && github.ref == 'refs/heads/main'
run: |
docker tag gateway-proxy:${{ matrix.target-cpu }} ${{ secrets.DOCKERHUB_TARGET }}/gateway-proxy:${{ matrix.target-cpu }}
docker push ${{ secrets.DOCKERHUB_TARGET }}/gateway-proxy:${{ matrix.target-cpu }}
docker tag gateway-proxy:${{ matrix.target-cpu }} ghcr.io/${REPO}:${{ matrix.target-cpu }}
docker push ghcr.io/${REPO}:${{ matrix.target-cpu }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
config.json
gateway-proxy
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "twilight"]
path = twilight
url = https://github.com/anti-raid/twilight-for-gateway-proxy
branch = 15-custom
Loading

0 comments on commit ee29d59

Please sign in to comment.