Skip to content

Commit

Permalink
Build docs in PR and clean workflows (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf authored Sep 19, 2022
1 parent fb2870f commit 26f7815
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
name: Publish docs
name: Build the documentation

on:
push:
branches:
- main
branches: [main]
pull_request:
on:
workflow_run:
workflows: ["Tests"]
branches: [main]
types:
- completed

jobs:
build-and-deploy:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout the branch
uses: actions/[email protected]
with:
persist-credentials: false
Expand All @@ -19,15 +26,7 @@ jobs:
with:
python-version: 3.9

- name: Build docs
- name: Build the documentation with Sphinx
run: |
pip install -r requirements-doc.txt
sphinx-build -b html docs docs/build/html
- name: Publish docs
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/build/html
CLEAN: true
29 changes: 29 additions & 0 deletions .github/workflows/publish_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish the documentation

on:
push:
on:
workflow_run:
workflows: ["Build the documentation"]
branches: [main]
types:
- completed

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout the branch
uses: actions/[email protected]
with:
persist-credentials: false
- name: Publish the documentation
if: success() && github.ref == 'refs/heads/main'
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/build/html
CLEAN: true
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: Release

on:
release:
Expand All @@ -7,6 +7,7 @@ on:

jobs:
release-job:
name: Release on PyPi
runs-on: ubuntu-latest
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
Expand All @@ -22,17 +23,18 @@ jobs:
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Check version number match
- name: Check that `blackjax.__version__` matches the Release name
run: |
echo "GITHUB_REF: ${GITHUB_REF}"
# The GITHUB_REF should be something like "refs/tags/v3.x.x"
# Make sure the package version is the same as the tag
grep -Rq "^Version: ${GITHUB_REF:10}$" blackjax.egg-info/PKG-INFO
- name: Publish to PyPI
- name: Publish to PyPi
run: |
twine check dist/*
twine upload --repository pypi --username __token__ --password ${PYPI_TOKEN} dist/*
test-install-job:
name: Test install from PyPi
needs: release-job
runs-on: ubuntu-latest
steps:
Expand All @@ -42,6 +44,6 @@ jobs:
python-version: 3.7
- name: Give PyPI some time to update the index
run: sleep 240
- name: Install from PyPI
- name: Attempt install from PyPI
run: |
pip install blackjax==${GITHUB_REF:10}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Run tests"
name: Tests

on:
pull_request:
Expand All @@ -8,7 +8,7 @@ on:

jobs:
style:
name: Check code style
name: Check the code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
fail_ci_if_error: false

benchmark:
name: Benchmarks
name: Run benchmarks
needs: [test]
runs-on: ubuntu-latest
strategy:
Expand Down

0 comments on commit 26f7815

Please sign in to comment.