10: ESLint config added #55
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 | |
pull-requests: write | |
statuses: write | |
packages: read | |
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 | |
with: | |
# super-linter needs the full git history to get the | |
# list of files that changed across commits | |
fetch-depth: 0 | |
persist-credentials: false | |
- 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 }} | |
id: deployment | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: demo/ | |
- name: Super-linter | |
uses: super-linter/super-linter/slim@v8.1.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TYPESCRIPT_ES_CONFIG_FILE: '../eslint.config.mts' | |
FILTER_REGEX_INCLUDE: ^src/ | |
VALIDATE_GIT_COMMITLINT: false | |
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 | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy Demo to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |