-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (172 loc) · 5.6 KB
/
ci.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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
name: 'CI'
on:
schedule:
- cron: '0 10 * * *'
push:
branches: ['*']
pull_request:
types: [opened, synchronize]
jobs:
lint:
runs-on: ubuntu-24.04
name: Lint codebase
outputs:
pre-commit: ${{ steps.linter.outcome }}
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
with:
extra-conf: |
accept-flake-config = true
diagnostic-endpoint: ''
- name: Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run linters via pre-commit
id: linter
run: nix develop -c pre-commit run --all-files
test:
runs-on: ubuntu-24.04
name: Run tests
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Nx stuff
uses: nrwl/nx-set-shas@v4
- name: Run test
run: pnpm exec nx run-many --target=build --all
build:
runs-on: ubuntu-24.04
name: Build the project
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build the project
run: pnpm exec nx run-many --target=build --all
scan:
runs-on: ubuntu-24.04
name: Scan for vulnerabilities
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
exit-code: '1'
format: 'table'
ignore-unfixed: true
scan-ref: '.'
scan-type: 'repo'
severity: 'CRITICAL,HIGH'
skip-dirs: '/root/.local/share/pnpm/store'
timeout: 20m0s
env:
TRIVY_DISABLE_VEX_NOTICE: true
TRIVY_SKIP_DB_UPDATE: true
TRIVY_SKIP_JAVA_DB_UPDATE: true
check_deps:
runs-on: ubuntu-24.04
name: Check for new dependencies
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Check for new dependencies
uses: hiwelo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
publish-docs:
runs-on: ubuntu-24.04
name: Deploy to Cloudflare Pages
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build the documentation
run: pnpx nx build docs
- name: Deploy to Cloudflare Pages
if: (github.event_name == 'push') && (github.ref == 'refs/heads/main')
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --branch dev
packageManager: pnpm
- name: Deploy to Cloudflare Pages
if: ${{ github.event_name == 'pull_request' }}
id: deploy
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --branch ${{ github.ref_name }}
packageManager: pnpm
- name: Comment on pull request
if: ${{ github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@v3
with:
message: |
The documentation has been deployed to Cloudflare Pages :rocket:
You can view the deployment here:
- [${{ steps.deploy.outputs.deployment-url }}](${{ steps.deploy.outputs.deployment-url }})
- [${{ steps.deploy.outputs.pages-deployment-alias-url }}](${{ steps.deploy.outputs.pages-deployment-alias-url }})
organize:
runs-on: ubuntu-24.04
name: Some housekeeping
permissions:
pull-requests: write
needs: lint
if: needs.lint.outputs.pre-commit == 'failure' && github.event_name == 'pull_request'
steps:
- name: Add comment
if: needs.lint.outputs.pre-commit == 'failure' && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Thank you for contributing to garuda-ng! Please run 'pnpm format' and 'pnpm lint' on your code before submitting a pull request. Afterwards, please force push your changes."
})