Skip to content

Commit 43b92bd

Browse files
committed
Build system improvements
- Use setuptools_scm instead of versioneer - Move the package into a "src" subdirectory which better follows best practices and ensures that running tests on the installed package does not do a relative import from the current working directory. - Clean up deploy script to use pypi trusted publishing rather than twine.
1 parent 38b930f commit 43b92bd

13 files changed

Lines changed: 33 additions & 731 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,14 @@
33
name: Deploy Release
44

55
on:
6-
push:
7-
tags:
8-
- '*'
9-
10-
# This is for debugging.
11-
# on:
12-
# push:
13-
# branches: [ master ]
14-
# pull_request:
15-
# branches: [ master ]
6+
workflow_dispatch:
7+
release:
8+
types: [ published ]
169

1710
concurrency:
1811
group: ${{ github.workflow }}-${{ github.ref }}
1912
cancel-in-progress: true
2013

21-
env:
22-
TWINE_USERNAME: __token__
23-
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
24-
2514
jobs:
2615
wheels:
2716
runs-on: ubuntu-latest
@@ -35,7 +24,7 @@ jobs:
3524
python-version: "3.12"
3625

3726
- name: Install Dependencies
38-
run: python3 -m pip install build twine numpy
27+
run: python3 -m pip install build numpy
3928

4029
- name: Install Package
4130
run: python3 -m pip install .
@@ -49,6 +38,23 @@ jobs:
4938
- name: Build wheels
5039
run: python3 -m build --wheel
5140

52-
- name: Upload to PyPI
53-
run: |
54-
python -m twine upload dist/*.tar.gz && python -m twine upload dist/pshmem*.whl
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
name: pshmem
44+
path: ./dist/pshmem*.whl
45+
46+
upload_pypi:
47+
needs: wheels
48+
runs-on: ubuntu-latest
49+
permissions:
50+
id-token: write
51+
if: github.event_name == 'release' && github.event.action == 'published'
52+
steps:
53+
- uses: actions/download-artifact@v5
54+
with:
55+
# Unpacks all artifacts into dist/
56+
pattern: pshmem-*
57+
path: dist
58+
merge-multiple: true
59+
60+
- uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,11 @@ jobs:
8989
run: |
9090
source ~/conda/etc/profile.d/conda.sh \
9191
&& conda activate test \
92-
&& mkdir -p test \
93-
&& pushd test >/dev/null 2>&1 \
94-
&& MPI_DISABLE=1 python3 -c 'import pshmem.test; pshmem.test.run()' \
95-
&& popd >/dev/null 2>&1
92+
&& MPI_DISABLE=1 python3 -c 'import pshmem.test; pshmem.test.run()'
9693
9794
- name: Run MPI Tests
9895
run: |
9996
source ~/conda/etc/profile.d/conda.sh \
10097
&& conda activate test \
101-
&& mkdir -p test \
102-
&& pushd test >/dev/null 2>&1 \
10398
&& mpirun -np 1 python3 -c 'import pshmem.test; pshmem.test.run()' \
104-
&& mpirun -np 2 python3 -c 'import pshmem.test; pshmem.test.run()' \
105-
&& popd >/dev/null 2>&1
99+
&& mpirun -np 2 python3 -c 'import pshmem.test; pshmem.test.run()'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Generated sources
2+
src/pshmem/_version.py
3+
14
# Python binary
25
*__pycache__
36
*.pyc

0 commit comments

Comments
 (0)