feat(debug): opcode decoding, call-stack walking and range reads (#56) #156
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: Rust | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| paths-ignore: &doc-paths | |
| - '**.md' | |
| - 'docs/**' | |
| - 'mkdocs.yml' | |
| - 'LICENSE' | |
| pull_request: | |
| branches: [ "master" ] | |
| paths-ignore: *doc-paths | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # Minimal default token; jobs escalate explicitly where needed. | |
| permissions: | |
| contents: read | |
| jobs: | |
| # --------------------------------------------------------------------------- | |
| # Cross-platform build, test and lint (i686) | |
| # --------------------------------------------------------------------------- | |
| build: | |
| name: build (${{ matrix.target }}) | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: i686-unknown-linux-gnu | |
| artifact: target/i686-unknown-linux-gnu/debug/libplugin.so | |
| - os: windows-latest | |
| target: i686-pc-windows-msvc | |
| artifact: target/i686-pc-windows-msvc/debug/plugin.dll | |
| # 64-bit target where `c_char == u8` (unlike the 32-bit targets above, | |
| # where it is `i8`). Cross-compiled and only `cargo check`ed — it can't | |
| # run natively on the x64 runner — to catch ABI/type mismatches in the | |
| # FFI signatures that a 32-bit-only matrix would miss. | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| check_only: true | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read # checkout | |
| actions: write # upload-artifact + rust-cache (cache write) | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y gcc-multilib g++-multilib | |
| - name: Cache cargo build | |
| uses: Swatinem/rust-cache@f0d9c3887740aee45f6153b24b3a6b815192ec16 # v2 | |
| with: | |
| cache-all-crates: true | |
| prefix-key: "v1" | |
| # Cross-only target (aarch64): type-check the pure-Rust library crates — it | |
| # can't run on the x64 runner. Catches ABI/type regressions like `c_char` | |
| # (`i8` vs `u8`). Runs through clippy with `-D warnings` (not a bare `cargo | |
| # check`) so warnings that only surface on this arch — e.g. `dead_code` from | |
| # code gated to another target — fail the build like on every other target. | |
| # Scoped to the SDK/codegen/samp crates (no `--all-targets`) so it doesn't | |
| # drag in example-only deps with C build scripts (aws-lc-sys) that would need | |
| # a cross C toolchain not installed here. | |
| - name: Check (cross-only target) | |
| if: matrix.check_only | |
| run: cargo clippy -p rust-samp-sdk -p rust-samp-codegen -p rust-samp --target ${{ matrix.target }} -- -D warnings | |
| - name: Build | |
| if: '!matrix.check_only' | |
| run: cargo build --verbose --target ${{ matrix.target }} | |
| - name: Run tests | |
| if: '!matrix.check_only' | |
| run: cargo test --verbose --target ${{ matrix.target }} | |
| - name: Run clippy | |
| if: '!matrix.check_only' | |
| run: cargo clippy --all-targets --target ${{ matrix.target }} -- -D warnings | |
| - name: Security audit | |
| if: runner.os == 'Linux' && !matrix.check_only | |
| run: cargo install cargo-audit --locked && cargo audit | |
| - name: Upload artifact | |
| if: '!matrix.check_only && github.event_name == ''push'' && github.ref == ''refs/heads/master''' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: plugin-${{ matrix.target }} | |
| path: ${{ matrix.artifact }} | |
| retention-days: 14 | |
| # --------------------------------------------------------------------------- | |
| # Formatting | |
| # --------------------------------------------------------------------------- | |
| # Kept out of the build matrix: rustfmt is target-independent, so running it | |
| # once is enough and it reports a failure in seconds instead of behind a build. | |
| rustfmt: | |
| name: rustfmt | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install Rust (stable + rustfmt) | |
| uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable | |
| with: | |
| components: rustfmt | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| # --------------------------------------------------------------------------- | |
| # Aggregate gate: the single required status check on `master`. | |
| # --------------------------------------------------------------------------- | |
| # The `build` matrix produces check names derived from the matrix values, which | |
| # change whenever a matrix entry is edited — too brittle to require directly. | |
| # This job's name is stable, so the branch ruleset requires only this one. | |
| # | |
| # A docs-only PR never triggers this workflow at all (see `paths-ignore`), so | |
| # `rust-skip.yml` reports a passing check under the same `ci-status` name to | |
| # keep such PRs mergeable. Keep the two names in sync. | |
| ci-status: | |
| name: ci-status | |
| if: always() | |
| needs: [build, rustfmt] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check job results | |
| env: | |
| BUILD_RESULT: ${{ needs.build.result }} | |
| RUSTFMT_RESULT: ${{ needs.rustfmt.result }} | |
| run: | | |
| echo "build: $BUILD_RESULT" | |
| echo "rustfmt: $RUSTFMT_RESULT" | |
| [ "$BUILD_RESULT" = "success" ] || exit 1 | |
| [ "$RUSTFMT_RESULT" = "success" ] || exit 1 |