forked from HumanCompatibleAI/imitation
-
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 uploads on release (HumanCompatibleAI#489)
* Automate PyPi release * Use our own PyPi release of sacred (yuck!) * Bump version number (HumanCompatibleAI#490) * Switch to generating version number from setuptools_scm * fix typo * Use v1 release * Add backwards compatibility logic * Disable local scheme * Fetch tags * use v3 not master * Bump to 3.8 everywhere * No cover for clause not expected to hit * Workaround flaky windows tests
- Loading branch information
1 parent
b8a4c36
commit 242b15b
Showing
7 changed files
with
95 additions
and
23 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,52 @@ | ||
# Adapted from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
|
||
name: Publish imitation distributions 📦 to PyPI and TestPyPI | ||
|
||
on: push | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish imitation distributions 📦 to PyPI and TestPyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# Fetch tags needed by setuptools_scm to infer version number | ||
# See https://github.com/pypa/setuptools_scm/issues/414 | ||
fetch-depth: 0 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install pypa/build | ||
run: >- | ||
python -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: >- | ||
python -m | ||
build | ||
--sdist | ||
--wheel | ||
--outdir dist/ | ||
. | ||
# Publish new distribution to Test PyPi on every push. | ||
# This ensures the workflow stays healthy, and will also serve | ||
# as a source of alpha builds. | ||
- name: Publish distribution 📦 to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
# Publish new distribution to production PyPi on releases. | ||
- name: Publish distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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 |
---|---|---|
@@ -1,2 +1,11 @@ | ||
[build-system] | ||
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tools.setuptools_scm] | ||
# Disable local scheme to allow uploads to Test PyPI. | ||
# See https://github.com/pypa/setuptools_scm/issues/342 | ||
local_scheme = "no-local-version" | ||
|
||
[tool.black] | ||
target-version = ["py37"] | ||
target-version = ["py38"] |
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ sphinx: | |
formats: all | ||
|
||
python: | ||
version: 3.7 | ||
version: 3.8 | ||
install: | ||
- method: pip | ||
path: . | ||
|
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
"""imitation: implementations of imitation and reward learning algorithms.""" | ||
|
||
__version__ = "0.2.0" | ||
from importlib import metadata | ||
|
||
try: | ||
__version__ = metadata.version("imitation") | ||
except metadata.PackageNotFoundError: # pragma: no cover | ||
# package is not installed | ||
pass |
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