Tests #2150
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: "Tests" | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
merge_group: | |
schedule: | |
- cron: "0 0 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
node_version: [18, 20] | |
name: Build with Node ${{ matrix.node_version }} | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node v${{ matrix.node_version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Install deps | |
run: npm ci | |
- name: Build packages | |
run: npm run build | |
- name: Lint test.ts | |
run: (cd packages/node && npx tsc -p ./tsconfig.lint-test.json) | |
- name: Run Tests | |
run: | | |
npm run test | |
test -f packages/node/dist/qrcode.png || (echo "File not found" && exit 1) | |
- name: Run cli and test it | |
run: | | |
node packages/node/lib/cli.js --opt.color white --opt.finder.round 0.5 qrcode-cli.png | |
test -f qrcode-cli.png || (echo "File not found" && exit 1) | |
general-checks: | |
name: Run general checks | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install deps | |
run: npm ci | |
- name: Run prettier | |
run: npx prettier --list-different . | |
- name: Run eslint | |
run: npx eslint . | |
- name: Run update-readme | |
run: npm run update-readme | |
- name: Run prettier on Readmes | |
run: npx prettier --write "**/*.md" | |
- name: Check differences | |
run: git diff --exit-code |