Skip to content

Commit c2cc452

Browse files
authored
Merge pull request #609 from effigies/mnt/git-archive-support
MNT: Add git-archive support for setuptools_scm
2 parents 4f2ca46 + 890f5de commit c2cc452

File tree

4 files changed

+112
-23
lines changed

4 files changed

+112
-23
lines changed

.git_archival.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
4+
ref-names: $Format:%D$

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git_archival.txt export-subst

.github/workflows/testpydra.yml

Lines changed: 95 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,62 @@ on:
66
- master
77
pull_request:
88

9-
109
defaults:
1110
run:
1211
shell: bash
1312

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
19+
20+
1421
jobs:
1522
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
28+
- uses: actions/setup-python@v4
29+
with:
30+
python-version: 3
31+
- run: pip install --upgrade build twine
32+
- run: python -m build
33+
- run: twine check dist/*
34+
- uses: actions/upload-artifact@v3
35+
with:
36+
name: dist
37+
path: dist/
38+
- name: Build archive
39+
run: |
40+
git clean -fxd
41+
mkdir archive
42+
git archive -o archive/pydra.zip HEAD
43+
- uses: actions/upload-artifact@v3
44+
with:
45+
name: archive
46+
path: archive/
47+
48+
test:
49+
needs: ['build']
1650
strategy:
1751
matrix:
1852
os: [macos-latest, ubuntu-latest, windows-latest]
1953
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
54+
install: ['wheel']
55+
include:
56+
- os: 'ubuntu-latest'
57+
python-version: '3.11'
58+
install: 'sdist'
59+
- os: 'ubuntu-latest'
60+
python-version: '3.11'
61+
install: 'repo'
62+
- os: 'ubuntu-latest'
63+
python-version: '3.11'
64+
install: 'archive'
2065
exclude:
2166
- os: 'windows-latest'
2267
python-version: '3.11'
@@ -25,29 +70,59 @@ jobs:
2570

2671

2772
steps:
28-
- uses: actions/checkout@v2
29-
- name: Disable etelemetry
30-
run: echo "NO_ET=TRUE" >> $GITHUB_ENV
31-
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
32-
uses: actions/setup-python@v2
33-
with:
34-
python-version: ${{ matrix.python-version }}
35-
- name: Update build tools
36-
run: |
37-
python -m pip install --upgrade pip
38-
python -m pip install build wheel
73+
- name: Fetch sdist/wheel
74+
uses: actions/download-artifact@v3
75+
if: matrix.install == 'sdist' || matrix.install == 'wheel'
76+
with:
77+
name: dist
78+
path: dist/
79+
- name: Fetch git archive
80+
uses: actions/download-artifact@v3
81+
if: matrix.install == 'archive'
82+
with:
83+
name: archive
84+
path: archive/
85+
- name: Fetch repository
86+
uses: actions/checkout@v3
87+
if: matrix.install == 'repo'
88+
89+
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
90+
uses: actions/setup-python@v4
91+
with:
92+
python-version: ${{ matrix.python-version }}
93+
- name: Update pip
94+
run: python -m pip install --upgrade pip
3995

40-
- name: Build pydra
41-
run: python -m build
96+
- name: Determine installation target
97+
run: |
98+
if [[ "$INSTALL" = "sdist" ]]; then
99+
echo "ARCHIVE=$( ls dist/*.tar.gz )" >> $GITHUB_ENV
100+
elif [[ "$INSTALL" = "wheel" ]]; then
101+
echo "ARCHIVE=$( ls dist/*.whl )" >> $GITHUB_ENV
102+
elif [[ "$INSTALL" = "archive" ]]; then
103+
echo "ARCHIVE=$( ls archive/*.zip )" >> $GITHUB_ENV
104+
elif [[ "$INSTALL" = "repo" ]]; then
105+
echo "ARCHIVE=." >> $GITHUB_ENV
106+
fi
107+
env:
108+
INSTALL: ${{ matrix.install }}
42109

110+
- name: Install Pydra
111+
run: pip install $ARCHIVE
43112

44-
- name: Install Pydra tests dependencies
45-
run: pip install "$( ls dist/pydra*.whl )[test]"
113+
- name: Print version
114+
run: python -c "import pydra; print(pydra.__version__)"
46115

116+
- name: Install Pydra tests dependencies
117+
run: pip install pydra[test]
47118

48-
- name: Pytest
49-
run: pytest -vs -n auto --cov pydra --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules pydra
119+
- name: Disable etelemetry
120+
run: echo "NO_ET=TRUE" >> $GITHUB_ENV
50121

122+
- name: Pytest
123+
run: |
124+
pytest -vs -n auto --doctest-modules --pyargs pydra \
125+
--cov pydra --cov-config .coveragerc --cov-report xml:cov.xml
51126
52-
- name: Upload to codecov
53-
run: codecov -f cov.xml -F unittests -e GITHUB_WORKFLOW
127+
- name: Upload to codecov
128+
run: codecov -f cov.xml -F unittests -e GITHUB_WORKFLOW

pydra/conftest.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,21 @@ def pytest_generate_tests(metafunc):
1515
Plugins = ["slurm"]
1616
else:
1717
Plugins = ["cf"]
18-
if metafunc.config.getoption("dask"):
19-
Plugins.append("dask")
18+
try:
19+
if metafunc.config.getoption("dask"):
20+
Plugins.append("dask")
21+
except ValueError:
22+
# Called as --pyargs, so --dask isn't available
23+
pass
2024
metafunc.parametrize("plugin_dask_opt", Plugins)
2125

2226
if "plugin" in metafunc.fixturenames:
23-
if metafunc.config.getoption("dask"):
27+
use_dask = False
28+
try:
29+
use_dask = metafunc.config.getoption("dask")
30+
except ValueError:
31+
pass
32+
if use_dask:
2433
Plugins = []
2534
elif bool(shutil.which("sbatch")):
2635
Plugins = ["slurm"]

0 commit comments

Comments
 (0)