-
Notifications
You must be signed in to change notification settings - Fork 693
186 lines (154 loc) · 6.24 KB
/
Build and test.yml
File metadata and controls
186 lines (154 loc) · 6.24 KB
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
name: 'CI build & test'
on:
push:
branches: '*'
pull_request:
branches: '*'
permissions: read-all
jobs:
verify-formatting:
name: Verify code formatting
permissions:
contents: read
# Blacksmith is much faster and gives better dashboards than github actions, but we are not being sponsored anymore so had to revert.
# runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node
# Blacksmith is much faster and gives better dashboards than github actions, but we are not being sponsored anymore so had to revert.
# uses: useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Verify formatting
run: yarn test-format-all
build:
name: Build from source files
needs: []
permissions:
contents: write
# Blacksmith is much faster and gives better dashboards than github actions, but we are not being sponsored anymore so had to revert.
# runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node
# Blacksmith is much faster and gives better dashboards than github actions, but we are not being sponsored anymore so had to revert.
# uses: useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
uses: actions/setup-node@v4
with:
node-version: '24.x'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build project
run: yarn build-only
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: dist
path: dist/
- name: Package node_modules
run: tar --exclude='.cache' -cvf node_modules.tar node_modules
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: node_modules
path: node_modules.tar
test-suite-node:
name: Test suite for Node
permissions:
contents: read
needs: [build, verify-formatting]
# Blacksmith is much faster and gives better dashboards than github actions, but we are not being sponsored anymore so had to revert.
# runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 22.x, 24.x] # Dropped '23.x' (EOL) and 'latest' for stability
steps:
- name: Harden Runner
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node
# Blacksmith is much faster and gives better dashboards than github actions, but we are not being sponsored anymore so had to revert.
# uses: useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # master
with:
name: dist
path: dist/
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # master
with:
name: node_modules
path: ./
- name: Unpack node_modules
run: tar -xvf node_modules.tar
- name: Run test suite
run: yarn test-only
test-suite-browser:
name: Test suite for Browser
permissions:
contents: read
needs: [build, verify-formatting]
# Blacksmith is much faster and gives better dashboards than github actions, but we are not being sponsored anymore so had to revert.
# runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # master
with:
name: dist
path: dist/
- name: Placeholder for browser tests
run: echo '::warning ::Not able to automate browser tests yet'
- name: Run browser tests (disabled)
run: '# yarn test-browser-ci'
verify-parser:
name: Verify grammar vs generated parser
needs: []
permissions:
contents: read
# Blacksmith is much faster and gives better dashboards than github actions, but we are not being sponsored anymore so had to revert.
# runs-on: blacksmith-4vcpu-ubuntu-2204
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Get changed files
id: detect-changes
uses: tj-actions/changed-files@v47.0.5
with:
files: src/alasqlparser.jison
- name: Build from src
# This step only runs if the jison file changed
if: steps.detect-changes.outputs.any_changed == 'true'
run: |
yarn install --frozen-lockfile
yarn jison
yarn test
- name: Check generated parser for changes
if: steps.detect-changes.outputs.any_changed == 'true'
run: |
git diff --exit-code -- src/alasqlparser.js || (echo "Please run 'yarn jison && yarn test' and commit again." && exit 1)