Update Cargo.lock for v0.4.1 #3
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main, dev, release] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main, dev, release] | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --component rustfmt --component clippy | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Cache cargo registry and build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo- | |
| - name: Check formatting | |
| run: cargo fmt --check | |
| - name: Lint | |
| run: cargo clippy -- -D warnings | |
| - name: Run tests | |
| run: cargo test | |
| - name: Build (default features) | |
| run: cargo build --release | |
| - name: Build (ascii-art feature) | |
| run: cargo build --release --features ascii-art | |
| publish-crate: | |
| name: Publish to crates.io | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.server_url == 'https://github.com' && startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Publish | |
| run: cargo publish --token "$CARGO_REGISTRY_TOKEN" | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| build-release: | |
| name: Build ${{ matrix.target }} | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.server_url == 'https://github.com' && startsWith(github.ref, 'refs/tags/v') | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-musl | |
| artifact: trex-linux-x86_64 | |
| use_cross: false | |
| - target: aarch64-unknown-linux-musl | |
| artifact: trex-linux-aarch64 | |
| use_cross: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --target ${{ matrix.target }} | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install musl-tools | |
| run: sudo apt-get update && sudo apt-get install -y musl-tools | |
| - name: Install cross | |
| if: matrix.use_cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build (native) | |
| if: ${{ !matrix.use_cross }} | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Build (cross) | |
| if: matrix.use_cross | |
| run: cross build --release --target ${{ matrix.target }} | |
| - name: Strip binary | |
| run: | | |
| BINARY=target/${{ matrix.target }}/release/trex | |
| if command -v strip >/dev/null 2>&1; then | |
| # Use target-appropriate strip for cross-compiled binaries | |
| if [ "${{ matrix.use_cross }}" = "true" ]; then | |
| docker run --rm -v "$(pwd):/workspace" -w /workspace \ | |
| "ghcr.io/cross-rs/${{ matrix.target }}:main" \ | |
| aarch64-linux-gnu-strip "$BINARY" 2>/dev/null || true | |
| else | |
| strip "$BINARY" 2>/dev/null || true | |
| fi | |
| fi | |
| - name: Package | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar -czvf ../../../${{ matrix.artifact }}.tar.gz trex | |
| cd ../../.. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: ${{ matrix.artifact }}.tar.gz | |
| github-release: | |
| name: Create GitHub Release | |
| needs: build-release | |
| runs-on: ubuntu-latest | |
| if: github.server_url == 'https://github.com' && startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifacts/**/*.tar.gz | |
| generate_release_notes: true |