Add cpg-id-checker (#1) #6
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: Test | |
on: push | |
jobs: | |
run-unittests: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_BUILDKIT: 1 | |
BUILDKIT_PROGRESS: plain | |
CLOUDSDK_CORE_DISABLE_PROMPTS: 1 | |
defaults: | |
run: | |
shell: bash -eo pipefail -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Setup build env | |
run: | | |
pip install coverage | |
- name: "Run unit tests" | |
id: runtests | |
run: | | |
coverage run -m unittest discover | |
rc=$? | |
coverage xml | |
echo "rc=$rc" >> $GITHUB_OUTPUT | |
- name: "Upload coverage report" | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.xml | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Fail if tests are not passing | |
if: ${{ steps.runtests.outputs.rc != 0 }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.setFailed('Unit tests failed with rc = ${{ steps.runtests.outputs.rc }}') |