forked from kripken/xml.js
-
Notifications
You must be signed in to change notification settings - Fork 7
70 lines (64 loc) · 1.96 KB
/
build-and-test.yml
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
name: Build and test
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci
- run: npm run lint
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm pack
- run: mv xmllint-wasm-*.tgz xmllint-wasm.tgz
- name: Create package output
uses: actions/upload-artifact@v3
with:
name: xmllint-wasm package
path: xmllint-wasm.tgz
test:
runs-on: ubuntu-latest
needs: [lint, build]
strategy:
matrix:
node-version: [12.x, 18.x]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: xmllint-wasm package
path: ~/package-output
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
# "Rename" the package for testing so that npm will agree to install the
# same package from the built tarball.
- run: |
sed -i 's/"name": "xmllint-wasm"/"name": "xmllint-wasm-test"/;' package.json
# Install the package from the artifact
- run: npm install file:~/package-output/xmllint-wasm.tgz
- run: cp node_modules/xmllint-wasm/index-node{.d.ts,.js.flow} .
# Add a dummy index.js file so that test/test.js can do require('../index-node.js')
- run: echo "module.exports = require('xmllint-wasm')" > index-node.js
- run: npm run check-types
- run: npm test