Skip to content

Commit

Permalink
[Tests] migrate tests to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 8, 2021
1 parent 58e59dc commit f8c0a86
Show file tree
Hide file tree
Showing 13 changed files with 302 additions and 19 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xlsx.js
89 changes: 89 additions & 0 deletions .github/workflows/node-4+.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: 'Tests: node.js'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.set-matrix.outputs.requireds }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
versionsAsRoot: true
type: 'majors'
preset: '>=4'

latest:
needs: [matrix]
name: 'latest majors'
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
include:
- node-version: '14.'
env:
TZ: America/New_York
- node-version: '13.'
env:
TZ: Europe/London
- node-version: '12.'
env:
TZ: Asia/Seoul
- node-version: '11.'
env:
TZ: America/Los_Angeles
FMTS: misc
- node-version: '10.'
env:
TZ: Europe/Berlin
FMTS: misc
- node-version: '9.'
env:
TZ: Asia/Kolkata
FMTS: misc
- node-version: '8.'
env:
TZ: Asia/Shanghai
FMTS: misc
- node-version: '7.'
env:
TZ: America/Cancun
FMTS: misc
- node-version: '6.'
env:
TZ: Asia/Seoul
FMTS: misc
- node-version: '5.'
env:
TZ: America/Anchorage
FMTS: misc
- node-version: '4.'
env:
TZ: America/Barbados
FMTS: misc
- node-version: '4.4.7' # see GH issue #1150
env:
TZ: Asia/Tokyo
FMTS: misc

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
- run: make init
- run: 'cd test_files; make all; cd -'
- run: npm run tests-only

node:
name: 'node 4+'
needs: [latest]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
42 changes: 42 additions & 0 deletions .github/workflows/node-iojs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Tests: node.js (io.js)'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.set-matrix.outputs.requireds }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
type: 'majors'
preset: 'iojs'

latest:
needs: [matrix]
name: 'latest majors'
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
skip-ls-check: true
- run: make init
- run: 'cd test_files; make all; cd -'
- run: npm run tests-only

node:
name: 'io.js'
needs: [latest]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
30 changes: 30 additions & 0 deletions .github/workflows/node-pretest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Tests: pretest/posttest'

on: [pull_request, push]

jobs:
pretest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install lts/* && npm install'
with:
node-version: 'lts/*'
- run: make init
- run: 'cd test_files; make all; cd -'
- run: npm run pretest

# posttest:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v2
# - uses: ljharb/actions/node/install@main
# name: 'nvm install lts/* && npm install'
# with:
# node-version: 'lts/*'
# - run: make init
# - run: 'cd test_files; make all; cd -'
# - run: npm run posttest
82 changes: 82 additions & 0 deletions .github/workflows/node-zero.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: 'Tests: node.js (0.x)'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
stable: ${{ steps.set-matrix.outputs.requireds }}
unstable: ${{ steps.set-matrix.outputs.optionals }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
versionsAsRoot: true
preset: '0.x'

stable:
needs: [matrix]
name: 'stable minors'
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.stable) }}
include:
- node-version: '0.12.'
env:
TZ: America/Cayman
FMTS: misc
- node-version: '0.10.'
env:
TZ: Pacific/Honolulu
FMTS: misc
- node-version: '0.8.'
env:
TZ: America/Mexico_City
FMTS: misc

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
skip-ls-check: true
- run: make init
- run: 'cd test_files; make all; cd -'
- run: npm run tests-only

unstable:
needs: [matrix, stable]
name: 'unstable minors'
continue-on-error: true
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.unstable) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
skip-ls-check: true
- run: make init
- run: 'cd test_files; make all; cd -'
- run: npm run tests-only

node:
name: 'node 0.x'
needs: [stable, unstable]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
15 changes: 15 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Automatic Rebase

on: [pull_request_target]

jobs:
_:
name: "Automatic Rebase"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/require-allow-edits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Require “Allow Edits”

on: [pull_request_target]

jobs:
_:
name: "Require “Allow Edits”"

runs-on: ubuntu-latest

steps:
- uses: ljharb/require-allow-edits@main
4 changes: 4 additions & 0 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ runtime
serverless
submodule
transpiled
node.js
commonjs
async
uncheck

- demos/altjs/README.md
ChakraCore
Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FLOWAUX=$(patsubst %.js,%.flow.js,$(AUXTARGETS))
AUXSCPTS=xlsxworker.js
FLOWTGTS=$(TARGET) $(AUXTARGETS) $(AUXSCPTS) $(MINITGT)
UGLIFYOPTS=--support-ie8 -m
CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar
# CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar

## Main Targets

Expand Down Expand Up @@ -177,31 +177,31 @@ demo-systemjs: ## Run systemjs demo build
## Code Checking

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

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

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

.PHONY: tslint
tslint: $(TARGET) ## Run typescript checks
#@npm install dtslint typescript
#@npm run-script dtslint
dtslint types
./node_modules/.bin/dtslint types

.PHONY: flow
flow: lint ## Run flow checker
@flow check --all --show-all-errors --include-warnings
@./node_modules/.bin/flow check --all --show-all-errors --include-warnings

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

.PHONY: help
help:
Expand Down
1 change: 1 addition & 0 deletions demos/google-sheet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ This imports both `xlsx` and `drive-db` libraries. While these are written in co
})();
```

<!-- alex ignore retext-profanities -->
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.

```js
Expand Down
2 changes: 1 addition & 1 deletion docbits/25_manip.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ error if the workbook is empty.

- <http://sheetjs.com/demos/modify.html> read + modify + write files

- <https://github.com/SheetJS/js-xlsx/blob/master/bin/xlsx.njs> node
- <https://github.com/SheetJS/js-xlsx/blob/HEAD/bin/xlsx.njs> node

The node version installs a command line tool `xlsx` which can read spreadsheet
files and output the contents in various formats. The source is available at
Expand Down
2 changes: 1 addition & 1 deletion docbits/73_sheetprops.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The visibility setting is stored in the `Hidden` property of sheet props array.
| 1 | Hidden |
| 2 | Very Hidden |

With <https://rawgit.com/SheetJS/test_files/master/sheet_visibility.xlsx>:
With <https://rawgit.com/SheetJS/test_files/HEAD/sheet_visibility.xlsx>:

```js
> wb.Workbook.Sheets.map(function(x) { return [x.name, x.Hidden] })
Expand Down
Loading

0 comments on commit f8c0a86

Please sign in to comment.