-
Notifications
You must be signed in to change notification settings - Fork 113
153 lines (122 loc) · 4.25 KB
/
pytest.yaml
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
152
153
name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "0 5 * * *"
# Cancel previous runs that have not completed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
depth: 100
jobs:
pytest:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
python-version:
- "3.8" # Earliest version supported by ixmp
- "3.9"
- "3.10"
- "3.11" # Latest supported by ixmp
# commented: force a specific version of pandas, for e.g. pre-release
# testing
# pandas-version:
# - ""
# - "==2.0.0rc0"
exclude: [ ]
# # Specific version combinations that are invalid, e.g. pandas 2.0
# # requires Python >= 3.8
# - python-version: "3.7"
# pandas-version: "==2.0.0rc0"
fail-fast: false
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}-py${{ matrix.python-version }}
# commented: use with "pandas-version" in the matrix, above
# name: ${{ matrix.os }}-py${{ matrix.python-version }}-pandas${{ matrix.pandas-version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: ${{ env.depth }}
- name: Fetch tags (for setuptools-scm)
run: git fetch --tags --depth=${{ env.depth }}
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: "**/pyproject.toml"
- uses: ts-graphviz/[email protected]
with:
macos-skip-brew-update: true
- uses: r-lib/actions/setup-r@v2
id: setup-r
with:
r-version: '4.2.3'
- name: Cache GAMS installer and R packages
uses: actions/cache@v3
with:
path: |
gams
${{ env.R_LIBS_USER }}
key: ${{ matrix.os }}-R${{ steps.setup-r.outputs.installed-r-version }}
restore-keys: |
${{ matrix.os }}-
- uses: iiasa/actions/setup-gams@main
with:
version: 25.1.1
- name: Set RETICULATE_PYTHON
# Use the environment variable set by the setup-python action, above.
run: echo "RETICULATE_PYTHON=$pythonLocation" >> $GITHUB_ENV
shell: bash
- name: Install Python package and dependencies
# [docs] contains [tests], which contains [report,tutorial]
run: |
# Work around https://bugs.launchpad.net/lxml/+bug/2035206
pip install "lxml != 4.9.3"
pip install .[docs]
# commented: use with "pandas-version" in the matrix, above
# pip install --upgrade pandas${{ matrix.pandas-version }}
- name: TEMPORARY Work around iiasa/ixmp#463
if: matrix.python-version != '3.11'
run: pip install "JPype1 != 1.4.1"
- name: Install R dependencies and tutorial requirements
run: |
install.packages(c("remotes", "Rcpp"))
remotes::install_cran(
c("IRkernel", "reticulate"),
dependencies = TRUE,
# force = TRUE,
)
IRkernel::installspec()
# commented: for debugging
# print(reticulate::py_config())
# reticulate::py_run_string("import os; print(os.environ)")
shell: Rscript {0}
- name: Run test suite using pytest
run: pytest ixmp -m "not performance" --verbose -rA --cov-report=xml --color=yes
- name: Test documentation build using Sphinx
env:
# For pull_request triggers, GitHub creates a temporary merge commit
# with a hash that does not match the head of the branch. Tell it which
# branch to use.
SPHINXOPTS: -D linkcode_github_remote_head=${{ github.head_ref }}
run: make --directory=doc html
- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v3
pre-commit:
name: Code quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Force recreation of pre-commit virtual environment for mypy
if: github.event_name == 'schedule'
run: gh cache list -L 999 | cut -f2 | grep pre-commit | xargs -I{} gh cache delete "{}" || true
env: { GH_TOKEN: "${{ github.token }}" }
- uses: pre-commit/[email protected]