-
Notifications
You must be signed in to change notification settings - Fork 56
151 lines (137 loc) · 4.52 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: CI
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 0 * * *' # Daily “At 00:00”
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
# if: |
# github.repository == 'NCAR/geocat-comp'
name: Python (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: checkout
uses: actions/checkout@v4
- name: set environment variables
run: |
echo "TODAY=$(date +%Y-%m-%d)" >> $GITHUB_ENV
- name: environment setup
id: env-setup
continue-on-error: true
uses: mamba-org/setup-micromamba@v2
with:
environment-file: build_envs/environment.yml
cache-environment: true
cache-environment-key: "CI ${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}"
create-args: >-
python=${{matrix.python-version}}
- name: retry environment set up if failed
if: steps.env-setup.outcome == 'failure'
uses: mamba-org/setup-micromamba@v2
with:
download-micromamba: false
environment-file: build_envs/environment.yml
cache-environment: true
cache-environment-key: "CI ${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}"
create-args: >-
python=${{matrix.python-version}}
- name: Install geocat-comp
run: |
python -m pip install --no-deps -e .
- name: Run Tests (non-windows)
if: matrix.os != 'windows-latest'
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
max_attempts: 3
command: |
eval "$(micromamba shell hook --shell bash)"
micromamba activate
micromamba activate geocat_comp_build
python -m pytest test -v --cov=./geocat/comp --cov-report=xml --junitxml=pytest.xml
- name: Run Tests (windows)
if: matrix.os == 'windows-latest'
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
max_attempts: 3
command: |
micromamba.exe shell hook -s powershell | Out-String | Invoke-Expression
micromamba activate
micromamba activate geocat_comp_build
python -m pytest test -v --cov=./geocat/comp --cov-report=xml --junitxml=pytest.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: Test results for ${{ runner.os }}-${{ matrix.python-version }}
path: pytest.xml
- name: Upload code coverage to Codecov
if: github.repository == 'NCAR/geocat-comp'
uses: codecov/codecov-action@v5.1.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.xml
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
link-check:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: checkout
uses: actions/checkout@v4
- name: environment setup
id: link-env-setup
continue-on-error: true
uses: mamba-org/setup-micromamba@v2
with:
environment-file: build_envs/docs.yml
cache-environment: true
cache-environment-key: "linkcheck-${{env.TODAY}}"
create-args: >-
python=3.11
- name: retry environment set up if failed
if: steps.link-env-setup.outcome == 'failure'
uses: mamba-org/setup-micromamba@v2
with:
download-micromamba: false
environment-file: build_envs/docs.yml
cache-environment: true
cache-environment-key: "linkcheck-${{env.TODAY}}"
create-args: >-
python=3.11
- name: Install geocat-comp
run: |
python -m pip install .
- name: check conda list
run: |
conda list
- name: Make docs with linkcheck
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
max_attempts: 3
command: |
eval "$(micromamba shell hook --shell bash)"
micromamba activate
micromamba activate gc-docs
cd docs
make linkcheck