fix(icon-etl): Upload logs #548
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: Python CI | |
on: | |
push: | |
branches: [] | |
paths-ignore: | |
- 'README.md' | |
pull_request: | |
branches: [] | |
paths-ignore: | |
- 'README.md' | |
# Specify concurrency such that only one workflow can run at a time | |
# * Different workflow files are not affected | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Define a dependencies job that runs on all branches and PRs | |
# * Installs dependencies and caches them | |
build-venv: | |
runs-on: ubuntu-latest | |
container: quay.io/condaforge/miniforge3:latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Restore cached virtualenv, if available | |
# * The pyproject.toml hash is part of the cache key, invalidating | |
# the cache if the file changes | |
- name: Restore cached virtualenv | |
id: restore-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ./venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/pyproject.toml') }} | |
# Should mirror the build-venv stage in the Containerfile | |
- name: Build venv | |
run: | | |
apt -qq update && apt -qq install -y build-essential | |
conda create -p ./venv python=3.11 | |
./venv/bin/python -m pip install --upgrade -q pip wheel setuptools | |
if: steps.restore-cache.outputs.cache-hit != 'true' | |
# Should mirror the build-reqs stage in the Containerfile | |
# * Except this installs the dev dependencies and binaries as well | |
- name: Install all dependencies | |
run: | | |
conda install -p ./venv -q -y eccodes zarr | |
./venv/bin/python -m pip install -q .[dev] | |
if: steps.restore-cache.outputs.cache-hit != 'true' | |
# Cache the virtualenv for future runs | |
- name: Cache virtualenv | |
uses: actions/cache/save@v3 | |
with: | |
path: ./venv | |
key: ${{ steps.restore-cache.outputs.cache-primary-key }} | |
if: steps.restore-cache.outputs.cache-hit != 'true' | |
# Define a unittest job that runs on all branches and PRs | |
test-unit: | |
runs-on: ubuntu-latest | |
needs: build-venv | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Restore cached virtualenv | |
- name: Restore cached virtualenv | |
uses: actions/cache/restore@v3 | |
with: | |
path: ./venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/pyproject.toml') }} | |
# Run unittests | |
# * Produce JUnit XML report | |
- name: Run unit tests | |
env: | |
CDSAPI_URL: "https://ads.atmosphere.copernicus.eu/api/v2" | |
CDSAPI_KEY: "fake1:fake33-bogus44-falsehood-key55" | |
run: ./venv/bin/python -m pytest --junitxml=ut-report.xml tests | |
# Create test summary to be visualised on the job summary screen on GitHub | |
# * Runs even if previous steps fail | |
- name: Create test summary | |
uses: test-summary/action@v2 | |
with: | |
paths: "*t-report.xml" | |
show: "fail, skip" | |
if: always() | |