-
-
Notifications
You must be signed in to change notification settings - Fork 1
161 lines (161 loc) · 5.84 KB
/
javascript-test.yaml
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
name: JavaScript 🟨🟦🟩🟥 Tests 🦂
on:
push:
branches-ignore:
- 'main'
paths:
- 'javascript/**'
- '!javascript/**.md'
- '!javascript/.vscode/**'
- '.github/workflows/javascript-*'
pull_request:
branches:
- 'main'
paths:
- 'javascript/**'
- '!javascript/**.md'
- '!javascript/.vscode/**'
- '.github/workflows/javascript-*'
schedule: # 9AM on the 15th
- cron: 0 22 14 1,2,3,10,11,12 * # AEDT Months
- cron: 0 23 14 4,5,6,7,8,9 * # AEST Months
workflow_call:
permissions: {}
defaults:
run:
shell: bash
working-directory: javascript
jobs:
quick-test:
name: JavaScript 🟨🟦🟩🟥 Quick Test 🦂
if: ${{ github.event_name == 'push' && !(github.event.ref == 'refs/heads/main') }}
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 🟨🟦🟩🟥 Set up Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: 'javascript/.nvmrc'
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
- name: 🧱 Install build dependencies
run: make setup
- name: 🦂 Test
run: make test
- name: 🧹 Lint
run: make lint
- name: ⚖ Does the checked in JS match the transpiled TS?
run: make verify_transpiled_checkin
full-test:
name: JavaScript 🟨🟦🟩🟥 Full Test 🦂
if: >-
${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') }}
runs-on: '${{ matrix.os }}'
strategy:
fail-fast: false
matrix:
version: ['18', '20', '21'] # See package.json's "engines"
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 🟨🟦🟩🟥 Set up Node ${{ matrix.version }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: '${{ matrix.version }}'
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
# Strip the nvm wrapping for the "full test" (it's still required by the necessary "quick test")
- name: 🧱 Install build dependencies
run: make setup NPM='npm' INSTALL_NODE=''
- name: 🦂 Test
run: make test NPM='npm'
- name: 🧹 Lint
run: make lint _=''
# We probably don't need to do this on all runners, and the windows CRLF echos are annoying
# - name: ⚖ Does the checked in JS match the transpiled TS?
# run: make verify_transpiled_checkin
built-example:
name: JavaScript 🟨🟦🟩🟥 Build Example 🦛
if: >-
${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') }}
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 🟨🟦🟩🟥 Set up Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: 'javascript/.nvmrc'
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
- name: 🧱 Install build dependencies
run: make setup
- name: 🧱 Build
run: make build
- name: 🆙 Upload dists
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: Package
path: javascript/skenvy-collatz-*.tgz
if-no-files-found: error
retention-days: 1
usage-demonstration:
name: JavaScript 🟨🟦🟩🟥 Usage Demonstration 🦏
needs: [built-example]
if: >-
${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: javascript/.demo
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 🟨🟦🟩🟥 Set up Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: 'javascript/.nvmrc'
- name: 🆒 Download dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: Package
path: javascript/.demo
- name: 🦛 Install this package
run: npm run setup
- name: 🦏 Transpile and run demonstration; 🦑 CJS
run: npm run everything:cjs
- name: 🦏 Transpile and run demonstration; 🐙 ESM
run: npm run everything:esm
codeql:
name: JavaScript 🟨🟦🟩🟥 CodeQL 🛡👨💻🛡
if: >-
${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') }}
permissions:
actions: read
contents: read
security-events: write
uses: ./.github/workflows/github-codeql.yaml
with:
language: 'javascript'
docs:
name: JavaScript 🟨🟦🟩🟥 Docs 📄 Quick Test 🦂
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 🟨🟦🟩🟥 Set up Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: 'javascript/.nvmrc'
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
- name: 🧱 Install build dependencies
run: make setup
- name: 📄 Docs
run: make docs