diff options
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/rust.yml | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d493041..0374efc 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,9 +2,9 @@ name: Rust CI on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: CARGO_TERM_COLOR: always @@ -16,85 +16,85 @@ jobs: outputs: cache-key: ${{ steps.cache-key.outputs.value }} steps: - - uses: actions/checkout@v4 - - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable - targets: x86_64-unknown-linux-musl - - name: Generate cache key - id: cache-key - run: echo "value=cargo-$(rustc -V | sed 's/.*(\(.*\))/\1/')-$(sha256sum Cargo.lock | cut -d' ' -f1)" >> $GITHUB_OUTPUT + - uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + targets: x86_64-unknown-linux-musl + - name: Generate cache key + id: cache-key + run: echo "value=cargo-$(rustc -V | sed 's/.*(\(.*\))/\1/')-$(sha256sum Cargo.lock | cut -d' ' -f1)" >> $GITHUB_OUTPUT lint: runs-on: ubuntu-latest needs: setup steps: - - uses: actions/checkout@v4 - - name: Restore cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ needs.setup.outputs.cache-key }}-lint - - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable - components: clippy, rustfmt - - name: Run clippy - run: cargo clippy --workspace --all-targets -- -D warnings - - name: Check formatting - run: cargo fmt --check + - uses: actions/checkout@v4 + - name: Restore cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ needs.setup.outputs.cache-key }}-lint + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + components: clippy, rustfmt + - name: Run clippy + run: cargo clippy --workspace --all-targets -- -D warnings + - name: Check formatting + run: cargo fmt --check test: runs-on: ubuntu-latest - needs: [setup, lint] + needs: setup env: CARGO_BUILD_TARGET: x86_64-unknown-linux-musl steps: - - uses: actions/checkout@v4 - - name: Restore cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ needs.setup.outputs.cache-key }}-test - - name: Verify musl target is installed - run: rustup target list | grep x86_64-unknown-linux-musl | grep installed - - name: Build - run: cargo build --workspace --verbose - - name: Run tests - run: cargo test --workspace --verbose - - name: Check binary compatibility - run: | - cargo build --workspace --release - find target/x86_64-unknown-linux-musl/release -maxdepth 1 -executable -type f 2>/dev/null | head -5 | xargs -I {} sh -c 'file {} | grep -q "statically linked" && echo "✓ {} is statically linked" || echo "✗ {} is not statically linked"' + - uses: actions/checkout@v4 + - name: Restore cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ needs.setup.outputs.cache-key }}-test + - name: Verify musl target is installed + run: rustup target list | grep x86_64-unknown-linux-musl | grep installed + - name: Build + run: cargo build --workspace --verbose + - name: Run tests + run: cargo test --workspace --verbose + - name: Check binary compatibility + run: | + cargo build --workspace --release + find target/x86_64-unknown-linux-musl/release -maxdepth 1 -executable -type f 2>/dev/null | head -5 | xargs -I {} sh -c 'file {} | grep -q "statically linked" && echo "✓ {} is statically linked" || echo "✗ {} is not statically linked"' release: runs-on: ubuntu-latest - needs: test + needs: [lint, test] if: github.event_name == 'push' && github.ref == 'refs/heads/main' env: CARGO_BUILD_TARGET: x86_64-unknown-linux-musl steps: - - uses: actions/checkout@v4 - - name: Restore cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ needs.setup.outputs.cache-key }}-release - - name: Build release binaries - run: cargo build --workspace --release - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: release-binaries - path: target/x86_64-unknown-linux-musl/release/ + - uses: actions/checkout@v4 + - name: Restore cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ needs.setup.outputs.cache-key }}-release + - name: Build release binaries + run: cargo build --workspace --release + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: release-binaries + path: target/x86_64-unknown-linux-musl/release/ |
