WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 208ae8e

Browse files
committed
update testing
1 parent 13d41b3 commit 208ae8e

File tree

1 file changed

+55
-24
lines changed

1 file changed

+55
-24
lines changed

.github/workflows/tests.yml

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ name: Testing
22

33
on:
44
push:
5-
branches:
6-
- '*'
5+
branches: ['*']
76
pull_request:
8-
branches:
9-
- '*'
7+
branches: ['*']
8+
109
jobs:
1110
setup-build:
1211
name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
@@ -19,25 +18,57 @@ jobs:
1918
matrix:
2019
os: ["ubuntu-latest"]
2120
python-version: ["3.10"]
22-
test_file: ["tests/test_dcip.py", "tests/test_em.py", "tests/test_gpr.py", "tests/test_mag.py", "tests/test_seismic.py"]
21+
test_file: [
22+
"tests/test_dcip.py",
23+
"tests/test_em.py",
24+
"tests/test_gpr.py tests/test_seismic.py",
25+
"tests/test_inversion.py",
26+
"tests/test_gravity.py tests/test_mag.py"
27+
]
28+
env:
29+
PYTEST_DISABLE_PLUGIN_AUTOLOAD: "1"
30+
MPLBACKEND: Agg # avoid GUI backends import cost
2331

2432
steps:
25-
- uses: actions/checkout@v2
26-
- name: Setup Conda
27-
uses: conda-incubator/setup-miniconda@v2
28-
with:
29-
auto-update-conda: true
30-
activate-environment: geosci-labs
31-
channels: conda-forge
32-
environment-file: environment.yml
33-
python-version: ${{ matrix.python-version }}
34-
- name: Install Env
35-
run: |
36-
conda info
37-
conda config --show
38-
conda install -y pytest
39-
pip install testipynb
40-
conda list
41-
- name: Run Tests
42-
run: |
43-
pytest -v ${{ matrix.test_file }}
33+
- uses: actions/checkout@v4
34+
35+
# Use Miniforge3 (not "latest" to avoid 404s) + mamba, strict conda-forge
36+
- name: Setup Conda (Miniforge3 + mamba)
37+
uses: conda-incubator/setup-miniconda@v3
38+
with:
39+
miniforge-variant: Miniforge3
40+
miniforge-version: "24.11.0-0" # pin to avoid 'latest' asset 404s
41+
python-version: ${{ matrix.python-version }}
42+
activate-environment: geosci-labs
43+
environment-file: environment.yml
44+
use-mamba: true
45+
auto-update-conda: false
46+
auto-activate-base: false
47+
channels: conda-forge
48+
channel-priority: strict
49+
condarc: |
50+
channels:
51+
- conda-forge
52+
channel_priority: strict
53+
54+
- name: Show environment info
55+
run: |
56+
conda info
57+
conda list
58+
59+
- name: Install geosci-labs
60+
run: |
61+
pip install -e .
62+
63+
- name: Install test dependencies (pytest + testipynb)
64+
run: |
65+
n=0
66+
until [ $n -ge 3 ]; do
67+
mamba install -y pytest && pip install -U testipynb && break
68+
n=$((n+1))
69+
echo "Retry $n/3 after transient fetch error..."
70+
sleep 10
71+
done
72+
73+
- name: Run tests
74+
run: pytest -v ${{ matrix.test_file }}

0 commit comments

Comments
 (0)