Merge pull request #1280 from openshift-pipelines/automation/refresh-… #241
This file contains hidden or 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: Code Coverage | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| unit_tests: | |
| name: Run unit tests to track code coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 | |
| with: | |
| node-version: '22' | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Cache node modules | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 | |
| with: | |
| path: ~/.yarn/cache | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
| restore-keys: ${{ runner.os }}-yarn- | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Run unit tests with coverage | |
| run: yarn test --ci --maxWorkers=2 | |
| - name: Install Codecov CLI | |
| run: | | |
| curl -Os https://cli.codecov.io/latest/linux/codecov | |
| curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM | |
| curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig | |
| curl https://keybase.io/codecovsecops/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import | |
| gpgv codecov.SHA256SUM.sig codecov.SHA256SUM | |
| shasum -a 256 -c codecov.SHA256SUM | |
| chmod +x codecov | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| run: | | |
| ./codecov upload-process \ | |
| --file coverage/lcov.info \ | |
| --flag unit-tests \ | |
| --slug openshift-pipelines/console-plugin \ | |
| --git-service github \ | |
| || echo "::warning::Codecov upload failed (non-fatal)" | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |