Skip to content

Commit

Permalink
* workflow orchestration
Browse files Browse the repository at this point in the history
* workflow orchestration

* workflow orchestration

* more orchestration

* more orchestration

* more orchestration
  • Loading branch information
fxjung committed Apr 5, 2023
1 parent f8296f4 commit 91cacfb
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 108 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Build RidePy docs
name: docs

on:
push:
workflow_call:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Cache python environment
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('pyproject.toml') }}
- name: Install system dependencies using apt
run: |
sudo apt-get update && sudo apt-get -y install libboost-all-dev build-essential
- name: Install Dependencies
run: |
pip install -U pip
pip install .[doc]
- name: Build doc
run: sphinx-build -b html ./doc/ ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: sdist

on:
push:
branches:
- package_staging
release:
types: [published]
workflow_call:

jobs:
build_deploy:
build:
runs-on: ubuntu-latest
environment: pypi
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
Expand All @@ -36,16 +31,5 @@ jobs:
run: python -m build --sdist
- uses: actions/upload-artifact@v3
with:
name: Source package
name: sdist
path: dist/*.tar.gz
- name: Publish to TestPyPI
env:
TWINE_USERNAME: ${{ secrets.TESTPYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TESTPYPI_PASSWORD }}
run: twine upload -r testpypi dist/*.tar.gz
- name: Publish to PyPI
if: ${{ github.ref == 'refs/heads/master' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*.tar.gz
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: wheel

on:
push:
branches:
- package_staging
release:
types: [published]
workflow_call:

jobs:
build_deploy:
build:
runs-on: ubuntu-latest
environment: pypi
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
Expand Down Expand Up @@ -40,16 +35,5 @@ jobs:
# pip-wheel-args: '-w ./dist --no-deps'
- uses: actions/upload-artifact@v3
with:
name: Manylinux wheels
name: wheel-manylinux
path: dist/*-manylinux*.whl
- name: Publish sdist to TestPyPI
env:
TWINE_USERNAME: ${{ secrets.TESTPYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TESTPYPI_PASSWORD }}
run: twine upload -r testpypi dist/*-manylinux*.whl
- name: Publish to PyPI
if: ${{ github.ref == 'refs/heads/master' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload -r testpypi dist/*-manylinux*.whl
32 changes: 32 additions & 0 deletions .github/workflows/deploy-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Deploy ridepy docs to GitHub Pages
name: deploy-docs

on:
workflow_call:
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build-doc:
uses: ./.github/workflows/build-doc.yml
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-doc
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
40 changes: 40 additions & 0 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: pypi

on:
release:
types: [published]

concurrency:
group: "pypi"
cancel-in-progress: false

jobs:
sdist:
uses: ./.github/workflows/build-sdist.yml
wheel:
uses: ./.github/workflows/build-wheel.yml
test:
uses: ./.github/workflows/python-testing.yml
deploy-doc:
uses: ./.github/workflows/deploy-doc.yml
deploy:
runs-on: ubuntu-latest
environment: pypi
needs: [sdist, wheel, test, deploy-doc]
steps:
- uses: actions/download-artifact@v3
with:
name: sdist
path: dist
- uses: actions/download-artifact@v3
with:
name: wheel-manylinux
path: dist
- name: Show what is being published
run: ls -lah
working-directory: dist
- name: Publish package to PyPI
if: startsWith(github.ref, 'refs/tags/v') # just to be safe
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/deploy-testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: testpypi

on:
push:
branches:
- master
- package_staging

concurrency:
group: "testpypi"
cancel-in-progress: false

jobs:
sdist:
uses: ./.github/workflows/build-sdist.yml
wheel:
uses: ./.github/workflows/build-wheel.yml
test:
uses: ./.github/workflows/python-testing.yml
doc:
uses: ./.github/workflows/build-doc.yml
deploy:
runs-on: ubuntu-latest
environment: pypi
needs: [sdist, wheel, test, doc]
steps:
- uses: actions/download-artifact@v3
with:
name: sdist
path: dist
- uses: actions/download-artifact@v3
with:
name: wheel-manylinux
path: dist
- name: Show what is being published
run: ls -lah
working-directory: dist
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
69 changes: 0 additions & 69 deletions .github/workflows/docs-gh-pages.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/python-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

name: tests

on: [push, pull_request]
on:
push:
pull_request:
workflow_call:

jobs:
test:
Expand Down

0 comments on commit 91cacfb

Please sign in to comment.