Repository navigation
80 lines (69 loc) · 2.35 KB
/
Copy pathpython-tests.yml
File metadata and controls
80 lines (69 loc) · 2.35 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
name: Run Python tests
on:
push:
# Run when a change to these files is pushed to any branch. Without the "branches:" line, for some reason this will be run whenever a tag is pushed, even if the listed files aren't changed.
branches: ['*']
paths:
- 'python/**'
- 'cime_config/SystemTests/**'
- 'cime_config/buildlib/**'
- 'cime_config/buildnml/**'
pull_request:
# Run on pull requests that change the listed files
paths:
- 'python/**'
- 'cime_config/SystemTests/**'
- 'cime_config/buildlib/**'
- 'cime_config/buildnml/**'
jobs:
python-unit-tests:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
lfs: true
# Check out cime because some unit tests import it
- name: Checkout cime submodule
run: |
bin/git-fleximod update cime
# Set up the conda environment
- uses: conda-incubator/setup-miniconda@2defc80cc6f4028b1780c50faf08dd505d698976 # v3
with:
activate-environment: ctsm_pylib
environment-file: python/conda_env_ctsm_py.yml
channels: conda-forge
auto-activate-base: false
- name: Print installed Python packages
run: conda list
# Run Python unit tests check
- name: Run Python unit tests
run: |
cd python
conda run -n ctsm_pylib ./run_ctsm_py_tests -u
python-lint-and-black:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# Set up the conda environment
- uses: conda-incubator/setup-miniconda@2defc80cc6f4028b1780c50faf08dd505d698976 # v3
with:
activate-environment: ctsm_pylib
environment-file: python/conda_env_ctsm_py.yml
channels: conda-forge
auto-activate-base: false
- name: Print installed Python packages
run: conda list
# Run pylint check
- name: Run pylint
run: |
cd python
conda run -n ctsm_pylib make lint
# Run black check
- name: Run black
# Run this step even if previous step(s) failed
if: success() || failure()
run: |
cd python
conda run -n ctsm_pylib make black