doc update #21
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: [master] | |
pull_request: | |
branches: [master] | |
env: | |
# Setting an environment variable with the value of a configuration variable | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
PACKAGE_NAME: 'unknown' | |
HAVE_COVERAGE_SCRIPT: false | |
PACKAGE_VERSION: 'unknown' | |
NPM_VERSION: 'unknown' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Read package information | |
run: | | |
echo "PACKAGE_NAME=$(cat package.json | jq -r .name)" >> $GITHUB_ENV | |
echo "PACKAGE_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV | |
echo "HAVE_COVERAGE_SCRIPT=$(jq 'if .scripts.coverage == null then false else true end' package.json)" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: npm i | |
- name: Run unit tests | |
run: npm test | |
- name: Run linter checks | |
run: npm run lint | |
- name: Run and publish code coverage | |
if: | | |
github.ref == 'refs/heads/master' && | |
env.CC_TEST_REPORTER_ID != '' && | |
env.HAVE_COVERAGE_SCRIPT == 'true' | |
uses: paambaati/[email protected] | |
env: | |
CC_TEST_REPORTER_ID: ${{ env.CC_TEST_REPORTER_ID }} | |
with: | |
coverageCommand: npm run coverage |