-
Notifications
You must be signed in to change notification settings - Fork 13
140 lines (125 loc) · 5.25 KB
/
test.yml
File metadata and controls
140 lines (125 loc) · 5.25 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
132
133
134
135
136
137
138
139
140
on:
workflow_call:
inputs:
source_ref:
description: The Git ref to checkout
type: string
required: true
firedrake_docker_version:
description: The Firedrake Docker version to use ('dev-main' or 'dev-release')
type: string
required: true
# Cancel jobs running if new commits are pushed
concurrency:
group: >
${{ github.workflow }}-
${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test Gusto
runs-on: [self-hosted, Linux]
container:
image: firedrakeproject/firedrake-vanilla-default:${{ inputs.firedrake_docker_version }}
env:
# Make Gusto output logging information, this will *not* be printed to
# the terminal because pytest will capture it. Instead it is written to
# the file specified by '--log-file'.
GUSTO_PARALLEL_LOG: CONSOLE
PYOP2_CFLAGS: -O0
# Make sure that tests with >4 processes are not silently skipped
PYTEST_MPI_MAX_NPROCS: 4
EXTRA_PYTEST_ARGS: --durations=100 --timeout=3600 --timeout-method=thread -o faulthandler_timeout=3660 --show-capture=no --verbose gusto-repo/unit-tests gusto-repo/integration-tests gusto-repo/examples
steps:
- name: Fix HOME
# For unknown reasons GitHub actions overwrite HOME to /github/home
# which will break everything unless fixed
# (https://github.com/actions/runner/issues/863)
run: echo "HOME=/root" >> "$GITHUB_ENV"
- name: Pre-cleanup
run: |
: # Wipe everything away in the current directory
find . -delete
firedrake-clean
- uses: actions/checkout@v5
with:
# Download Gusto into a subdirectory not called 'gusto' to make sure
# that the package installs correctly. Otherwise 'import gusto' may
# work even if the installation failed because it is a subdirectory.
ref: ${{ inputs.source_ref }}
path: gusto-repo
- name: Create virtual environment
# pass '--system-site-packages' so Firedrake can be found
run: python3 -m venv --system-site-packages venv-gusto
- name: Install Gusto
id: install-one
run: |
. venv-gusto/bin/activate
pip install ./gusto-repo
pip list
- name: Test serial-only netCDF
run: |
. venv-gusto/bin/activate
: # Run the serial tests
firedrake-run-split-tests 1 1 -n 12 --verbose gusto-repo/integration-tests/model/test_nc_outputting.py --log-file=gusto_netcdf_serial.log --show-capture=no
: # Run the parallel tests
firedrake-run-split-tests 2 6 --verbose gusto-repo/integration-tests/model/test_nc_outputting.py --log-file=gusto_netcdf_parallel.log --show-capture=no
timeout-minutes: 10
- name: Install parallel netCDF
# Run even if the step above failed
if: success() || steps.install-one.conclusion == 'success'
id: install-two
run: |
. venv-gusto/bin/activate
pip uninstall -y netCDF4
: # '--no-build-isolation' has to be passed for mpi4py to be found
: # but this means that we need to install any extra build
: # dependencies manually
pip install Cython 'setuptools>80'
pip install --no-binary netCDF4 --no-build-isolation netCDF4
- name: Run tests (nprocs = 1)
# Run even if earlier tests failed
if: success() || steps.install-two.conclusion == 'success'
run: |
. venv-gusto/bin/activate
: # Use pytest-xdist here so we can have a single collated output (not possible
: # for parallel tests)
firedrake-run-split-tests 1 1 -n 12 --dist worksteal "$EXTRA_PYTEST_ARGS" --log-file=gusto1.log
timeout-minutes: 60
- name: Run tests (nprocs = 2)
if: success() || steps.install-two.conclusion == 'success'
run: |
. venv-gusto/bin/activate
firedrake-run-split-tests 2 6 "$EXTRA_PYTEST_ARGS" "--log-file=gusto2_{#}.log"
timeout-minutes: 30
- name: Run tests (nprocs = 3)
if: success() || steps.install-two.conclusion == 'success'
run: |
. venv-gusto/bin/activate
firedrake-run-split-tests 3 4 "$EXTRA_PYTEST_ARGS" "--log-file=gusto3_{#}.log"
timeout-minutes: 10
- name: Run tests (nprocs = 4)
if: success() || steps.install-two.conclusion == 'success'
run: |
. venv-gusto/bin/activate
firedrake-run-split-tests 4 3 "$EXTRA_PYTEST_ARGS" "--log-file=gusto4_{#}.log"
timeout-minutes: 10
- name: Upload pytest log files
uses: actions/upload-artifact@v4
if: success() || steps.install-two.conclusion == 'success'
with:
name: pytest-logs-${{ inputs.firedrake_docker_version }}
path: pytest_*.log
retention-days: 5
- name: Upload Gusto log files
uses: actions/upload-artifact@v4
if: success() || steps.install-two.conclusion == 'success'
with:
name: gusto-logs-${{ inputs.firedrake_docker_version }}
path: gusto*.log
retention-days: 5
- name: Post-cleanup
if: always()
run: |
find . -delete
firedrake-clean