-
Notifications
You must be signed in to change notification settings - Fork 107
92 lines (88 loc) · 2.71 KB
/
rust.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Rust
on:
merge_group:
pull_request:
workflow_dispatch:
concurrency:
group: rust-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: sudo apt-get install llvm
- name: Cargo sort
run: cargo install cargo-sort && cargo sort --check .
- name: Format
run: cargo fmt && git diff --exit-code
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
build:
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
environment: [ubuntu-latest, ubuntu-24.04, macos-latest]
toolchain: [stable, nightly]
plugins: [true, false]
cc: [cc, clang]
exclude:
- environment: macos-latest
plugins: true
- toolchain: stable
plugins: true
include:
- cc: cc
cxx: c++
- cc: clang
cxx: clang++
runs-on: ${{ matrix.environment }}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Rustup
run: rustup default ${{ matrix.toolchain }}
- name: Install LLVM
run: |
LLVM_VERSION="$(rustc --version -v | grep '^LLVM version:' | grep -o '[0-9]\+' | head -n 1)"
if [[ ${{ matrix.environment }} = 'macos-latest' ]]; then
# smoelius: Around the time Rust 1.80 was released, running `brew update` would be
# followed by "cargo: command not found" errors.
# brew update
brew install llvm@"$LLVM_VERSION" || true
echo "/usr/local/opt/llvm/bin" >> "$GITHUB_PATH"
else
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh "$LLVM_VERSION"
fi
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
- name: Build
run: cargo build -vv
- name: Run `cargo afl config`
run: |
PLUGINS="$(${{ matrix.plugins }} && echo --plugins)" || true
cargo run -- afl config --build $PLUGINS
- name: Run afl-system-config
run: cargo run -- afl system-config
- name: Build examples (with AFL instrumentation)
run: cargo run -- afl build --examples -vv
- name: Run tests
run: cargo test -p cargo-afl -vv
all-checks:
needs: [lint, build]
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Check results
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1