forked from SciTools/ncdata
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (79 loc) · 2.56 KB
/
ci-tests.yml
File metadata and controls
93 lines (79 loc) · 2.56 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
# A workflow to do PR test runs
#
# Reference:
# - https://github.com/actions/checkout
# - https://github.com/conda-incubator/setup-miniconda
name: ci-tests
# Triggers the workflow on pull-request or push events
on:
push:
branches:
- "main"
- "v*x"
tags:
- "v*"
pull_request:
branches:
- "*"
workflow_dispatch:
jobs:
tests:
name: "Test Python ${{ matrix.version }} session= ${{ matrix.session }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
session: ["tests", "doctests-docs", "doctests-api"]
defaults:
run:
shell: bash -l {0}
env:
IRIS_TEST_DATA_VERSION: "2.20"
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: "Create conda environment"
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: testenv
python-version: ${{ matrix.version }}
channels: conda-forge
show-channel-urls: true
- name: "Install dependencies"
run: |
conda install --yes numpy pytest pytest-mock iris xarray filelock requests zarr aiohttp
- name: "Install *latest* Iris"
run: |
git clone https://github.com/SciTools/iris.git ./iris
cd iris
pip install -e .
cd ..
- name: "Install repo-under-test"
run: |
python -m pip install --no-deps --editable .
- name: "Conda info"
run: |
conda info
conda list --explicit
- name: "Fetch Iris-test-data"
run: |
wget --quiet https://github.com/SciTools/iris-test-data/archive/v${IRIS_TEST_DATA_VERSION}.zip -O iris-test-data.zip
unzip -q iris-test-data.zip
mkdir --parents ${GITHUB_WORKSPACE}/iris_test_data
mv iris-test-data-${IRIS_TEST_DATA_VERSION} ${GITHUB_WORKSPACE}/iris_test_data_download
- name: "Run tests"
if: matrix.session == 'tests'
run: |
ls ${GITHUB_WORKSPACE}/iris_test_data_download/test_data
OVERRIDE_TEST_DATA_REPOSITORY=${GITHUB_WORKSPACE}/iris_test_data_download/test_data PYTHONPATH=./tests:$PYTHONPATH pytest -v ./tests
- name: "Run doctests: Docs"
if: matrix.session == 'doctests-docs'
run: |
cd docs
pytest --doctest-glob="*.rst"
- name: "Run doctests: API"
if: matrix.session == 'doctests-api'
run: |
cd lib
pytest --doctest-modules