perf: use a 'static server in order to avoid atomic reference counts #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test/Lint/Release | |
permissions: | |
contents: write | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
clippy: | |
if: ${{ !startsWith(github.event.head_commit.message, 'tag') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable-2023-10-03 # Fixed so that it can be cached | |
profile: minimal | |
components: clippy | |
override: true | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Clippy | |
run: cargo clippy --all | |
test: | |
if: ${{ !startsWith(github.event.head_commit.message, 'tag') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable-2023-10-03 # Fixed so that it can be cached | |
override: true | |
components: llvm-tools-preview | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install Grcov | |
run: cargo install grcov | |
- name: Run tests | |
run: cargo test --all --no-fail-fast | |
env: | |
RUSTFLAGS: '-C instrument-coverage' | |
LLVM_PROFILE_FILE: 'report-%p-%m.profraw' | |
- name: Run grcov | |
run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore 'target/**' --ignore '../**' --ignore '/*' -o coverage.lcov | |
- name: Coveralls upload | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: coverage.lcov | |
release: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
- clippy | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' # https://github.com/actions/checkout/issues/217 | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable-2023-10-03 # Fixed so that it can be cached | |
profile: minimal | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- uses: korandoru/setup-zig@v1 | |
with: | |
zig-version: 0.10.0 | |
- name: Install bump tool | |
run: cargo install cargo-workspaces cargo-zigbuild | |
- name: Compile for x86_64-unknown-linux-gnu | |
run: | | |
rustup target add x86_64-unknown-linux-gnu | |
cargo zigbuild --target x86_64-unknown-linux-gnu --release | |
mkdir -p target/linux/amd64/release/ | |
mv target/x86_64-unknown-linux-gnu/release/signway target/linux/amd64/release/signway | |
- name: Compile for aarch64-unknown-linux-gnu | |
run: | | |
rustup target add aarch64-unknown-linux-gnu | |
cargo zigbuild --target aarch64-unknown-linux-gnu --release | |
mkdir -p target/linux/arm64/release/ | |
mv target/aarch64-unknown-linux-gnu/release/signway target/linux/arm64/release/signway | |
- name: Tag | |
id: tag | |
run: | | |
SEM_VER=$(.github/semver.sh) | |
cargo workspaces version $SEM_VER -a -y --force '*' --no-git-commit | |
version=`grep '^version = ' Cargo.toml | sed 's/version = //; s/\"//; s/\"//'` | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git commit -m "tag: v$version" | |
git tag "v$version" | |
git push | |
git push --tags | |
echo "version=$version" >> "$GITHUB_OUTPUT" | |
- name: Release | |
run: gh release create "v${{ steps.tag.outputs.version }}" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Publish | |
run: cargo publish -p signway-server | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: gabotechs | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/amd64,linux/arm64 | |
tags: gabotechs/signway:${{ steps.tag.outputs.version }},gabotechs/signway:latest |