-
Notifications
You must be signed in to change notification settings - Fork 4
77 lines (69 loc) · 2.36 KB
/
test-scout.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
name: Test Scout Audit
on:
pull_request:
paths:
- "apps/cargo-scout-audit/**"
workflow_dispatch:
jobs:
run-tests:
name: Run tests
strategy:
matrix:
os:
- ubuntu-latest
- macos-13
runs-on: ${{ matrix.os }}
outputs:
linux_status: ${{ steps.run-tests.outputs.linux_status }}
macos_status: ${{ steps.run-tests.outputs.macos_status }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Cache cargo dependencies and tool versions
uses: actions/cache@v4
with:
path: |
~/.cargo
~/.rustup
key: ${{ runner.os }}-test-scout-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-test-scout-
- name: Install local scout
working-directory: apps/cargo-scout-audit
run: cargo install --path .
- name: Install clippy-sarif and cargo-nextest
run: cargo install clippy-sarif cargo-nextest --locked
- name: Run tests and set output
id: run-tests
working-directory: apps/cargo-scout-audit
run: |
if cargo nextest run --all --all-features; then
echo "${{ runner.os }}_status=success" >> $GITHUB_OUTPUT
else
echo "${{ runner.os }}_status=failure" >> $GITHUB_OUTPUT
exit 1
fi
comment-on-pr:
name: Comment on PR about test status
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [run-tests]
steps:
- name: Find existing comment
id: find_comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: "📝 Test results"
- name: Create or Update PR Comment
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
edit-mode: replace
issue-number: ${{ github.event.pull_request.number }}
body: |
## 📝 Test results
| OS | Status |
|--------|--------|
| Ubuntu | ${{ needs.run-tests.outputs.linux_status == 'success' && '✅ Passed' || '❌ Error' }} |
| macOS | ${{ needs.run-tests.outputs.macos_status == 'success' && '✅ Passed' || '❌ Error' }} |