Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GitHub CI execute unit tests in Petals via reusable workflow #855

Merged
merged 13 commits into from
May 15, 2024
Merged
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on: [push]
# Use bash explicitly for being able to enter the conda environment
defaults:
run:
shell: bash -l {0}
shell: bash -el {0}

jobs:
build-and-test:
name: Build Env, Install, Unit Tests
name: 'Core / Unit Tests'
runs-on: ubuntu-latest
permissions:
# For publishing results
Expand Down Expand Up @@ -41,8 +41,6 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}
make
init-shell: >-
bash
# Persist environment for branch, Python version, single day
cache-environment-key: env-${{ github.ref }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}
-
Expand All @@ -59,12 +57,22 @@ jobs:
if: always()
with:
junit_files: tests_xml/tests.xml
check_name: "Unit Test Results Python ${{ matrix.python-version }}"
check_name: "Core / Unit Test Results (${{ matrix.python-version }})"
peanutfun marked this conversation as resolved.
Show resolved Hide resolved
comment_mode: "off"
-
name: Upload Coverage Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report-unittests-py${{ matrix.python-version }}
name: coverage-report-core-unittests-py${{ matrix.python-version }}
path: coverage/

test-petals:
name: Petals Compatibility
uses: CLIMADA-project/climada_petals/.github/workflows/testing.yml@github-actions
needs: build-and-test
with:
core_branch: ${{ github.ref }}
petals_branch: github-actions # TODO: Change this to 'develop' once Petals PR is merged!
peanutfun marked this conversation as resolved.
Show resolved Hide resolved
permissions:
checks: write
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Code freeze date: YYYY-MM-DD

### Added

- GitHub actions workflow for unit tests [#114](https://github.com/CLIMADA-project/climada_petals/pull/114)

### Changed

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
PYTEST_JUNIT_ARGS = --junitxml=tests_xml/tests.xml

PYTEST_COV_ARGS = \
--cov --cov-config=.coveragerc --cov-report html --cov-report xml \
--cov-report term:skip-covered
--cov --cov-config=.coveragerc --cov-report html:coverage \
--cov-report xml:coverage.xml --cov-report term:skip-covered

PYTEST_ARGS = $(PYTEST_JUNIT_ARGS) $(PYTEST_COV_ARGS)

Expand Down