Skip to content

Commit 549b0bb

Browse files
committed
2 parents 5ac6b7c + 3f0a217 commit 549b0bb

File tree

401 files changed

+43759
-20511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

401 files changed

+43759
-20511
lines changed

.github/workflows/rust.yml

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,56 @@
1-
name: Rust PR Checks
1+
name: Rust CI
22

33
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- '**'
8+
paths:
9+
- '**.rs'
10+
- '**.toml'
11+
- 'rust/**'
412
pull_request:
513
paths:
614
- 'rust/**'
715

816
jobs:
9-
build_and_lint:
10-
name: cargo check & cargo clippy
17+
# Check lints with clippy
18+
clippy:
19+
name: cargo clippy
1120
runs-on: ubuntu-latest
12-
1321
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
23+
# Ensure clippy is installed
24+
- uses: actions-rust-lang/setup-rust-toolchain@v1
1625
with:
17-
submodules: true
18-
19-
- name: Install Clang
20-
run: |
21-
sudo apt update
22-
sudo apt install clang -y
23-
24-
- name: Install Rust
25-
uses: actions-rs/toolchain@v1
26-
with:
27-
toolchain: 1.83.0
28-
profile: minimal
29-
override: true
3026
components: clippy
27+
- name: Clippy Check
28+
uses: clechasseur/rs-clippy-check@v4
29+
with:
30+
# We do not run clippy on plugins.
31+
working-directory: ./rust
32+
args: --all-features
3133

32-
- name: cargo check
33-
working-directory: ./rust
34-
run: cargo check --workspace --all-features
35-
36-
- name: cargo doc test
37-
working-directory: ./rust
38-
run: cargo test --doc -- --show-output
34+
# Check formatting with rustfmt
35+
formatting:
36+
name: cargo fmt
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
# Ensure rustfmt is installed
41+
- uses: actions-rust-lang/setup-rust-toolchain@v1
42+
with:
43+
components: rustfmt
44+
- name: Rustfmt Check
45+
uses: actions-rust-lang/rustfmt@v1
3946

40-
- name: cargo clippy
41-
working-directory: ./rust
42-
run: cargo clippy -- -D warnings
43-
continue-on-error: true
44-
# If this step fails, it will warn (?)
47+
# Check spelling with typos
48+
spelling:
49+
name: typos
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Typo Check
54+
uses: crate-ci/[email protected]
55+
with:
56+
files: ./rust

.github/workflows/rust_testing.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Rust Testing
2+
3+
# This workflow will have access to two secrets, `BN_SERIAL` and `BN_LICENSE`, they are exposed only for the test job
4+
# and only if workflow has been approved to run. If there is no approval they workflow won't run.
5+
# What security issues arise from this? If a person makes a PR that leaks the `BN_SERIAL` or `BN_LICENSE` and a maintainer
6+
# approves it than the those secrets would leak.
7+
8+
on:
9+
workflow_dispatch:
10+
# Pull request target allows us to use the bn license and serial for PR's
11+
# to insure we do not leak the license the workflow is required to be approved manually.
12+
pull_request_target:
13+
paths:
14+
- '**.rs'
15+
- '**.toml'
16+
- 'rust/**'
17+
18+
jobs:
19+
# Check that code compiles and tests pass
20+
test:
21+
# Using the testing environment gives us the needed secrets, it also requires a maintainer to approve it to run.
22+
environment: testing
23+
name: cargo test
24+
runs-on: ubuntu-latest
25+
permissions:
26+
issues: read
27+
steps:
28+
- uses: actions/checkout@v4
29+
# We need to add wayland as it's used for file picker in the WARP integration
30+
- name: Install system dependencies
31+
run: sudo apt-get install libwayland-dev
32+
# Pull in Binary Ninja
33+
- name: Setup Binary Ninja
34+
id: setup-binja
35+
uses: Vector35/setup-binary-ninja@v1-beta
36+
with:
37+
license: '${{ secrets.BN_SERIAL }}'
38+
python-support: 'false'
39+
dev-branch: 'true'
40+
- uses: actions-rust-lang/setup-rust-toolchain@v1
41+
- name: Test
42+
# For now, we run the tests single threaded, there are some data races in core around platform types
43+
run: cargo test --all-features -- --test-threads=1
44+
env:
45+
BINARYNINJADIR: ${{ steps.setup-binja.outputs.install-path }}
46+
BN_LICENSE: ${{ secrets.BN_LICENSE }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ python/generator.log
3333
python/generator.tlog
3434
.cache/
3535
target/
36+
view/sharedcache/api/python/_sharedcachecore.py
3637

3738
# Unit Tests
3839
suite/unit.py
@@ -84,6 +85,8 @@ rust/target/
8485
rust/binaryninjacore-sys/target/
8586
rust/examples/*/target/
8687
rust/examples/dwarf/*/target/
88+
# Allow the test binaries
89+
!/rust/fixtures/bin/**
8790

8891
# Debugger docs
8992
docs/img/debugger

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,3 @@
1616
[submodule "arch/x86/mbuild"]
1717
path = arch/x86/mbuild
1818
url = https://github.com/intelxed/mbuild.git
19-
[submodule "rust/examples/pdb-ng/pdb-0.8.0-patched"]
20-
path = rust/examples/pdb-ng/pdb-0.8.0-patched
21-
url = https://github.com/Vector35/pdb-rs.git

0 commit comments

Comments
 (0)