99permissions : read-all
1010
1111jobs :
12- Build :
12+ verify-formatting :
13+ name : Verify code formatting
14+ permissions :
15+ contents : read
16+ runs-on : blacksmith-4vcpu-ubuntu-2204
17+ steps :
18+ - name : Harden Runner
19+ uses : step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
20+ with :
21+ egress-policy : audit
22+
23+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
25+ - name : Setup Node
26+ uses : useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
27+ with :
28+ node-version : ' 24.x'
29+
30+ - name : Install dependencies
31+ run : yarn install --frozen-lockfile
32+
33+ - name : Verify formatting
34+ run : yarn test-format-all
35+
36+ build :
37+ name : Build from source files
38+ needs : []
1339 permissions :
1440 contents : write
1541 runs-on : blacksmith-4vcpu-ubuntu-2204
@@ -21,34 +47,39 @@ jobs:
2147
2248 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2349
24- - name : Build from src
50+ - name : Setup Node
2551 uses : useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
2652 with :
27- node-version : ' 22.x'
53+ node-version : ' 24.x'
54+
55+ - name : Install dependencies
56+ run : yarn install --frozen-lockfile
2857
29- - run : yarn install --frozen-lockfile
30- - run : yarn build-only
58+ - name : Build project
59+ run : yarn build-only
3160
3261 - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3362 with :
3463 name : dist
3564 path : dist/
3665
37- - run : tar -cvf node_modules.tar node_modules
66+ - name : Package node_modules
67+ run : tar --exclude='.cache' -cvf node_modules.tar node_modules
3868
3969 - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4070 with :
4171 name : node_modules
4272 path : node_modules.tar
4373
44- test_node :
74+ test-suite-node :
75+ name : Test suite for Node
4576 permissions :
4677 contents : read
47- needs : Build
78+ needs : [build]
4879 runs-on : blacksmith-4vcpu-ubuntu-2204
4980 strategy :
5081 matrix :
51- node-version : [16.x, 18.x, 20.x, 22.x, 23.x, latest]
82+ node-version : [16.x, 18.x, 20.x, 22.x, 24.x] # Dropped ' 23.x' (EOL) and ' latest' for stability
5283 steps :
5384 - name : Harden Runner
5485 uses : step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
5788
5889 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5990
60- - name : Run prod version with Node v${{ matrix.node-version }}
91+ - name : Setup Node
6192 uses : useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
6293 with :
6394 node-version : ${{ matrix.node-version }}
@@ -72,13 +103,17 @@ jobs:
72103 name : node_modules
73104 path : ./
74105
75- - run : tar -xvf node_modules.tar
76- - run : yarn test-only
106+ - name : Unpack node_modules
107+ run : tar -xvf node_modules.tar
77108
78- test_browser :
109+ - name : Run test suite
110+ run : yarn test-only
111+
112+ test-suite-browser :
113+ name : Test suite for Browser
79114 permissions :
80115 contents : read
81- needs : Build
116+ needs : [build]
82117 runs-on : blacksmith-4vcpu-ubuntu-2204
83118 steps :
84119 - name : Harden Runner
@@ -93,5 +128,43 @@ jobs:
93128 name : dist
94129 path : dist/
95130
96- - run : echo '::warning ::Not able to automate browser tests yet'
97- - run : ' # yarn test-browser-ci'
131+ - name : Placeholder for browser tests
132+ run : echo '::warning ::Not able to automate browser tests yet'
133+
134+ - name : Run browser tests (disabled)
135+ run : ' # yarn test-browser-ci'
136+
137+ verify-parser :
138+ name : Verify grammar vs generated parser
139+ needs : []
140+ permissions :
141+ contents : read
142+ runs-on : blacksmith-4vcpu-ubuntu-2204
143+ steps :
144+ - name : Harden Runner
145+ uses : step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
146+ with :
147+ egress-policy : audit
148+
149+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
150+ with :
151+ fetch-depth : 0
152+
153+ - name : Get changed files
154+ id : detect-changes
155+ uses :
tj-actions/[email protected] 156+ with :
157+ files : src/alasqlparser.jison
158+
159+ - name : Build from src
160+ # This step only runs if the jison file changed
161+ if : steps.detect-changes.outputs.any_changed == 'true'
162+ run : |
163+ yarn install --frozen-lockfile
164+ yarn jison
165+ yarn test
166+
167+ - name : Check generated parser for changes
168+ if : steps.detect-changes.outputs.any_changed == 'true'
169+ run : |
170+ git diff --exit-code -- src/alasqlparser.js || (echo "Please run 'yarn jison && yarn test' and commit again." && exit 1)
0 commit comments