diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..79c274df --- /dev/null +++ b/.github/workflows/tests.yml @@ -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 diff --git a/.gitignore b/.gitignore index 69b51c5f..bdbf7529 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules npm-debug.log .nyc_output coverage +test/*.js \ No newline at end of file diff --git a/Cakefile b/Cakefile index 83b1e84e..ec9c9c56 100644 --- a/Cakefile +++ b/Cakefile @@ -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' diff --git a/package.json b/package.json index 7bde0538..ff58405b 100644 --- a/package.json +++ b/package.json @@ -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",