.github/workflows/ci.yml
# The name of the workflow
name: build
# What conditions trigger the workflow
# In this case, all pushes and pull requests
on:
pull_request:
push:
branches:
- main
# The jobs that will be run, usually in parallel
jobs:
# A job to generate and publish code coverage
coverage:
# A more descriptive name of the job
name: Test and publish test coverage
# The OS on which the job will run
runs-on: ubuntu-latest
# The steps for the job, executed in sequence
steps:
# A GitHub action for checking out the current branch
- uses: actions/checkout@v2
# A GitHub action to setup Node.js
- uses: actions/setup-node@v1
with:
node-version: '12'
# Run the NPM install command before proceeding
- run: npm install
- run: npm run lint
- run: cp .env.sample .env
# A GitHub action for running tests and publishing coverage
- uses: paambaati/codeclimate-action@v2.6.0
env:
# An environment variable, the value is a GitHub repo secret
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
TEST_DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
OKTA_ORG_URL: ${{ secrets.OKTA_ORG_URL }}
OKTA_CLIENT_ID: ${{ secrets.OKTA_CLIENT_ID }}
with:
# Run our `coverage` script in our `package.json`
coverageCommand: npm run coverage
# By default, this looks for a `coverage` folder in the root of your project, but you may need to change this
coverageLocations: './coverage/clover.xml:clover'
# Great for troubleshooting
debug: true