Skip to content

PIMS-1622: Handle task array #799

PIMS-1622: Handle task array

PIMS-1622: Handle task array #799

name: Express API - Jest Test Coverage
on:
pull_request:
types: [opened, synchronize] # Triggered by opened or changed pull requests.
branches: [main]
paths:
- '.github/workflows/api-jest-coverage.yaml'
- 'express-api/**' # Triggers on changes to files in the express-api/ directory.
- '!express-api/.eslintrc.cjs' # Will not trigger on changes to the following.
- '!express-api/.gitignore'
- '!express-api/prettierrc.cjs'
- '!express-api/Dockerfile*'
- '!express-api/tsconfig.json'
- '!express-api/README.md'
jobs:
codeclimate-jest-coverage:
runs-on: ubuntu-latest
env:
GIT_BRANCH: ${{ github.event.pull_request.head.ref }}
GIT_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
FRONTEND_URL: ${{ secrets.FRONTEND_URL }}
BACKEND_URL: ${{ secrets.BACKEND_URL }}
SSO_CLIENT_ID: ${{ secrets.SSO_CLIENT_ID }}
SSO_CLIENT_SECRET: ${{ secrets.SSO_CLIENT_SECRET }}
CC_TEST_REPORTER_ID: 37fdb6f058122c17fc2419b78b02b1d5582694f7cd84a2b735de8eec235e9c5b
steps:
# Confirm GitHub ENVs.
- name: Echo ENVs
run: |
echo $GIT_BRANCH
echo $GIT_COMMIT_SHA
# Checkout code from Repo.
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
# Import Code Climate test reporter.
- name: Import Code Climate
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
# Allow test reporter to be executed.
- name: Execute Permissions for Code Climate Binary
run: |
chmod +x ./cc-test-reporter
# Notifies Code Climate of impending report.
- name: Test Reporter Before Build
run: |
./cc-test-reporter before-build
# Install dependencies.
- name: Install Dependencies
working-directory: ./express-api
run: |
npm i
# Generate coverage report.
- name: Run Coverage Report
working-directory: ./express-api
run: |
npm run coverage
# Use lcov to format coverage for Code Climate
# -t is for coverage type
- name: Format Test Coverage
run: |
./cc-test-reporter format-coverage ${{ github.workspace }}/express-api/coverage/lcov.info -t lcov --output ${{ github.workspace }}/express-api/coverage/coverage.json
# Upload coverage to Code Climate.
# -i is for input, -d for detached
- name: Upload Coverage
run: |
./cc-test-reporter upload-coverage -d -i ${{ github.workspace }}/express-api/coverage/coverage.json