-
Notifications
You must be signed in to change notification settings - Fork 149
189 lines (185 loc) · 5.85 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
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
env:
NODE_FLAGS: --max_old_space_size=4096
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up project
uses: ./.github/actions/setup-project
- name: Build
run: |
rm -rf dist
node build-scripts build
env:
SCOREBOARD_SERVER: ${{ secrets.SCOREBOARD_SERVER }}
- name: Compress build output
if: always()
run: tar -cvzf dist.tar.gz dist
- name: Checks
run: node build-scripts pre-deploy
- name: Release
if: github.event_name == 'push'
id: release
run: |
node build-scripts release --confirm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: bemuse-build-${{ github.sha }}
path: dist.tar.gz
outputs:
released-tag: ${{ steps.release.outputs.tag }}
deploy:
uses: ./.github/workflows/deploy-production.yml
needs: build
secrets: inherit
if: needs.build.outputs.released-tag
with:
tag: ${{ needs.build.outputs.released-tag }}
e2e:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up project
uses: ./.github/actions/setup-project
- name: Download build
uses: actions/download-artifact@v3
with:
name: bemuse-build-${{ github.sha }}
path: '.'
- name: Extract build
run: tar -xvzf dist.tar.gz
- name: Install browsers
run: |
cd e2e
npx playwright install --with-deps
- name: Run E2E tests
run: |
cd e2e
npx playwright test
- name: Upload test report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: e2e/playwright-report
typecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up project
uses: ./.github/actions/setup-project
- name: Build dependencies
run: node common/scripts/install-run-rush.js build --to-except bemuse
- name: Typecheck
run: node ../common/scripts/install-run-rushx.js typecheck
working-directory: bemuse
tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up project
uses: ./.github/actions/setup-project
- name: Build
run: node common/scripts/install-run-rush.js build --to-except bemuse
- name: Lint and fix all auto-fixable problems
run: node common/scripts/install-run-rush.js lint --fix --verbose
if: always()
- name: Make sure all source files are formatted using Prettier
run: node common/scripts/install-run-rush.js format-all
if: always()
- name: Semgrep
uses: ./.github/actions/semgrep
if: always()
- name: Format README file
run: node common/scripts/install-run-rush.js format-readme
if: always()
- run: git add --update
if: always()
- uses: dtinth/patch-generator-action@main
if: always()
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up project
uses: ./.github/actions/setup-project
- name: Build
run: node common/scripts/install-run-rush.js build --to-except bemuse
- name: Test
run: node ../common/scripts/install-run-rushx.js test
working-directory: bemuse
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
test_packages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up project
uses: ./.github/actions/setup-project
- name: Build
run: node common/scripts/install-run-rush.js build --to-except bemuse
- name: Test Packages
run: node common/scripts/install-run-rush.js test --to-except bemuse
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
changelog:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
env:
AUTHOR: ${{ github.event.pull_request.user.login }}
PR: ${{ github.event.pull_request.number }}
PR_NEW_FILE_URL:
https://github.com/${{ github.event.pull_request.head.repo.full_name
}}/new/${{ github.event.pull_request.head.ref }}
steps:
- name: Generate changelog file
uses: actions/github-script@v6
with:
script: |
const path = `changelog/pr-${process.env.PR}.md`
const contents = [
'---',
'author: ' + process.env.AUTHOR,
'category: feature/internals/bugfix/improvement',
'type: major/minor/patch',
'pr: ' + process.env.PR,
'---',
'',
'(Write your changelog entry here)',
].join('\n')
const url = `${process.env.PR_NEW_FILE_URL}?filename=${encodeURIComponent(path)}&value=${encodeURIComponent(contents)}`
const summary = `[Click here to create a changelog entry.](${url})`
require('fs').appendFileSync(process.env.GITHUB_STEP_SUMMARY, summary)
console.log('To create a changelog entry, create a file at', path)
console.log('')
console.log('Example contents:')
console.log('')
console.log(contents)
console.log('')
console.log(url)