Skip to content

Commit 8d53b50

Browse files
committed
CI: Move package build/test into stables tests
1 parent 6d33516 commit 8d53b50

File tree

2 files changed

+63
-68
lines changed

2 files changed

+63
-68
lines changed

.github/workflows/package.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,54 @@ concurrency:
2828
cancel-in-progress: true
2929

3030
jobs:
31+
build:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
with:
36+
fetch-depth: 0
37+
- uses: actions/setup-python@v4
38+
with:
39+
python-version: 3
40+
- run: pip install --upgrade build twine
41+
- name: Build sdist and wheel
42+
run: python -m build
43+
- run: twine check dist/*
44+
- uses: actions/upload-artifact@v3
45+
with:
46+
name: dist
47+
path: dist/
48+
49+
test-package:
50+
runs-on: ubuntu-latest
51+
needs: [build]
52+
strategy:
53+
matrix:
54+
package: ['wheel', 'sdist']
55+
steps:
56+
- uses: actions/download-artifact@v3
57+
with:
58+
name: dist
59+
path: dist/
60+
- uses: actions/setup-python@v4
61+
with:
62+
python-version: 3
63+
- name: Display Python version
64+
run: python -c "import sys; print(sys.version)"
65+
- name: Update pip
66+
run: pip install --upgrade pip
67+
- name: Install wheel
68+
run: pip install dist/nipype-*.whl
69+
if: matrix.package == 'wheel'
70+
- name: Install sdist
71+
run: pip install dist/nipype-*.tar.gz
72+
if: matrix.package == 'sdist'
73+
- run: python -c 'import nipype; print(nipype.__version__)'
74+
- name: Install test extras
75+
run: pip install nipype[tests]
76+
- name: Run tests
77+
run: pytest --doctest-modules -v --pyargs nipype
78+
3179
stable:
3280
# Check each OS, all supported Python, minimum versions and latest releases
3381
runs-on: ${{ matrix.os }}
@@ -94,3 +142,18 @@ jobs:
94142
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
95143
path: test-results.xml
96144
if: ${{ always() && matrix.check == 'test' }}
145+
146+
publish:
147+
runs-on: ubuntu-latest
148+
environment: "Package deployment"
149+
needs: [stable, test-package]
150+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
151+
steps:
152+
- uses: actions/download-artifact@v3
153+
with:
154+
name: dist
155+
path: dist/
156+
- uses: pypa/gh-action-pypi-publish@release/v1
157+
with:
158+
user: __token__
159+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)