Skip to content

Commit f8c0a86

Browse files
committed
[Tests] migrate tests to Github Actions
1 parent 58e59dc commit f8c0a86

File tree

13 files changed

+302
-19
lines changed

13 files changed

+302
-19
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xlsx.js

.github/workflows/node-4+.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: 'Tests: node.js'
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
matrix:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
latest: ${{ steps.set-matrix.outputs.requireds }}
10+
steps:
11+
- uses: ljharb/actions/node/matrix@main
12+
id: set-matrix
13+
with:
14+
versionsAsRoot: true
15+
type: 'majors'
16+
preset: '>=4'
17+
18+
latest:
19+
needs: [matrix]
20+
name: 'latest majors'
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
27+
include:
28+
- node-version: '14.'
29+
env:
30+
TZ: America/New_York
31+
- node-version: '13.'
32+
env:
33+
TZ: Europe/London
34+
- node-version: '12.'
35+
env:
36+
TZ: Asia/Seoul
37+
- node-version: '11.'
38+
env:
39+
TZ: America/Los_Angeles
40+
FMTS: misc
41+
- node-version: '10.'
42+
env:
43+
TZ: Europe/Berlin
44+
FMTS: misc
45+
- node-version: '9.'
46+
env:
47+
TZ: Asia/Kolkata
48+
FMTS: misc
49+
- node-version: '8.'
50+
env:
51+
TZ: Asia/Shanghai
52+
FMTS: misc
53+
- node-version: '7.'
54+
env:
55+
TZ: America/Cancun
56+
FMTS: misc
57+
- node-version: '6.'
58+
env:
59+
TZ: Asia/Seoul
60+
FMTS: misc
61+
- node-version: '5.'
62+
env:
63+
TZ: America/Anchorage
64+
FMTS: misc
65+
- node-version: '4.'
66+
env:
67+
TZ: America/Barbados
68+
FMTS: misc
69+
- node-version: '4.4.7' # see GH issue #1150
70+
env:
71+
TZ: Asia/Tokyo
72+
FMTS: misc
73+
74+
steps:
75+
- uses: actions/checkout@v2
76+
- uses: ljharb/actions/node/install@main
77+
name: 'nvm install ${{ matrix.node-version }} && npm install'
78+
with:
79+
node-version: ${{ matrix.node-version }}
80+
- run: make init
81+
- run: 'cd test_files; make all; cd -'
82+
- run: npm run tests-only
83+
84+
node:
85+
name: 'node 4+'
86+
needs: [latest]
87+
runs-on: ubuntu-latest
88+
steps:
89+
- run: 'echo tests completed'

.github/workflows/node-iojs.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Tests: node.js (io.js)'
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
matrix:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
latest: ${{ steps.set-matrix.outputs.requireds }}
10+
steps:
11+
- uses: ljharb/actions/node/matrix@main
12+
id: set-matrix
13+
with:
14+
type: 'majors'
15+
preset: 'iojs'
16+
17+
latest:
18+
needs: [matrix]
19+
name: 'latest majors'
20+
runs-on: ubuntu-latest
21+
22+
strategy:
23+
fail-fast: false
24+
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: ljharb/actions/node/install@main
29+
name: 'nvm install ${{ matrix.node-version }} && npm install'
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
skip-ls-check: true
33+
- run: make init
34+
- run: 'cd test_files; make all; cd -'
35+
- run: npm run tests-only
36+
37+
node:
38+
name: 'io.js'
39+
needs: [latest]
40+
runs-on: ubuntu-latest
41+
steps:
42+
- run: 'echo tests completed'

.github/workflows/node-pretest.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Tests: pretest/posttest'
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
pretest:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: ljharb/actions/node/install@main
12+
name: 'nvm install lts/* && npm install'
13+
with:
14+
node-version: 'lts/*'
15+
- run: make init
16+
- run: 'cd test_files; make all; cd -'
17+
- run: npm run pretest
18+
19+
# posttest:
20+
# runs-on: ubuntu-latest
21+
22+
# steps:
23+
# - uses: actions/checkout@v2
24+
# - uses: ljharb/actions/node/install@main
25+
# name: 'nvm install lts/* && npm install'
26+
# with:
27+
# node-version: 'lts/*'
28+
# - run: make init
29+
# - run: 'cd test_files; make all; cd -'
30+
# - run: npm run posttest

.github/workflows/node-zero.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: 'Tests: node.js (0.x)'
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
matrix:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
stable: ${{ steps.set-matrix.outputs.requireds }}
10+
unstable: ${{ steps.set-matrix.outputs.optionals }}
11+
steps:
12+
- uses: ljharb/actions/node/matrix@main
13+
id: set-matrix
14+
with:
15+
versionsAsRoot: true
16+
preset: '0.x'
17+
18+
stable:
19+
needs: [matrix]
20+
name: 'stable minors'
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
node-version: ${{ fromJson(needs.matrix.outputs.stable) }}
27+
include:
28+
- node-version: '0.12.'
29+
env:
30+
TZ: America/Cayman
31+
FMTS: misc
32+
- node-version: '0.10.'
33+
env:
34+
TZ: Pacific/Honolulu
35+
FMTS: misc
36+
- node-version: '0.8.'
37+
env:
38+
TZ: America/Mexico_City
39+
FMTS: misc
40+
41+
steps:
42+
- uses: actions/checkout@v2
43+
- uses: ljharb/actions/node/install@main
44+
name: 'nvm install ${{ matrix.node-version }} && npm install'
45+
with:
46+
node-version: ${{ matrix.node-version }}
47+
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
48+
skip-ls-check: true
49+
- run: make init
50+
- run: 'cd test_files; make all; cd -'
51+
- run: npm run tests-only
52+
53+
unstable:
54+
needs: [matrix, stable]
55+
name: 'unstable minors'
56+
continue-on-error: true
57+
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
58+
runs-on: ubuntu-latest
59+
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
node-version: ${{ fromJson(needs.matrix.outputs.unstable) }}
64+
65+
steps:
66+
- uses: actions/checkout@v2
67+
- uses: ljharb/actions/node/install@main
68+
name: 'nvm install ${{ matrix.node-version }} && npm install'
69+
with:
70+
node-version: ${{ matrix.node-version }}
71+
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
72+
skip-ls-check: true
73+
- run: make init
74+
- run: 'cd test_files; make all; cd -'
75+
- run: npm run tests-only
76+
77+
node:
78+
name: 'node 0.x'
79+
needs: [stable, unstable]
80+
runs-on: ubuntu-latest
81+
steps:
82+
- run: 'echo tests completed'

.github/workflows/rebase.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Automatic Rebase
2+
3+
on: [pull_request_target]
4+
5+
jobs:
6+
_:
7+
name: "Automatic Rebase"
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: ljharb/rebase@master
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Require “Allow Edits”
2+
3+
on: [pull_request_target]
4+
5+
jobs:
6+
_:
7+
name: "Require “Allow Edits”"
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: ljharb/require-allow-edits@main

.spelling

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ runtime
9393
serverless
9494
submodule
9595
transpiled
96+
node.js
97+
commonjs
98+
async
99+
uncheck
96100

97101
- demos/altjs/README.md
98102
ChakraCore

Makefile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ FLOWAUX=$(patsubst %.js,%.flow.js,$(AUXTARGETS))
1919
AUXSCPTS=xlsxworker.js
2020
FLOWTGTS=$(TARGET) $(AUXTARGETS) $(AUXSCPTS) $(MINITGT)
2121
UGLIFYOPTS=--support-ie8 -m
22-
CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar
22+
# CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar
2323

2424
## Main Targets
2525

@@ -177,31 +177,31 @@ demo-systemjs: ## Run systemjs demo build
177177
## Code Checking
178178

179179
.PHONY: fullint
180-
fullint: lint old-lint tslint flow mdlint ## Run all checks
180+
fullint: lint mdlint ## Run all checks (removed: old-lint, tslint, flow)
181181

182182
.PHONY: lint
183183
lint: $(TARGET) $(AUXTARGETS) ## Run eslint checks
184-
@eslint --ext .js,.njs,.json,.html,.htm $(TARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json bower.json
185-
if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi
184+
@./node_modules/.bin/eslint --ext .js,.njs,.json,.html,.htm $(TARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json bower.json
185+
if [ -n "$(CLOSURE-)" ] && [ -e "${CLOSURE}" ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi
186186

187187
.PHONY: old-lint
188188
old-lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
189-
@jshint --show-non-errors $(TARGET) $(AUXTARGETS)
190-
@jshint --show-non-errors $(CMDS)
191-
@jshint --show-non-errors package.json bower.json test.js
192-
@jshint --show-non-errors --extract=always $(HTMLLINT)
193-
@jscs $(TARGET) $(AUXTARGETS) test.js
189+
@./node_modules/.bin/jshint --show-non-errors $(TARGET) $(AUXTARGETS)
190+
@./node_modules/.bin/jshint --show-non-errors $(CMDS)
191+
@./node_modules/.bin/jshint --show-non-errors package.json bower.json test.js
192+
@./node_modules/.bin/jshint --show-non-errors --extract=always $(HTMLLINT)
193+
@./node_modules/.bin/jscs $(TARGET) $(AUXTARGETS) test.js
194194
if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi
195195

196196
.PHONY: tslint
197197
tslint: $(TARGET) ## Run typescript checks
198198
#@npm install dtslint typescript
199199
#@npm run-script dtslint
200-
dtslint types
200+
./node_modules/.bin/dtslint types
201201

202202
.PHONY: flow
203203
flow: lint ## Run flow checker
204-
@flow check --all --show-all-errors --include-warnings
204+
@./node_modules/.bin/flow check --all --show-all-errors --include-warnings
205205

206206
.PHONY: cov
207207
cov: misc/coverage.html ## Run coverage test
@@ -237,8 +237,8 @@ DEMOMDS=$(sort $(wildcard demos/*/README.md))
237237
MDLINT=$(DEMOMDS) $(READEPS) demos/README.md
238238
.PHONY: mdlint
239239
mdlint: $(MDLINT) ## Check markdown documents
240-
alex $^
241-
mdspell -a -n -x -r --en-us $^
240+
./node_modules/.bin/alex $^
241+
./node_modules/.bin/mdspell -a -n -x -r --en-us $^
242242

243243
.PHONY: help
244244
help:

demos/google-sheet/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This imports both `xlsx` and `drive-db` libraries. While these are written in co
4141
})();
4242
```
4343

44+
<!-- alex ignore retext-profanities -->
4445
This is what is called an [Immediately Invoked Function Expression](https://flaviocopes.com/javascript-iife/). These are normally used to either create a new execution context, or in this case to allow to run async code easier.
4546

4647
```js

0 commit comments

Comments
 (0)