CI #596
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: CI | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- version: 10.x | |
- version: 12.x | |
- version: 14.x | |
- version: 16.x | |
- version: 18.x | |
- version: 20.x | |
# TODO(mmarchini): fix tests on windows and re-enable it here | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-${{ matrix.version }}-node-modules-${{ hashFiles('**/package-lock.json') }} | |
- name: Use Node.js ${{ matrix.node.version }} ${{ matrix.node.mirror }} | |
uses: actions/setup-node@v2-beta | |
with: | |
node-version: ${{ matrix.node.version }} | |
- name: npm install and test | |
run: | | |
npm install | |
npm run coverage-ci | |
- uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
linter: | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js LTS | |
uses: actions/setup-node@v2-beta | |
with: | |
node-version: 12.x | |
- name: npm install and lint | |
run: | | |
npm install | |
npm run linter | |
release-please: | |
runs-on: ubuntu-latest | |
needs: [linter, tests] | |
if: github.event_name == 'push' | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: node | |
package-name: "@mmarchini/observe" | |
# The logic below handles the npm publication: | |
- uses: actions/checkout@v2 | |
# these if statements ensure that a publication only occurs when | |
# a new release is created: | |
if: ${{ steps.release.outputs.release_created }} | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
if: ${{ steps.release.outputs.release_created }} | |
- run: npm i | |
if: ${{ steps.release.outputs.release_created }} | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
if: ${{ steps.release.outputs.release_created }} |