-
-
Notifications
You must be signed in to change notification settings - Fork 25
151 lines (133 loc) · 4.6 KB
/
Copy pathnightly.yml
File metadata and controls
151 lines (133 loc) · 4.6 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Nightly Build & Test
on:
schedule:
- cron: '0 2 * * *' # Run at 2 AM UTC daily
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
nightly-rust:
name: Nightly Rust Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy, miri
- uses: Swatinem/rust-cache@v2
with:
workspaces: backend
- name: Run tests on nightly
run: cargo test --all-features
working-directory: backend
continue-on-error: true
- name: Run clippy on nightly
run: cargo clippy --all-targets --all-features
working-directory: backend
continue-on-error: true
- name: Check formatting on nightly
run: cargo fmt --all -- --check
working-directory: backend
continue-on-error: true
full-test-suite:
name: Full Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: backend
# Run all Rust tests including ignored ones
- name: Run all tests (including ignored)
run: cargo test --all-features -- --include-ignored
working-directory: backend
continue-on-error: true
# Run with extra checking
- name: Run with address sanitizer
run: |
export RUSTFLAGS="-Z sanitizer=address"
cargo +nightly test --all-features --target x86_64-unknown-linux-gnu
working-directory: backend
continue-on-error: true
coverage-report:
name: Weekly Coverage Report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
workspaces: backend
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate coverage report
run: cargo llvm-cov --all-features --html --output-dir coverage
working-directory: backend
- uses: actions/upload-artifact@v4
with:
name: coverage-report
path: backend/coverage/
retention-days: 30
dependency-audit:
name: Dependency Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Rust audit
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Audit Rust dependencies
run: cargo audit --json > rust-audit.json || true
working-directory: backend
# NPM audit
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install frontend dependencies
run: npm ci
working-directory: frontend
- name: Audit NPM dependencies
run: npm audit --json > npm-audit.json || true
working-directory: frontend
# Generate summary
- name: Generate audit summary
run: |
echo "## Dependency Audit Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Rust Dependencies" >> $GITHUB_STEP_SUMMARY
if [ -f backend/rust-audit.json ]; then
echo '```json' >> $GITHUB_STEP_SUMMARY
cat backend/rust-audit.json | head -50 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### NPM Dependencies" >> $GITHUB_STEP_SUMMARY
if [ -f frontend/npm-audit.json ]; then
echo '```json' >> $GITHUB_STEP_SUMMARY
cat frontend/npm-audit.json | head -50 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
notify:
name: Notify on Failure
runs-on: ubuntu-latest
needs: [nightly-rust, full-test-suite, dependency-audit]
if: failure()
steps:
- name: Create issue on failure
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${context.runId}`;
await github.rest.issues.create({
owner,
repo,
title: `Nightly build failed - ${new Date().toISOString().split('T')[0]}`,
body: `The nightly build and test workflow has failed.\n\n[View the failed run](${runUrl})`,
labels: ['bug', 'ci', 'automated']
});