summaryrefslogtreecommitdiff
path: root/.github/workflows/rust_testing.yml
blob: 8b4b7c7c15935dd8ccc924332b53438ce27734dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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:
  # 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:
      - '**.rs'
      - '**.toml'
      - '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:
      name: testing
      deployment: false
    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 }}