diff options
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/rust.yml | 72 | ||||
| -rw-r--r-- | .github/workflows/rust_testing.yml | 47 |
2 files changed, 88 insertions, 31 deletions
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 69fc9010..4c0d5012 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,44 +1,54 @@ -name: Rust PR Checks +name: Rust CI + +# TODO: The paths need to include all rust projects. Those exist outside the rust directory. on: + workflow_dispatch: + push: + paths: + - 'rust/**' pull_request: paths: - 'rust/**' jobs: - build_and_lint: - name: cargo check & cargo clippy + # Check lints with clippy + clippy: + name: cargo clippy runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + # Ensure clippy is installed + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - submodules: true - - - name: Install Clang - run: | - sudo apt update - sudo apt install clang -y - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.83.0 - profile: minimal - override: true components: clippy + - name: Clippy Check + uses: clechasseur/rs-clippy-check@v4 + with: + # We do not run clippy on plugins. + working-directory: ./rust + args: --all-features - - name: cargo check - working-directory: ./rust - run: cargo check --workspace --all-features - - - name: cargo doc test - working-directory: ./rust - run: cargo test --doc -- --show-output + # Check formatting with rustfmt + formatting: + name: cargo fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # Ensure rustfmt is installed + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 - - name: cargo clippy - working-directory: ./rust - run: cargo clippy -- -D warnings - continue-on-error: true - # If this step fails, it will warn (?) + # Check spelling with typos + spelling: + name: typos + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Typo Check + uses: crate-ci/typos@v1.29.4 + with: + files: ./rust
\ No newline at end of file diff --git a/.github/workflows/rust_testing.yml b/.github/workflows/rust_testing.yml new file mode 100644 index 00000000..05ecde75 --- /dev/null +++ b/.github/workflows/rust_testing.yml @@ -0,0 +1,47 @@ +name: Rust Testing + +# This workflow will have access to two secrets, `BN_SERIAL` and `BN_LICENSE`, they are exposed only for the test job +# and only if workflow has been approved to run. If there is no approval they workflow won't run. +# What security issues arise from this? If a person makes a PR that leaks the `BN_SERIAL` or `BN_LICENSE` and a maintainer +# approves it than the those secrets would leak. + +on: + workflow_dispatch: + push: + paths: + - 'rust/**' + # Pull request target allows us to use the bn license and serial for PR's + # to insure we do not leak the license the workflow is required to be approved manually. + pull_request_target: + paths: + - 'rust/**' + +jobs: + # Check that code compiles and tests pass + test: + # Using the testing environment gives us the needed secrets, it also requires a maintainer to approve it to run. + environment: testing + name: cargo test + runs-on: ubuntu-latest + permissions: + issues: read + steps: + - uses: actions/checkout@v4 + # We need to add wayland as it's used for file picker in the WARP integration + - name: Install system dependencies + run: sudo apt-get install libwayland-dev + # Pull in Binary Ninja + - name: Setup Binary Ninja + id: setup-binja + uses: Vector35/setup-binary-ninja@v1-beta + with: + license: '${{ secrets.BN_SERIAL }}' + python-support: 'false' + dev-branch: 'true' + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Test + # For now, we run the tests single threaded, there are some data races in core around platform types + run: cargo test --all-features -- --test-threads=1 + env: + BINARYNINJADIR: ${{ steps.setup-binja.outputs.install-path }} + BN_LICENSE: ${{ secrets.BN_LICENSE }}
\ No newline at end of file |
