Skip to content

GitHub builds

GitHub builds #12

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
if: always()
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
if: always()
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
continue-on-error: true
- 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"