Fix node v7 incompatibility #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: JsonStreamStringify-CI | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.head_ref || 'push' }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# if: startsWith(github.ref, 'refs/tags/') || github.head_ref || ${{ env.ACT }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: volta-cli/action@v4 | |
with: | |
node-version: 18 | |
- run: npm ci | |
- run: npm run lint | |
- run: npm run build | |
- run: npx es-check es8 'lib/umd/index.js' | |
- run: cp -r copy_to_lib/* lib | |
# install older mocha for node<14 tests | |
- run: npm i mocha@6 --no-save | |
- uses: montudor/action-zip@v1 | |
with: | |
args: zip -0 -qq -r node_modules.zip node_modules | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: node-modules-artifact-${{ github.run_number }} | |
retention-days: 1 | |
path: node_modules.zip | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifact-${{ github.run_number }} | |
retention-days: 1 | |
path: | | |
package.json | |
package-lock.json | |
README.md | |
LICENSE | |
lib | |
test | |
coverage: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifact-${{ github.run_number }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: node-modules-artifact-${{ github.run_number }} | |
- uses: montudor/action-zip@v1 | |
with: | |
args: unzip -qq node_modules.zip -d . | |
- uses: volta-cli/action@v4 | |
with: | |
node-version: 18 | |
- run: npm run coverage | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-${{ github.run_number }} | |
retention-days: 1 | |
path: coverage | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
if: ${{ !env.ACT }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
test: | |
needs: build | |
strategy: | |
matrix: | |
node: ['7.10.1', 10, 16] # 18 is tested by coverage in build stage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifact-${{ github.run_number }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: node-modules-artifact-${{ github.run_number }} | |
- uses: montudor/action-zip@v1 | |
with: | |
args: unzip -qq node_modules.zip -d . | |
- uses: volta-cli/action@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- run: volta run --node ${{ matrix.node }} npm test | |
deploy: | |
needs: [test, coverage] | |
runs-on: ubuntu-latest | |
environment: deploy | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-artifact-${{ github.run_number }} | |
- run: npm publish --access public | |
if: ${{ !env.ACT }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |