-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve build and installation process (#69)
* Update installation to rely only on pyproject and setup.py * Update readthedocs settings * Change to python github actions * Correct error ci.yml * Switch to only using poetry * Update Github action to use setup-poetry * Ensure action installs poetry dependencies' * Upgrade gryffin * Fix installation and build * Fix readthedocs install * Wipe build env on readthdocs and downgrade python ver * Update README.md with badges and fix typo in pyproject.toml * Update README * Finish redo of Github actions workflow to include test,build & publish * Correct ci.yml * Test publish step * Comment out pytest * Move get_version to main folder * Add job dependency * Bump version in preparation for new release and clean up README * Enable automated insertion of open in colab badge
- Loading branch information
1 parent
e9dc6ca
commit bc5ab90
Showing
20 changed files
with
1,566 additions
and
460 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 |
---|---|---|
@@ -1,21 +1,79 @@ | ||
name: Run Tests | ||
name: Test & Publish | ||
on: [push] | ||
|
||
jobs: | ||
pytest: | ||
name: pytest | ||
#Run pytest and build package | ||
test_build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
- name: Install | ||
uses: abatilo/actions-poetry@v1.5.0 | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install poetry | ||
uses: Gr1N/setup-poetry@v3 | ||
|
||
- name: Cache poetry dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
python_version: 3.7.7 | ||
poetry_version: 1.0.10 | ||
args: install -E experiments | ||
path: ~/.cache/pypoetry/virtualenvs | ||
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-poetry- | ||
- name: Install dependencies | ||
run: poetry install -E experiments | ||
|
||
- name: Run pytest | ||
uses: abatilo/actions-poetry@v1.5.0 | ||
run: poetry run pytest --doctest-modules --ignore=case_studies --ignore=experiments | ||
|
||
- name: Build package | ||
run: poetry build | ||
|
||
- name: Save build | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ github.sha }}-build | ||
path: dist/ | ||
|
||
|
||
# Publish to pypi on version change | ||
publish: | ||
needs: test_build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Make sure to fetch the last two commits | ||
# Needed forthe version bump and tag | ||
fetch-depth: 2 | ||
|
||
- name: Install toml | ||
run: pip install toml | ||
|
||
- name: Check for version bump and tag | ||
id: version_check | ||
uses: salsify/action-detect-and-tag-new-version@v2 | ||
with: | ||
python_version: 3.7.7 | ||
poetry_version: 1.0.10 | ||
args: run python -m pytest --doctest-modules --ignore=case_studies --ignore=experiments | ||
create-tag: $ {{ github.ref == 'refs/heads/master' }} # only create new tag on master | ||
version-command: | | ||
python get_version.py | ||
- name: Download poetry build | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ github.sha }}-build | ||
|
||
- name: Install poetry | ||
uses: Gr1N/setup-poetry@v3 | ||
|
||
- name: Publish | ||
# Only publish if there is a new tag | ||
if: ${{ steps.version_check.tag }} | ||
run: poetry publish -u {{ secrets.PYPI_USERNAME }} -p {{ $ secrets.PYPI_PASSWORD }} |
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,20 @@ | ||
# .readthedocs.yml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
|
||
|
||
# Optionally set the version of Python and requirements required to build your docs | ||
python: | ||
version: 3.6 | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs |
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,7 @@ | ||
Copyright 2020 Kobi Felton, Jan Rittig, Alexei Lapkin | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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 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
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.