Fix duplicate build script rules and inject version dynamically #20
  
    
      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
    
  
  
    
  | on: | |
| pull_request: | |
| paths-ignore: | |
| - '.github/**' | |
| - 'docs/**' | |
| - 'README.md' | |
| name: Check, Build and Test | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| setup: | |
| strategy: | |
| fail-fast: false | |
| name: Setup and Cache | |
| runs-on: ubuntu-latest | |
| env: | |
| CARGO_TERM_COLOR: always | |
| steps: | |
| - name: Restore cache | |
| id: cache-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| /home/runner/.cargo/bin/buck2 | |
| key: buck2-binary | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Rust Toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: clippy rustfmt | |
| cache-workspaces: . | |
| cache-directories: ./target | |
| - name: Install Buck2 | |
| if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }} | |
| run: | | |
| curl https://github.com/facebook/buck2/releases/download/latest/buck2-x86_64-unknown-linux-gnu.zst --output "${{runner.temp}}/buck2-x86_64-unknown-linux-gnu.zst" --location --silent --show-error --fail --retry 5 | |
| zstd -d "${{runner.temp}}/buck2-x86_64-unknown-linux-gnu.zst" -o $HOME/.cargo/bin/buck2 | |
| chmod +x $HOME/.cargo/bin/buck2 | |
| rm -f "${{runner.temp}}/buck2-x86_64-unknown-linux-gnu.zst" | |
| shell: bash | |
| - name: Save cache | |
| if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| /home/runner/.cargo/bin/buck2 | |
| key: buck2-binary | |
| format: | |
| name: Rustfmt Check | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| env: | |
| CARGO_TERM_COLOR: always | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Run rustfmt | |
| run: cargo fmt --check | |
| clippy: | |
| name: Clippy Check | |
| strategy: | |
| fail-fast: true | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| env: | |
| CARGO_TERM_COLOR: always | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Rust Toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: clippy rustfmt | |
| cache-workspaces: . | |
| cache-directories: ./target | |
| - name: Run cargo clippy | |
| run: cargo clippy -- -D warnings | |
| build: | |
| name: Cargo Build | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Rust Toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: clippy rustfmt | |
| cache-workspaces: . | |
| cache-directories: ./target | |
| - name: Run cargo build | |
| run: cargo build | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Run tests | |
| run: echo "Running tests ..." |