Repository navigation
159 lines (135 loc) · 4.05 KB
/
Copy pathci.yml
File metadata and controls
159 lines (135 loc) · 4.05 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
152
153
154
155
156
157
158
159
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: frontend/package-lock.json
- run: npm ci
- run: npm run lint
test:
name: Test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
node-version: [20, 22]
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: frontend/package-lock.json
- run: npm ci
- run: npm run test:run
build:
name: Build
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
id-token: write
attestations: write
artifact-metadata: write
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: frontend/package-lock.json
- run: npm ci
- run: npm run build
- name: Generate frontend SBOM
uses: anchore/sbom-action@v0
with:
path: frontend/dist
format: spdx-json
output-file: TheHealthApp-frontend-sbom.spdx.json
upload-artifact: false
- name: Generate frontend dependencies SBOM
uses: anchore/sbom-action@v0
with:
file: frontend/package-lock.json
format: spdx-json
output-file: TheHealthApp-frontend-deps-sbom.spdx.json
upload-artifact: false
- name: Upload frontend SBOMs
uses: actions/upload-artifact@v4
with:
name: TheHealthApp-frontend-sboms
path: |
TheHealthApp-frontend-sbom.spdx.json
TheHealthApp-frontend-deps-sbom.spdx.json
if-no-files-found: error
- name: Attest frontend SBOM provenance
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/attest@v4
with:
subject-path: |
TheHealthApp-frontend-sbom.spdx.json
TheHealthApp-frontend-deps-sbom.spdx.json
- name: Verify frontend SBOM attestations
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
working-directory: ${{ github.workspace }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh attestation verify TheHealthApp-frontend-sbom.spdx.json --repo ${{ github.repository }}
gh attestation verify TheHealthApp-frontend-deps-sbom.spdx.json --repo ${{ github.repository }}
- uses: actions/upload-artifact@v4
with:
name: build-output
path: frontend/dist
retention-days: 7
backend-test:
name: Backend Tests
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:7
ports:
- 27017:27017
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.14'
- run: python -m pip install --upgrade pip
- run: pip install -r requirements.txt
- run: pip install pytest httpx python-multipart
- run: |
export MONGO_URL="mongodb://localhost:27017"
export MONGO_DB_NAME="healthapp_test"
export JWT_ACCESS_SECRET="test-access-secret"
export JWT_REFRESH_SECRET="test-refresh-secret"
export ACCESS_TOKEN_EXPIRE_MINUTES="30"
export REFRESH_TOKEN_EXPIRE_DAYS="7"
PYTHONPATH=$(pwd) pytest tests -v