-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (163 loc) · 5.81 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
name: CI
on:
push:
schedule:
- cron: "0 21 * * 0"
env:
CI: true
TURBO_API: http://127.0.0.1:9080
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: foo
jobs:
check-spelling:
name: Check spelling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: marshallku/actions/analyze/spell@master
build:
name: Build all packages and apps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: marshallku/marshallku-blog-posts
path: apps/blog/_posts
token: ${{ secrets.GH_TOKEN }}
- uses: marshallku/actions/setup/pnpm@master
- name: TurboRepo server
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ github.token }}
- name: Build apps and packages
run: pnpm build
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
lint:
name: Lint all packages and apps
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: marshallku/actions/setup/pnpm@master
- name: TurboRepo server
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ github.token }}
- name: Check code quality
run: pnpm lint
sonarqube:
name: Analyze with SonarQube
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: sonarsource/sonarqube-scan-action@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
code-ql-analyze:
name: Analyze (${{ matrix.language }}) with CodeQL
runs-on: "ubuntu-latest"
timeout-minutes: 360
permissions:
security-events: write
packages: read
strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
steps:
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: marshallku/actions/setup/pnpm@master
- name: TurboRepo server
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ github.token }}
- name: Run tests
run: pnpm test
test-blog-e2e:
name: Run e2e test in blog
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: marshallku/marshallku-blog-posts
path: apps/blog/_posts
token: ${{ secrets.GH_TOKEN }}
- uses: marshallku/actions/setup/pnpm@master
- name: TurboRepo server
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ github.token }}
- name: Setup playwright
run: pnpm exec playwright install --with-deps
- name: Build applications
run: pnpm build
- name: Run test
run: pnpm test:e2e --filter @marshallku/blog
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: apps/blog/test-results/
retention-days: 30
lighthouse:
name: Lighthouse CI
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: marshallku/marshallku-blog-posts
path: apps/blog/_posts
token: ${{ secrets.GH_TOKEN }}
- uses: marshallku/actions/setup/pnpm@master
- name: TurboRepo server
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ github.token }}
- name: Build app
run: |
cp apps/blog/.env.example apps/blog/.env
pnpm build --filter @marshallku/blog
cp -r apps/blog/.next/static apps/blog/.next/standalone/apps/blog/.next
cp -r apps/blog/public apps/blog/.next/standalone/apps/blog/
- name: Run Lighthouse CI
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
run: |
cd apps/blog
npm i -g @lhci/cli
lhci autorun
send-notification:
needs: [check-spelling, build, lint, test, test-blog-e2e, sonarqube, code-ql-analyze, lighthouse]
if: ${{ failure() }}
uses: marshallku/actions/.github/workflows/send-notification.yml@master
with:
failed: ${{ contains(join(needs.*.result, ','), 'failure') }}
message: "CI job failed"
secrets:
url: ${{ secrets.DISCORD_WEBHOOK_URI }}