Explicit quotes for NODE_OPTIONS
environment variable in workflow
#9
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 | |
# test, build documentation and publish | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
publish: | |
permissions: | |
contents: read | |
packages: read | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: latest | |
registry-url: https://npm.pkg.github.com | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# Install dependencies | |
- run: npm ci --verbose | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install test reporters | |
run: npm install --no-save --verbose node-test-github-reporter | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Tests | |
- name: Run tests | |
env: | |
NODE_OPTIONS: > | |
--test-reporter=spec | |
--test-reporter-destination=stdout | |
--test-reporter=node-test-github-reporter | |
--test-reporter-destination=stderr | |
--test-reporter=@mafalda-sfu/test-reporter-json | |
--test-reporter-destination=coverage.json | |
run: | | |
NODE_OPTIONS="$NODE_OPTIONS" npm test | |
test -f coverage.json # Ensure coverage.json has been created | |
# Docs | |
- name: Generate docs | |
run: npm run docs | |
- name: Publish docs | |
uses: cpina/[email protected] | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
with: | |
destination-github-username: Mafalda-SFU | |
destination-repository-name: Mafalda-SFU.github.io | |
source-directory: docs | |
target-directory: docs/${{ github.event.repository.name }} | |
user-email: [email protected] | |
user-name: Mafalda bot | |
# Coverage | |
- name: Export total coverage | |
run: | | |
export TOTAL=$( \ | |
cat coverage.json | \ | |
jq .summary.totals.coveredLinePercent | \ | |
jq '.*100|round/100' \ | |
) | |
echo "total=$TOTAL" >> $GITHUB_ENV | |
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY | |
- name: Dynamic Badges | |
uses: Schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
filename: ${{ github.event.repository.name }}.json | |
gistID: 27d772a9a3a8a945b34fd9676de40486 | |
label: Coverage | |
minColorRange: 50 | |
message: ${{ env.total }}% | |
maxColorRange: 90 | |
namedLogo: Jest | |
valColorRange: ${{ env.total }} |