testing package.json formatting update #133
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: Run tests and Code Climate Reporting | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16, 18, 20, '*'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Set ENV for codeclimate (pull_request) | |
run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF | |
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV | |
echo "GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)" >> $GITHUB_ENV | |
if: github.event_name == 'pull_request' | |
- name: Set ENV for codeclimate (push) | |
run: | | |
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV | |
if: github.event_name == 'push' | |
- name: Install Code Climate test report | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter before-build | |
- run: npm install | |
- run: npm run cover | |
- name: Send Report to Code Climate | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
if: ${{ success() }} | |
run: ./cc-test-reporter after-build -t lcov ./coverage/lcov.info |