-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from tomaroberts/23-gha-testpypi
Adds GitHub Action to automatically publish every pushed version to TestPyPI, then verifies build
- Loading branch information
Showing
11 changed files
with
129 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Publish to TestPyPI | ||
# | ||
# This workflow publishes nii2dcm on TestPyPI prior to production release onto PyPI. The workflow is intended to catch | ||
# any issues arising during the release procedure to prevent unnecessary versioning issues on PyPI | ||
# | ||
# This workflow will upload a Python Package using Twine when a release is created. For more information see: | ||
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
# | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Publish package to TestPyPI | ||
|
||
on: | ||
pull_request | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
testpypi-publish: | ||
|
||
name: Publish release to TestPyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/nii2dcm | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for PyPI trusted publishing | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build --sdist --wheel --outdir dist/ | ||
|
||
- name: Display nii2dcm version | ||
id: nii2dcm-version | ||
run: | | ||
pip install -e . | ||
echo "nii2dcm version:" | ||
nii2dcm -v | ||
- name: Publish package to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TESTPYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ | ||
verbose: true | ||
|
||
- name: Wait to allow TestPyPI to update | ||
uses: GuillaumeFalourd/wait-sleep-action@v1 | ||
with: | ||
time: '150' # seconds | ||
|
||
- name: Install latest TestPyPI version in fresh venv | ||
run: | | ||
NII2DCM_VERSION=`echo "$(nii2dcm -v)"` | ||
echo $NII2DCM_VERSION | ||
python -m venv nii2dcm-temp | ||
source nii2dcm-temp/bin/activate | ||
pip install --upgrade pip | ||
pip install setuptools wheel | ||
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ nii2dcm==$NII2DCM_VERSION | ||
nii2dcm -h | ||
echo "nii2dcm version:" | ||
nii2dcm -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[build-system] | ||
requires = ["setuptools>=64.0.0", "wheel", "setuptools_scm[toml]>=6.2"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "nii2dcm" | ||
dynamic = ["version"] | ||
|
||
[tool.setuptools_scm] | ||
local_scheme = "no-local-version" # required for PyPI and TestPyPI | ||
write_to = "nii2dcm/_version.py" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[metadata] | ||
name = nii2dcm | ||
version = attr: nii2dcm._version.__version__ | ||
description= nii2dcm: NIfTI to DICOM creation with Python | ||
url = https://github.com/tomaroberts/nii2dcm | ||
author = Tom Roberts | ||
author_email = t.roberts@kcl.ac.uk | ||
long_description = file:README.md | ||
long_description_content_type = text/markdown | ||
|
||
[options] | ||
packages = find: | ||
python_requires = <3.11 | ||
install_requires = | ||
numpy==1.23.2 | ||
matplotlib==3.6.2 | ||
nibabel==5.0.0 | ||
pydicom==2.3.0 | ||
twine==4.0.2 | ||
include_package_data=True | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
nii2dcm = nii2dcm.__main__:cli |