Skip to content

ci: Update test results reporting #2451

ci: Update test results reporting

ci: Update test results reporting #2451

Workflow file for this run

name: GitHub CI
# Execute this for every push
on: [push]
# Use bash explicitly for being able to enter the conda environment
defaults:
run:
shell: bash -el {0}
env:
CLIMADA_DATA_DOI: 10.5281/zenodo.20595842
jobs:
integration-test:
name: 'Core / Integration Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
-
name: Checkout Repo
uses: actions/checkout@v4
# --- Modify paths in climada.conf ---
-
name: Write climada.conf system data
uses: amochkin/action-json@v1
with:
mode: write
file: climada.conf
property: local_data.system
value: ${{ github.workspace }}/climada/data
-
name: Write climada.conf demo data
uses: amochkin/action-json@v1
with:
mode: write
file: climada.conf
property: local_data.demo
value: ${{ github.workspace }}/climada/demo
-
run: |
cat climada.conf
# ---
-
name: Install make
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: make
-
name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.12"
cache-suffix: integrationtest
-
name: Install dependencies
run: |
uv sync --locked --dev
-
name: Cache data
uses: actions/cache@v5
with:
path: climada.zip
key: ${{ env.CLIMADA_DATA_DOI }}
-
name: Download and unzip data
run: |
uvx zenodo_get ${{ env.CLIMADA_DATA_DOI }}
unzip -o climada.zip -d ${{ github.workspace }}
-
name: Run Integration Tests
run: |
uv run -- make integ_test
-
name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@7
with:
name: Test Results (Python ${{ matrix.python-version }})
path: tests_xml/tests.xml
-
name: Upload Coverage Reports
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: Coverage Report Integration Tests (Python ${{ matrix.python-version }})
path: coverage/
build-and-test:
name: 'Core / Unit Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20
# Run this test for different Python versions
strategy:
# Do not abort other tests if only a single one fails
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
-
name: Checkout Repo
uses: actions/checkout@v4
-
# Store the current date to use it as cache key for the environment
name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
-
name: Install make
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: make
-
name: Install Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
-
name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ./
pip install --group dev
-
name: Run Unit Tests
run: |
make unit_test
-
name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@7
with:
name: test-results-core-unittests-py${{ matrix.python-version }}
path: tests_xml/tests.xml
-
name: Upload Coverage Reports
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: coverage-report-core-unittests-py${{ matrix.python-version }}
path: coverage/
publish-test-results:
name: "Core / Publish Test Results"
needs: [build-and-test, integration-test]
runs-on: ubuntu-latest
permissions:
checks: write
steps:
-
name: Download Test Results
uses: actions/download-artifact@v8
with:
pattern: test-results-core-unittests-py*
path: results
-
name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "results/**/*.xml"
check_name: "Core / Test Results"
comment_mode: "off"
test-petals:
name: Petals Compatibility
uses: CLIMADA-project/climada_petals/.github/workflows/testing.yml@develop
needs: build-and-test
with:
core_branch: ${{ github.ref }}
petals_branch: develop
permissions:
checks: write