Skip to content

GitHub builds

GitHub builds #8

Workflow file for this run

name: Test Package
on:
pull_request:
jobs:
run-tests:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- run: npm run test
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
test-results/junit.xml
base_branch_coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- run: npm run test
- name: Upload code coverage for master
uses: actions/upload-artifact@v3
with:
name: ref-lcov.info
path: ./test-results/coverage/lcov.info
checks:
runs-on: ubuntu-latest
needs: base_branch_coverage
steps:
- uses: actions/checkout@v3
- name: Download base coverage
uses: actions/download-artifact@v3
with:
name: ref-lcov.info
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- run: npm run test
- name: Generate code coverage
if: always()
id: code-coverage
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./test-results/coverage/lcov.info"
base-lcov-file: "./lcov.info"
send-summary-comment: true
show-annotations: "warning"