3: demo application is added #40
Workflow file for this run
This file contains hidden or 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 | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22, 24] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build | |
- run: npm run demo | |
- name: Upload demo files as artifact | |
if: ${{ matrix.node-version == 22 }} # && github.ref == 'refs/heads/main' | |
id: deployment | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: demo/ | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20, 22, 24] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm ci | |
- run: npm test | tee ./coverage.txt && exit ${PIPESTATUS[0]} | |
- name: Generating ci badge JSONs | |
if: ${{ matrix.node-version == 20 && github.ref == 'refs/heads/main' }} | |
uses: gaelgirodon/ci-badges-action@v1 | |
with: | |
gist-id: 334525743d4f008bb0028808bfc44798 | |
token: ${{ secrets.GIST_TOKEN }} | |
ref: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-artifacts-${{ matrix.node-version }} | |
path: coverage | |
- name: Jest Coverage Comment | |
id: coverage | |
uses: MishaKav/jest-coverage-comment@main | |
with: | |
title: Code Coverage Information | |
summary-title: Code Coverage summary | |
coverage-title: Coverage details | |
coverage-path: ./coverage.txt | |
coverage-path-prefix: src/ | |
- name: Fail if coverage too low | |
if: ${{ steps.coverage.outputs.coverage < 95 }} | |
run: | | |
echo "Coverage is below 50%!" | |
exit 1 | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy Demo to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |