Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a GitHub action to build the package and run the tests against Node 16, 18 and 20 #686

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: xml2js tests
on: [ push ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 'current', 'lts/*', 'lts/-1' ]
steps:
- uses: actions/checkout@v3
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build-ci
- run: npm run build-ci-tests
- run: npm run coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
npm-debug.log
.nyc_output
coverage
test/*.js
8 changes: 8 additions & 0 deletions Cakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ task 'build', 'continually build the JavaScript code', ->
coffee = spawn coffeeScript, ['-cw', '-o', 'lib', 'src']
coffee.stdout.on 'data', (data) -> console.log data.toString().trim()

task 'build-ci', 'build the JavaScript code', ->
coffeeScript = if process.platform == 'win32' then 'coffee.cmd' else 'coffee'
coffee = spawn coffeeScript, ['-c', '-o', 'lib', 'src']

task 'build-ci-tests', 'build the tests', ->
coffeeScript = if process.platform == 'win32' then 'coffee.cmd' else 'coffee'
coffee = spawn coffeeScript, ['-c', '-o', 'test', 'test']

task 'doc', 'rebuild the Docco documentation', ->
exec([
'docco src/xml2js.coffee'
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
},
"scripts": {
"build": "cake build",
"build-ci": "cake build-ci",
"build-ci-tests": "cake build-ci-tests",
"test": "zap",
"coverage": "nyc npm test && nyc report",
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
Expand Down