-
Notifications
You must be signed in to change notification settings - Fork 153
130 lines (126 loc) · 4.93 KB
/
Copy pathtest.yml
File metadata and controls
130 lines (126 loc) · 4.93 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
---
name: Test
# runs on a push on main and at the end of every day
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
# Required shell entrypoint to have properly configured bash shell
defaults:
run:
shell: bash -l {0}
jobs:
linux:
runs-on: "ubuntu-latest"
if: github.repository == 'ESMValGroup/ESMValTool' # avoid GAs in forks
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
name: Linux Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: esmvaltool
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
miniforge-version: "latest"
use-mamba: true
mamba-version: "2.0.8" # https://github.com/conda-incubator/setup-miniconda/issues/392
- run: mkdir -p test_linux_artifacts_python_${{ matrix.python-version }}
- name: Record versions
run: |
mamba --version 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
python -V 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
# this is how to export variables to the GITHUB var environment
echo "pver0=$(python -V)" >> $GITHUB_ENV
- name: Inspect environment
run: conda list
- name: Install ESMValTool
run: pip install -e .[develop] 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- name: Inspect environment
run: conda list
- name: Install Julia from source
run: curl -fsSL https://install.julialang.org | sh -s -- --yes
- name: Install Julia dependencies
run: esmvaltool install Julia
- name: Export Python minor version
run: echo "pver1=$(python -V)" >> $GITHUB_ENV
- name: Exit if Python minor version changed
if: ${{ env.pver1 != env.pver0}}
run: |
echo "Python minor version changed after Julia install"
python -V
exit 1
- name: Inspect environment
run: conda list
- name: Check Julia and NCL
run: |
ncl -V
julia --version
- name: Check code quality
run: pre-commit run -a
- name: Run tests
run: pytest -n 2 -m "not installation" 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v4
with:
name: Test_Linux_python_${{ matrix.python-version }}
path: test_linux_artifacts_python_${{ matrix.python-version }}
osx:
runs-on: "macos-latest"
if: github.repository == 'ESMValGroup/ESMValTool' # avoid GAs in forks
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
architecture: ["x64"] # need to force Intel, arm64 builds have issues
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
architecture: ${{ matrix.architecture }}
activate-environment: esmvaltool
environment-file: environment_osx.yml
python-version: ${{ matrix.python-version }}
miniforge-version: "latest"
use-mamba: true
mamba-version: "2.0.5" # https://github.com/conda-incubator/setup-miniconda/issues/392
# - name: Install libomp with homebrew
# run: brew install libomp
- run: mkdir -p test_osx_artifacts_python_${{ matrix.python-version }}
- name: Record versions
run: |
mamba --version 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
python -V 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
- name: Inspect environment
run: conda list
- name: Determine if git
run: |
which git
git --version
- name: Install git
run: mamba install -c conda-forge git
- name: Install ESMValTool
run: pip install -e .[develop] 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/install.txt
- name: Inspect environment
run: conda list
- name: Check code quality
run: pre-commit run -a
- name: Run tests
run: pytest -n 2 -m "not installation" 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v4
with:
name: Test_OSX_python_${{ matrix.python-version }}
path: test_osx_artifacts_python_${{ matrix.python-version }}