ci: Try fixing unit test reports in ci.yml #2165
Workflow file for this run
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: 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} | |
| jobs: | |
| 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: Create Environment with Mamba | |
| uses: mamba-org/setup-micromamba@v1 | |
| with: | |
| environment-name: climada_env_${{ matrix.python-version }} | |
| environment-file: requirements/env_climada.yml | |
| create-args: >- | |
| python=${{ matrix.python-version }} | |
| make | |
| # Persist environment for branch, Python version, single day | |
| cache-environment-key: env-${{ github.ref }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }} | |
| - | |
| name: Install CLIMADA | |
| run: | | |
| python -m pip install "./[dev]" | |
| - | |
| name: Run Unit Tests | |
| run: | | |
| make unit_test | |
| - | |
| name: Upload Test Reports | |
| if: (!cancelled()) | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: test-results-python-${{ matrix.python-version }} | |
| path: tests_xml/tests.xml | |
| - | |
| name: Upload Coverage Reports | |
| if: (!cancelled()) | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-report-core-unittests-py${{ matrix.python-version }} | |
| path: coverage/ | |
| publish-test-results: | |
| name: "Tests Results" | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # For publishing results | |
| checks: write | |
| if: (!cancelled()) | |
| steps: | |
| - | |
| name: Download Artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: artifacts | |
| pattern: test-results-python-* | |
| - | |
| name: Publish Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| junit_files: artifacts/**/*.xml | |
| check_name: "Core / Unit Test" | |
| 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 |