-
Notifications
You must be signed in to change notification settings - Fork 171
131 lines (128 loc) · 4.67 KB
/
ci.yml
File metadata and controls
131 lines (128 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: ci
on:
push:
branches:
- "main"
- "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 (${{ matrix.test-subfolder }})"
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu] #, mac, windows] # TODO v4: Re-enable windows and mac
test-subfolder: ["/"]
python-version: ["3.12"]
include:
- os: ubuntu
python-version: "3.11"
test-subfolder: "/"
- os: ubuntu
python-version: "3.12"
test-subfolder: "/v4"
steps:
- name: Checkout
uses: actions/checkout@v4
- 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${{ matrix.test-subfolder }}
coverage xml
- name: Codecov
uses: codecov/codecov-action@v5.3.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: unit-tests
- name: Upload test results
if: ${{ always() }} # Always run this step, even if tests fail
uses: actions/upload-artifact@v4
with:
name: Unittest report ${{ matrix.os }}-${{ matrix.python-version }}
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: [ubuntu] #, mac, windows] # TODO v4: Re-enable windows and mac
python-version: ["3.12"]
include:
- os: ubuntu
python-version: "3.11"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Conda and parcels
uses: ./.github/actions/install-parcels
with:
environment-file: environment.yml
- name: Integration test
# TODO v4: Re-enable `tutorial_periodic_boundaries`
# TODO v4: Re-enable `tutorial_timevaryingdepthdimensions`
# TODO v4: Re-enable `tutorial_particle_field_interaction`
# TODO v4: Re-enable `tutorial_croco_3D`
# TODO v4: Re-enable `tutorial_nemo_3D` (https://github.com/OceanParcels/Parcels/pull/1936#issuecomment-2717666705)
# TODO v4: Re-enable `tutorial_analyticaladvection`
run: |
coverage run -m pytest -v -s --nbval-lax -k "not documentation and not tutorial_periodic_boundaries and not tutorial_timevaryingdepthdimensions and not tutorial_particle_field_interaction and not tutorial_croco_3D and not tutorial_nemo_3D and not tutorial_analyticaladvection" --html="${{ matrix.os }}_${{ matrix.python-version }}_integration_test_report.html" --self-contained-html docs/examples
coverage xml
- name: Codecov
uses: codecov/codecov-action@v5.3.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: integration-tests
- name: Upload test results
if: ${{ always() }} # Always run this step, even if tests fail
uses: actions/upload-artifact@v4
with:
name: Integration test report ${{ matrix.os }}-${{ matrix.python-version }}
path: ${{ matrix.os }}_${{ matrix.python-version }}_integration_test_report.html
merge-test-artifacts:
runs-on: ubuntu-latest
needs:
- unit-test
- integration-test
- typechecking
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: Testing reports
pattern: "* report *"
typechecking:
name: mypy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 --html-report mypy-report
- name: Upload test results
if: ${{ always() }} # Upload even on mypy error
uses: actions/upload-artifact@v4
with:
name: Mypy report
path: mypy-report