-
Notifications
You must be signed in to change notification settings - Fork 21
175 lines (158 loc) · 5.48 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
name: CI
on: [push, pull_request]
jobs:
get-build-packages:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- id: set-matrix
run: npx tsx ./scripts/getMonorepoPackageNames.ts build
build:
needs: get-build-packages
runs-on: ubuntu-latest
strategy:
matrix:
package-name: ${{ fromJson(needs.get-build-packages.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- working-directory: ./packages/${{ matrix.package-name }}
run: npm run build
- name: Store the docs build directory
if: ${{ matrix.package-name }} == 'docs'
uses: actions/upload-artifact@v3
with:
name: docs-build
path: ./packages/docs/build
get-lint-packages:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- id: set-matrix
run: npx tsx ./scripts/getMonorepoPackageNames.ts lint
lint:
needs: get-lint-packages
runs-on: ubuntu-latest
strategy:
matrix:
package-name: ${{ fromJson(needs.get-lint-packages.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- working-directory: ./packages/${{ matrix.package-name }}
run: npm run lint
get-test-packages:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- id: set-matrix
run: npx tsx ./scripts/getMonorepoPackageNames.ts test
test:
needs: get-test-packages
runs-on: ubuntu-latest
strategy:
matrix:
package-name: ${{ fromJson(needs.get-test-packages.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- working-directory: ./packages/${{ matrix.package-name }}
# We specify custom Node.js options in order to increase the memory size, since GitHub
# Actions can fail with the following error when doing the `eslint-plugin-isaacscript`
# tests:
# FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
run: NODE_OPTIONS='--max-old-space-size=8192' npm run test
unused:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
#- name: Check for unused files, dependencies, and exports
# run: npx knip
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- run: npx prettier --log-level=warn --check .
spell-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- run: npx cspell --no-progress --no-summary .
- run: npx cspell-check-unused-words
package-json-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- run: npm run package-json-lint .
docs-deploy:
needs: [build, lint, test, unused, format, spell-check, package-json-lint]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && needs.pr-check.outputs.number != 'null'
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- name: Retrieve the docs build directory
uses: actions/download-artifact@v3
with:
name: docs-build
path: ./packages/docs/build
- name: Checkout the docs repository
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DOCS_SSH_PRIVATE_KEY }}
repository: IsaacScript/isaacscript.github.io
ref: gh-pages
# The current working directory is:
# /home/runner/work/isaacscript/isaacscript
# Thus, the following path is equivalent to:
# /home/runner/work/isaacscript/isaacscript/isaacscript.github.io
# (It is not possible to clone the repo in the parent directory for security reasons.)
path: isaacscript.github.io
- name: Deploy the documentation website
id: deploy_documentation_website
run: npx tsx ./packages/docs/scripts/deploy.mts ${{ github.sha }}
- name: Run DocSearch Scraper
uses: celsiusnarhwal/typesense-scraper@v2
if: steps.deploy_documentation_website.outputs.SHOULD_SCRAPE == '1'
with:
api-key: ${{ secrets.TYPESENSE_API_KEY }}
host: ${{ secrets.TYPESENSE_HOST }}
port: ${{ secrets.TYPESENSE_PORT }}
protocol: ${{ secrets.TYPESENSE_PROTOCOL }}
config: packages/docs/docsearch.config.json
discord:
name: Discord Failure Notification
needs:
[
build,
lint,
test,
unused,
format,
spell-check,
package-json-lint,
docs-deploy,
]
if: always() # This is needed to always run this job, even if the other jobs fail.
runs-on: ubuntu-latest
steps:
- uses: technote-space/workflow-conclusion-action@v3
- if: env.WORKFLOW_CONCLUSION != 'success' && env.WORKFLOW_CONCLUSION != 'cancelled'
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ env.WORKFLOW_CONCLUSION }}
title: ""