diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4166bca --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,44 @@ +name: Build +on: [pull_request, workflow_dispatch] + +jobs: + build: + name: build + runs-on: ubuntu-latest + strategy: + matrix: + node: [ '12', '14', '16' ] + serverless-version: ['latest', 'latest~1', 'latest~2'] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: 'npm' + - run: npm install + - run: npm install --no-save --ignore-scripts `npx npm-get-version serverless@$SERVERLESS_VERSION` + env: + SERVERLESS_VERSION: ${{ matrix.serverless-version }} + - run: npm run lint + - run: npm test + + - name: Coveralls Parallel + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + flag-name: run-${{ matrix.node }} + # This is a parallel build so need this + parallel: true + +# As testing against multiple versions need this to + # finish the parallel build + finish: + name: Coveralls coverage + needs: build + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true diff --git a/package.json b/package.json index 1958785..b6427c2 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "scripts": { "clean": "rimraf dist", "test-bare": "npm run compile && mocha ./dist/test/**/*.test.js", - "test": "nyc mocha --require ts-node/register --require source-map-support/register ./src/test/**/*.test.ts", + "test": "nyc --reporter=lcovonly mocha --require ts-node/register --require source-map-support/register ./src/test/**/*.test.ts", "coverage": "nyc report --reporter=text-lcov | coveralls", "compile": "tsc", "watch": "tsc -w",