Skip to content

Remove mockup data (#70) #267

Remove mockup data (#70)

Remove mockup data (#70) #267

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
# https://stackoverflow.com/a/72408109/6388696
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linting:
name: Run linting/pre-commit checks
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.13"
- run: pip install 'pre-commit<4.0.0'
- run: pre-commit --version
- run: pre-commit install
- run: pre-commit run --all-files --show-diff-on-failure
check_docs:
needs: [ linting ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#github-authentication-token
github-token: ${{ secrets.GITHUB_TOKEN }}
cache-suffix: "3.13"
- name: Install dependencies
run: uv sync --frozen
- name: Build the documentation (strict mode)
run: uv run mkdocs build --strict
unit_tests:
needs: [ linting ]
runs-on: ${{ matrix.platform }}
strategy:
max-parallel: 4
matrix:
platform: [ "ubuntu-latest", "macos-latest" ]
python-version: [ "3.13" ]
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#github-authentication-token
github-token: ${{ secrets.GITHUB_TOKEN }}
cache-suffix: ${{ matrix.python-version }}
- name: Pin python-version ${{ matrix.python-version }}
run: uv python pin ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --frozen
- name: Test with pytest
run: uv run pytest -v --cov=cluv --cov-report=xml --cov-append
- name: Store coverage report as an artifact
uses: actions/upload-artifact@v4
with:
name: coverage-reports-unit-tests-${{ matrix.platform }}-${{
matrix.python-version }}
path: ./coverage.xml
integration_tests:
needs: [ unit_tests ]
runs-on: self-hosted
# TODO: remove this once we have a decently solid setup, not too reliant on the dev machine
# having active SSH connections to the Slurm clusters.
continue-on-error: true
steps:
- uses: actions/checkout@v6
with:
# Trying to checkout the branch (not just a commit) so that the cluv command
# that do a git push work in the self-hosted CI.
fetch-tags: true
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
enable-cache: true
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#github-authentication-token
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: uv sync --frozen
- name: Run all tests
run: uv run pytest -v --slow --cov=cluv --cov-report=xml --cov-append
- name: Store coverage report as an artifact
uses: actions/upload-artifact@v4
with:
name: coverage-reports-integration-tests
path: ./coverage.xml
# https://about.codecov.io/blog/uploading-code-coverage-in-a-separate-job-on-github-actions/
upload-coverage-codecov:
needs: [ unit_tests, integration_tests ]
runs-on: ubuntu-latest
name: Upload coverage reports to Codecov
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: coverage-reports-*
merge-multiple: false
# download all the artifacts in this directory (each .coverage.xml will be in a subdirectory)
# Next step if this doesn't work would be to give the coverage files a unique name and use merge-multiple: true
path: coverage_reports
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage_reports
fail_ci_if_error: true