IliyanID/Portfolio-Website

View on GitHub
.github/workflows/coverage.yml

Summary

Maintainability
Test Coverage
name: code-coverage

# daily at 9:14 am UTC (2:14 am MT)
on: [pull_request]
 

jobs:
  test-coverage:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]

    steps:
    - uses: actions/checkout@v2


    - name: Set up node.js (${{ matrix.node-version }})
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}

    - name: Log originating commit ID
      run: echo "full_sha1=$(git cat-file -p HEAD | grep parent | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV 
 
    - name: Install client dependencies
      run: cd client && npm install
    
    - name: Prepare Codeclimate reporting tools
      env:
        GIT_COMMIT_SHA: ${{ env.full_sha1 }} 
        GIT_BRANCH: ${{ github.head_ref }}
        CC_TEST_REPORTER_ID: 043f9f3a879dc8091105e8640c9a3dc7f811e5af0e89e677288cb3fc2b33fb3f
      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

    - name: Run client tests
      run: |
        sudo npm run test-linux --prefix client
      

    - name: Finish and report Codeclimate statistics
      env:
        GIT_COMMIT_SHA: ${{ env.full_sha1 }} 
        GIT_BRANCH: "master"
        CC_TEST_REPORTER_ID: 043f9f3a879dc8091105e8640c9a3dc7f811e5af0e89e677288cb3fc2b33fb3f
      run: |
        sudo mv /home/runner/work/Portfolio-Website/Portfolio-Website/client/target/coverage/client/clover.xml .
        ls
        ./cc-test-reporter after-build --coverage-input-type clover --exit-code $?