Merge pull request #1660 from OceanParcels/v/type-annotations #31
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: ci | |
on: | |
push: | |
branches: | |
- "master" | |
- "test-me/*" | |
pull_request: | |
schedule: | |
- cron: "0 7 * * 1" # Run every Monday at 7:00 UTC | |
concurrency: | |
group: branch-${{ github.head_ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -el {0} | |
jobs: | |
unit-test: | |
name: "py${{ matrix.python-version }} | ${{ matrix.os }} | unit tests" | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos, ubuntu, windows] | |
python-version: ["3.12"] | |
include: | |
- os: ubuntu | |
python-version: "3.10" | |
- os: ubuntu | |
python-version: "3.11" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Conda and parcels | |
uses: ./.github/actions/install-parcels | |
with: | |
environment-file: environment.yml | |
python-version: ${{ matrix.python-version }} | |
- name: Unit test | |
run: | | |
coverage run -m pytest -v -s --html=${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html --self-contained-html tests | |
coverage xml | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unit-tests | |
- name: Upload test results | |
if: ${{ always() }} # Always run this step, even if tests fail | |
uses: actions/[email protected] | |
with: | |
name: Unittest report | |
path: ${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html | |
integration-test: | |
name: "py${{ matrix.python-version }} | ${{ matrix.os }} | integration tests" | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos, ubuntu, windows] | |
python-version: ["3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Conda and parcels | |
uses: ./.github/actions/install-parcels | |
with: | |
environment-file: environment.yml | |
- name: Integration test | |
run: | | |
coverage run -m pytest -v -s --nbval-lax -k "not documentation" --html="${{ matrix.os }}_integration_test_report.html" --self-contained-html docs/examples | |
coverage xml | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: integration-tests | |
- name: Upload test results | |
if: ${{ always() }} # Always run this step, even if tests fail | |
uses: actions/[email protected] | |
with: | |
name: Integration test report | |
path: ${{ matrix.os }}_integration_test_report.html | |
typechecking: | |
name: mypy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Conda and parcels | |
uses: ./.github/actions/install-parcels | |
with: | |
environment-file: environment.yml | |
- run: conda install lxml # dep for report generation | |
- name: Typechecking | |
run: | | |
mypy --install-types --non-interactive parcels --cobertura-xml-report mypy_report | |
- name: Upload mypy coverage to Codecov | |
uses: codecov/[email protected] | |
if: ${{ always() }} # Upload even on error of mypy | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: mypy_report/cobertura.xml | |
flags: mypy | |
fail_ci_if_error: false |