-
Notifications
You must be signed in to change notification settings - Fork 37
148 lines (120 loc) · 4.17 KB
/
ci-tests.yml
File metadata and controls
148 lines (120 loc) · 4.17 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
141
142
143
144
145
146
147
148
# Reference:
# - https://github.com/actions/checkout
# - https://github.com/actions/download-artifact
# - https://github.com/actions/setup-python
# - https://github.com/actions/upload-artifact
# - https://github.com/codecov/codecov-action
# - https://github.com/prefix-dev/setup-pixi
# - https://github.com/pyvista/setup-headless-display-action
name: ci-tests
on:
pull_request:
push:
branches:
- "main"
- "v*x"
- "!pixi-auto-update"
- "!pre-commit-ci-update-config"
- "!dependabot/*"
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
permissions: {}
jobs:
tests:
name: "${{ matrix.session }} ${{ matrix.marker }} (${{ matrix.version }})"
runs-on: "${{ matrix.os }}"
env:
ALLOW_PLOTTING: true
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04"]
version: ["py312", "py313"]
session: ["tests"]
marker: ["image", "not image"]
include:
- version: "py313"
coverage: "--cov-report= --cov=geovista"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: "environment configure"
env:
# Maximum cache period (in weeks) before forcing a cache refresh.
CACHE_WEEKS: 2
run: |
echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV}
- uses: pyvista/setup-headless-display-action@5bc8de3bc71fcda7a96439571287a554901541a0
- name: "setup pixi"
uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0
with:
environments: "test-${{ matrix.version }}"
frozen: true
activate-environment: true
- name: "cartopy cache"
uses: ./.github/workflows/composite/cartopy-cache
with:
cache_period: ${{ env.CACHE_PERIOD }}
- name: "geovista cache"
uses: ./.github/workflows/composite/geovista-cache
with:
cache_period: ${{ env.CACHE_PERIOD }}
- name: "${{ matrix.session }} ${{ matrix.marker }} (${{ matrix.version }})"
env:
PY_COLORS: "1"
run: |
geovista --report
xvfb-run -a pixi run --frozen pytest -m "${{ matrix.marker }}" --failed_image_dir test_images_failed ${{ matrix.coverage }}
- name: "upload failed images"
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: ci-tests-failed-images-${{ github.job }}-${{ strategy.job-index }}
path: ${{ github.workspace }}/test_images_failed
- name: "prepare coverage"
if: ${{ matrix.coverage }}
env:
COVERAGE_FILE: ci-test-coverage${{ strategy.job-index }}
run: |
mv .coverage ${COVERAGE_FILE}
- if: ${{ matrix.coverage }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-artifacts-${{ github.job }}-${{ strategy.job-index }}
path: ${{ github.workspace }}/ci-test-coverage*
coverage:
needs: [tests]
name: "upload coverage"
runs-on: "ubuntu-latest"
environment: development
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: "3.x"
- run: |
python -m pip install --upgrade pip
pip install coverage
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
pattern: coverage-artifacts-*
merge-multiple: true
- name: "create coverage report"
run: |
coverage combine ci-test-coverage*
coverage xml --omit=*/_version.py
- name: "upload coverage report"
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2
with:
token: ${{ secrets.CODECOV_TOKEN }}