Skip to content

fix: fix types

fix: fix types #97

Workflow file for this run

name: Tests
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write # https://github.com/semantic-release/semantic-release/issues/2469#issuecomment-1158013884
pages: write
id-token: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # provided automatically by github itself https://docs.github.com/en/actions/security-guides/automatic-token-authentication
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # search in keepassx
jobs:
test:
runs-on: ubuntu-22.04 # https://github.com/actions/runner-images#available-images
strategy:
fail-fast: false
matrix:
version: [18, 20, 22] # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#push
# https://docs.github.com/en/actions/learn-github-actions/contexts
- name: Debug github.event
run: echo '${{ toJson(github.event) }}'
- name: Debug github
run: echo '${{ toJson(github) }}'
- name: test before bringing cache
run: |
set -x
pwd
ls -la
ls -la node_modules || true
- uses: actions/cache/restore@v3 # https://github.com/actions/cache/blob/main/examples.md#node---yarn
id: restore-cache
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: test if cache revived?
run: |
set -x
pwd
ls -la
ls -la node_modules || true
- name: npm ci
run: /bin/bash bash/swap-files-v2.sh package.json package.dev.json package-lock.json package-lock.dev.json -- npm ci
- uses: actions/cache/save@v3 # https://github.com/actions/cache/blob/main/caching-strategies.md#reusing-primary-key-from-restore-cache-as-input-to-save-action
with:
path: node_modules
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
# - name: pulling playwright docker image
# if: matrix.version == 22
# run: |
# /bin/bash .github/pull-docker-image.sh
- name: tsc
run: node node_modules/.bin/tsc -p tsconfig.check.json
- name: UNIT TESTS
run: |
set -e
set -o pipefail
mkdir -p coverage
node node_modules/.bin/vitest --config vitest.config.ts --coverage run | tee var/for-coverage-badge.log
#/bin/bash jest.sh | tee var/for-coverage-badge.log
# - name: JASMINE TESTS
# if: matrix.version == 22
# run: |
# NODE_API_PORT=4273 /bin/bash jasmine/test.sh --env .env -- --target docker
- name: generate coverage badge
if: matrix.version == 22
run: |
set -e
set -o pipefail
cat var/for-coverage-badge.log | node bash/node/coverage-badge.cjs --output coverage/coverage-badge.svg
- name: build
run: npm run build
- name: use cli
run: |
TEST_ONE="one" TEST_TWO="two" node dist/cjs/cli.cjs --mask '^TEST_' examples/preprocessed.js --debug --verbose
TEST_ONE="one" TEST_TWO="two" node dist/esm/cli.js --mask '^TEST_' examples/preprocessed.js --debug --verbose
- name: Clean before artifact
if: matrix.version == 22
run: /bin/bash .github/clean_before_github_pages.sh
# updated https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
- name: Upload artifact
if: matrix.version == 22
uses: actions/upload-pages-artifact@v3
with:
path: .
# Deployment job
github-pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: test
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
npm:
needs: test # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow#defining-prerequisite-jobs
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-22.04 # https://github.com/actions/runner-images#available-images
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 22
- name: Install semantic-release
run: /bin/bash bash/swap-files-v2.sh package.json package.dev.json package-lock.json package-lock.dev.json -- npm install semantic-release conventional-changelog-conventionalcommits
# it has to be done here beacause otherwise it will crash for node@15 with error>>> error semantic-release@19.0.5: The engine "node" is incompatible with this module. Expected version ">=16 || ^14.17". Got "15.14.0"
- name: build
run: npm run build
- name: npm pack
run: npm pack
# https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/ci-configurations/github-actions.md
- name: Release
run: node node_modules/.bin/semantic-release --debug