-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (109 loc) · 3.72 KB
/
CI.yml
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
# Run CI tests
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: main
pull_request:
branches: main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
PY_VERSION: "3.11"
jobs:
# JOB to run change in the build files
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
files: ${{ steps.filter.outputs.files }}
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Filter files
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3.0.2
id: filter
with:
filters: |
files:
- 'setup.py'
- 'pyproject.toml'
- '.conda/env_build.yml'
- '.conda/meta.yml'
verify-conda-build:
name: Conda Build
runs-on: ubuntu-latest
needs: changes
# Only run if there are changes in the build files
if: ${{ needs.changes.outputs.files == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Setup conda build environment
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniconda-version: "latest"
python-version: ${{ env.PY_VERSION }}
environment-file: .conda/env_build.yml
auto-activate-base: false
auto-update-conda: false
show-channel-urls: true
- name: Verify conda recipe
shell: bash -el {0}
run: conda-verify .conda --ignore C2105,C2122
- name: Run conda build
shell: bash -el {0}
run: conda build . --no-anaconda-upload --output-folder=./build -c conda-forge -c accessnri -c coecms
- name: Verify conda package
shell: bash -el {0}
run: conda-verify ./build/noarch/*.tar.bz2 --ignore C1105,C1115,C1141
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12"]
env:
ARTIFACT_LOCATION: ${{ github.workspace }}/conda-local
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Setup conda environment
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
environment-file: .conda/env_dev.yml
activate-environment: um2nc-dev
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Install source
shell: bash -l {0}
run: python3 -m pip install --no-deps --no-build-isolation -e .
- name: List installed packages
shell: bash -l {0}
run: conda list
- name: Lint
shell: bash -l {0}
run: pylint --extension-pkg-whitelist=netCDF4 --ignored-modules=umpost -E umpost
- name: Entrypoint test of driver script
shell: bash -l {0}
run: esm1p5_convert_nc --help
- name: Entrypoint test of um2netcdf script
shell: bash -l {0}
run: um2nc --help
- name: Run tests
shell: bash -l {0}
run: python -m pytest --cov=umpost --cov-report=xml -s test
- name: Upload code coverage
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 #v4.6.0
# Only upload once for the installed version
if: matrix.python-version == ${{ env.PY_VERSION }}
with:
token: ${{ secrets.codecov_token }}
files: ./coverage.xml