Merge pull request #179 from fingerprintjs/fix/create-pr-workflow #48
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: Coverage | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-run-tests: | |
runs-on: ubuntu-20.04 | |
name: Build & run tests & publish coverage | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.node-version' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Dependencies and prepare packages | |
run: yarn install | |
env: | |
CI: true | |
- name: Run test | |
run: yarn test | |
- name: Create Coverage Badges | |
uses: jaywcjlove/coverage-badges-cli@e07f25709cd25486855c1ba1b26da53576ff3620 | |
with: | |
source: coverage/coverage-summary.json | |
output: coverage/lcov-report/badges.svg | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@8817a56e5bfec6e2b08345c81f4d422db53a2cdc | |
with: | |
branch: gh-pages | |
folder: ./coverage/lcov-report/ |