CeRAS notebook neede an update: #251
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: Tests | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') }} | |
strategy: | |
matrix: | |
python-version: [ "3.9", "3.10", "3.12" ] | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
# Exceptions: | |
# - Python 3.8 and 3.9 is on macos-13 but not macos-latest (macos-14-arm64) | |
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760 | |
exclude: | |
- { python-version: "3.9", os: "macos-latest" } | |
include: | |
- { python-version: "3.9", os: "macos-13" } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry==${{ vars.POETRY_VERSION }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
- name: Activate environment and install dependencies | |
run: | | |
poetry env use ${{ matrix.python-version }} | |
poetry install | |
- name: Check with Ruff | |
run: | | |
poetry run ruff check . # Check coding rules | |
poetry run ruff format --check . # Check format | |
shell: bash | |
- name: Unit tests without coverage | |
# Runners that won't send coverage report are run without coverage overhead | |
if: ${{ runner.os == 'macOS' || matrix.python-version != '3.10' }} | |
run: poetry run pytest src | |
shell: bash | |
- name: Unit tests with coverage | |
# Only for runner that will send coverage reports (see below) | |
if: ${{ runner.os != 'macOS' && matrix.python-version == '3.10' }} | |
run: | | |
poetry run pytest src --cov | |
poetry run coverage xml # for sending coverage report | |
shell: bash | |
- name: Run codacy-coverage-reporter | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
if: ${{ runner.os == 'Linux' && matrix.python-version == '3.10' }} # This action runs only on Linux | |
with: | |
project-token: ${{ secrets.codacy }} | |
coverage-reports: coverage.xml | |
- name: Publish code coverage on Codecov | |
uses: codecov/codecov-action@v4 | |
if: ${{ runner.os == 'Windows' && matrix.python-version == '3.10' }} # Using Windows for covering XFOIL calls | |
with: | |
# flags: unittests # optional | |
name: codecov-FAST-OAD-CS25 # optional | |
fail_ci_if_error: false # optional (default = false) | |
env: | |
CODECOV_TOKEN: 96682349-afc0-4b88-8ab5-5aa10d8d0d84 | |
- name: Integration tests | |
run: poetry run pytest --no-cov tests/integration_tests | |
shell: bash | |
- name: Notebook tests | |
if: ${{ github.event_name == 'pull_request' || contains(github.event.head_commit.message, '[test nb]') || github.ref == 'refs/heads/main' }} | |
run: poetry run pytest --no-cov --nbval-lax -p no:python src/fastoad_cs25/notebooks | |
shell: bash |