forked from pymc-devs/pymc-experimental
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate pypi release (pymc-devs#135)
* adapted the release setup to mimic one used in pymc-marketing * fixed naming not matching in __init__ * fixing importing error for numpy * fixing command * adding numpy dependency to fix missing numpy error * fixing self import in setup.py * including versioneer, supressing pre-commit for versionner files * fixed build
- Loading branch information
1 parent
bce8ae6
commit 4c21bbb
Showing
11 changed files
with
3,060 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pymc_experimental/_version.py export-subst |
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,86 @@ | ||
name: PyPI | ||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
- name: Build the sdist and the wheel | ||
run: | | ||
pip install build | ||
python3 -m build | ||
- name: Check the sdist installs and imports | ||
run: | | ||
mkdir -p test-sdist | ||
cd test-sdist | ||
python -m venv venv-sdist | ||
venv-sdist/bin/python -m pip install ../dist/pymc-experimental*.tar.gz | ||
echo "Checking import and version number (on release)" | ||
venv-sdist/bin/python -c "import pymc_experimental as pmx; assert pmx.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else pmx.__version__; print(pmx.__version__)" | ||
cd .. | ||
- name: Check the bdist installs and imports | ||
run: | | ||
mkdir -p test-bdist | ||
cd test-bdist | ||
python -m venv venv-bdist | ||
venv-bdist/bin/python -m pip install ../dist/pymc_experimental*.whl | ||
echo "Checking import and version number (on release)" | ||
venv-bdist/bin/python -c "import pymc_experimental as pmx; assert pmx.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else pmx.__version__; print(pmx.__version__)" | ||
cd .. | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist/* | ||
test: | ||
name: upload to test PyPI | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
skip_existing: true | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
- name: Test pip install from test.pypi | ||
run: | | ||
python -m venv venv-test-pypi | ||
venv-test-pypi/bin/python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pymc-experimental | ||
echo "Checking import and version number" | ||
venv-test-pypi/bin/python -c "import pymc_experimental; assert pymc_experimental.__version__ == '${{ github.ref_name }}'" | ||
publish: | ||
name: upload release to PyPI | ||
needs: [build, test] | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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,4 @@ | ||
include requirements*.txt | ||
include *.md *.rst | ||
include LICENSE | ||
include versioneer.py |
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
Oops, something went wrong.