Skip to content

Updated Codacy badge. #2112

Updated Codacy badge.

Updated Codacy badge. #2112

Workflow file for this run

name: Tests
on:
workflow_dispatch:
workflow_call:
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.8", "3.9", "3.10" ]
os: [ ubuntu-20.04, windows-latest, macos-latest ] # On 2023/07/04, pytest completely stalls on ubuntu-latest, except with Python 3.10
steps:
- uses: actions/checkout@v3
- uses: mpi4py/setup-mpi@v1
- name: Install poetry
run: pipx install poetry==${{ vars.POETRY_VERSION }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Activate environment and install dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install -E mpi4py
- name: Check with Black
run: |
# Fails if Black format is not respected
poetry run black --check .
shell: bash
- name: Unit tests
run: |
poetry run pytest src
poetry run coverage xml # for sending coverage report
shell: bash
- name: Run codacy coverage reporter
if: ${{ runner.os == 'Linux' && matrix.python-version == '3.9' }} # This action runs only on Linux
env:
CODACY_PROJECT_TOKEN: ${{ secrets.codacy }}
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml
shell: bash
- name: Publish code coverage on Codecov
uses: codecov/codecov-action@v3
if: ${{ runner.os == 'Windows' && matrix.python-version == '3.9' }} # Using Windows for covering XFOIL calls
with:
# flags: unittests # optional
name: codecov-FAST-OAD # optional
fail_ci_if_error: false # optional (default = false)
- name: Publish code coverage on Code Climate
uses: paambaati/[email protected]
if: ${{ runner.os == 'Linux' && matrix.python-version == '3.9' }} # This action runs only on Linux
env:
CC_TEST_REPORTER_ID: ${{ secrets.codeclimate }}
- name: Integration tests
run: poetry run pytest --no-cov tests/integration_tests
shell: bash
- name: Memory tests
run: poetry run pytest --no-cov tests/memory_tests
shell: bash
# There is a problem with notebook tests in MPI environment
- name: Deactivate MPI
run: poetry run pip uninstall mpi4py --yes
shell: bash
- name: Notebook tests
# if: ${{ github.event_name == 'pull_request' || contains(github.event.head_commit.message, '[test nb]') || github.ref == 'refs/heads/master' }}
run: poetry run pytest --no-cov --nbval-lax -p no:python src/fastoad/notebooks
shell: bash