11name : ' CI'
2- on : pull_request
2+ on :
3+ pull_request_target :
4+ types :
5+ - opened
6+ - synchronize
7+ - labeled
8+ - reopened
9+
10+ permissions :
11+ contents : read
12+ pull-requests : read
313
414env :
515 RUST_BACKTRACE : 1
616 CARGO_TERM_COLOR : always
717
818jobs :
19+ check-user-trust :
20+ runs-on : ubuntu-latest
21+ outputs :
22+ is-trusted : ${{ steps.check.outputs.is_trusted }}
23+ steps :
24+ - name : Check if PR sender is trusted
25+ id : check
26+ run : |
27+ ASSOC="${{ github.event.sender.author_association }}"
28+ echo "Sender association: $ASSOC"
29+ if [[ "$ASSOC" == "OWNER" || "$ASSOC" == "MEMBER" || "$ASSOC" == "COLLABORATOR" ]]; then
30+ echo "trusted=true" >> $GITHUB_OUTPUT
31+ else
32+ echo "trusted=false" >> $GITHUB_OUTPUT
33+ fi
34+
935 test-stable-hosted :
1036 strategy :
1137 fail-fast : false
1440 - [self-hosted, Linux, amd64]
1541 - [self-hosted, Linux, aarch64]
1642 name : Rust stable
43+ needs : check-user-trust
44+ if : needs.check-user-trust.outputs.is_trusted == 'true'
1745 runs-on : ${{matrix.os}}
1846 timeout-minutes : 45
1947 steps :
2250 - run : ./scripts/test.sh
2351
2452 test-stable-wasm :
53+ needs : check-user-trust
54+ if : needs.check-user-trust.outputs.is_trusted == 'true'
2555 runs-on : [self-hosted, Linux, amd64]
2656 env :
2757 WASMTIME_BACKTRACE_DETAILS : 1
4272
4373
4474 test-nightly-hosted :
75+ needs : check-user-trust
76+ if : needs.check-user-trust.outputs.is_trusted == 'true'
4577 strategy :
4678 fail-fast : false
4779 matrix :
5789 - run : ./scripts/test.sh
5890
5991 clippy_lint :
92+ needs : check-user-trust
93+ if : needs.check-user-trust.outputs.is_trusted == 'true'
6094 name : Format check
6195 runs-on : [self-hosted, Linux, amd64]
6296 timeout-minutes : 45
71105 cargo fmt -- --check
72106
73107 sanitize :
108+ needs : check-user-trust
109+ if : needs.check-user-trust.outputs.is_trusted == 'true'
74110 strategy :
75111 fail-fast : false
76112 matrix :
90126 run : ./scripts/sanitize.sh ${{matrix.san}} ${{matrix.feature}}
91127
92128 fuzz :
129+ needs : check-user-trust
130+ if : needs.check-user-trust.outputs.is_trusted == 'true'
93131 runs-on : [self-hosted, Linux, amd64]
94132 steps :
95133 - uses : actions/checkout@v4
@@ -101,3 +139,15 @@ jobs:
101139 token : ${{ secrets.GITHUB_TOKEN }}
102140 - name : Fuzz
103141 run : ./scripts/fuzz.sh
142+
143+ security-audit :
144+ needs : check-user-trust
145+ if : needs.check-user-trust.outputs.is_trusted == 'true'
146+ runs-on : [self-hosted, Linux, amd64]
147+ steps :
148+ - uses : actions/checkout@v4
149+ - uses : dtolnay/rust-toolchain@stable
150+ - uses : actions-rs/audit-check@v1
151+ with :
152+ token : ${{ secrets.GITHUB_TOKEN }}
153+
0 commit comments