-
Notifications
You must be signed in to change notification settings - Fork 7
201 lines (174 loc) · 6.43 KB
/
linux.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: linux
# Only build PRs, the main branch, and releases.
on:
pull_request:
push:
branches:
- main
release:
types:
- published
schedule:
- cron: "14 14 20 * *"
# Use bash by default in all jobs
defaults:
run:
# Using "-l {0}" is necessary for conda environments to be activated
# But this breaks on MacOS if using actions/setup-python:
# https://github.com/actions/setup-python/issues/132
shell: bash
# Cancel any previous run of the test job.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: ${{ matrix.case.os }} py${{ matrix.case.python-version }} ${{ matrix.case.name }}
runs-on: ${{ matrix.case.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, ] # macos, windows] # Only Linux currently.
case:
- python-version: "3.10"
name: minimal
os: ubuntu
conda: "'scipy=1.10' numba 'empymod>=2.3.2'"
- python-version: "3.11"
name: plain
os: ubuntu
conda: "scipy numba 'empymod>=2.3.2'"
- python-version: "3.11"
name: full
os: ubuntu
conda: "scipy numba 'empymod>=2.3.2' xarray tqdm h5py discretize matplotlib 'simpeg>=0.22.1'"
- python-version: "3.12"
name: plain
os: ubuntu
conda: "scipy numba 'empymod>=2.3.2'"
- python-version: "3.12"
name: full
os: ubuntu
conda: "scipy numba 'empymod>=2.3.2' xarray tqdm h5py discretize matplotlib"
env:
# Used for coveralls flag
OS: ${{ matrix.case.os }}
PYTHON: ${{ matrix.case.python-version }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v4
with:
# Need to fetch more than the last commit so that setuptools-scm can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version still be wrong.
# Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false
# Need the tags so that setuptools-scm can form a valid version number
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.case.python-version }}
miniforge-version: "latest"
- name: Install dependencies
shell: bash -l {0}
run: |
conda config --set always_yes yes --set changeps1 no
conda config --show-sources
conda config --show
conda info -a
conda install ${{ matrix.case.conda }} pytest pytest-cov pytest-console-scripts coveralls flake8 flake8-pyproject setuptools-scm
- name: Conda list
shell: bash -l {0}
run: conda list
- name: Flake8
shell: bash -l {0}
run: flake8 docs/ emg3d/ tests/
- name: Test with pytest
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
make install
pytest --cov=emg3d
- name: Coveralls
# [pin @develop@20230609]
uses: AndreMiras/coveralls-python-action@65c1672f0b8a201702d86c81b79187df74072505
with:
parallel: true
flag-name: ${{ matrix.case.python-version }} ${{ matrix.case.name }} (${{ matrix.case.os }})
coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
# [pin @develop@20230609]
uses: AndreMiras/coveralls-python-action@65c1672f0b8a201702d86c81b79187df74072505
with:
parallel-finished: true
deploy:
needs: test
name: Deploy to PyPI
runs-on: ubuntu-latest
# Only from the origin repository, not forks; only main and tags.
if: github.repository_owner == 'emsig' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v4
with:
# Need to fetch more than the last commit so that setuptools-scm can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version will still be
# wrong. Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false
# Need the tags so that setuptools-scm can form a valid version number
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build setuptools-scm
- name: Build source and wheel distributions
if: github.ref == 'refs/heads/main'
run: |
# Change setuptools-scm local_scheme to "no-local-version" so the
# local part of the version isn't included, making the version string
# compatible with Test PyPI.
sed --in-place 's/version_file/local_scheme = "no-local-version"\nversion_file/g' pyproject.toml
- name: Build source and wheel distributions
run: |
# Build source and wheel packages
python -m build
echo ""
echo "Generated files:"
ls -lh dist/
- name: Publish to Test PyPI
if: success()
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository-url: https://test.pypi.org/legacy/
# Allow existing releases on test PyPI without errors.
# NOT TO BE USED in PyPI!
skip-existing: true
- name: Publish to PyPI
# Only for releases
if: success() && github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}