Repository navigation
98 lines (86 loc) · 2.66 KB
/
Copy pathci.yml
File metadata and controls
98 lines (86 loc) · 2.66 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
name: CI
on:
push:
branches: [main]
paths-ignore:
- "**.md"
- "docs/**"
- ".changeset/**"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint-and-typecheck:
name: Lint and Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 (Node 24)
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: "1.3.14"
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
- name: Run postinstall
run: bun run postinstall
- name: Security audit
id: audit
timeout-minutes: 5
env:
AUDIT_STRICT: ${{ secrets.AUDIT_STRICT }}
run: |
set +e -o pipefail
timeout 120 bun audit 2>&1 | tee audit-output.txt
audit_exit=$?
if [ "$audit_exit" -eq 124 ]; then
echo "::warning::bun audit timed out after 120s — skipping vulnerability check"
exit 0
fi
if [ "$audit_exit" -gt 1 ]; then
echo "::warning::bun audit exited with code $audit_exit — see output above"
exit 0
fi
if grep -qiE '(critical|high)' audit-output.txt; then
if [ "$AUDIT_STRICT" = "true" ]; then
echo "::error::Critical or high vulnerabilities found — failing the audit"
exit 1
else
echo "::warning::Critical or high vulnerabilities found — set AUDIT_STRICT=true secret to fail on these"
fi
fi
- name: Run Biome lint and format check
run: bun biome ci .
- name: Run typecheck
run: bun typecheck
- name: Run tests
run: bun run test
notify:
name: Notify downstream workflows
needs: [lint-and-typecheck]
if: |
always() &&
!contains(needs.*.result, 'failure') &&
github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Send repository dispatch
env:
GH_TOKEN: ${{ github.token }}
run: |
for i in 1 2 3; do
if gh api repos/${{ github.repository }}/dispatches \
--method POST \
-f event_type=ci-main-success \
-f "client_payload[sha]=${{ github.sha }}"; then
exit 0
fi
sleep 5
done
exit 1