Skip to content

Commit

Permalink
build documentation on push to master and update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
prehner committed Jul 13, 2024
1 parent acabe86 commit 67d2d77
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 91 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Deploy Documentation
on:
push:
branches: [master]
pull_request:
branches: [master]

env:
CARGO_TERM_COLOR: always
Expand Down
138 changes: 49 additions & 89 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,137 +26,97 @@ jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: 3.9
- name: Build Wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
manylinux: auto
command: build
args: --release --out dist
args: --profile release-lto --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: dist
name: wheel-linux-x86_64
path: dist

macos:
runs-on: macos-latest
macos-x86_64:
runs-on: macos-12
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
python-version: 3.9
architecture: x64
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --release --out dist
- name: Build wheels - universal2
uses: messense/maturin-action@v1
args: --profile release-lto --out dist
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheel-macos-x86_64
path: dist
macos-aarch64:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: arm64
- name: Build wheels - aarch64
uses: PyO3/maturin-action@v1
with:
args: --release --universal2 --out dist
target: aarch64
args: --profile release-lto-thin --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: dist
name: wheel-aarch64-apple-darwin
path: dist

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: 3.9
architecture: ${{ matrix.target }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
args: --profile release-lto --out dist
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: dist
name: wheel-${{ matrix.target }}
path: dist

deploy-pypi:
name: Publish wheels to PyPI and TestPyPI
runs-on: ubuntu-latest
needs: [linux, windows, macos]
needs: [linux, windows, macos-x86_64, macos-aarch64]
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: actions/setup-python@v2
pattern: wheel-*
path: wheels
merge-multiple: true
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: 3.9
- name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
pip install --upgrade twine
twine upload --skip-existing dist/*
build-documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install python dependencies
run: |
pip install sphinx sphinx-rtd-theme
- name: Build Wheels
uses: messense/maturin-action@v1
with:
manylinux: auto
command: build
args: --release --out dist
- name: Install module
run: |
pip install num_dual --no-index --find-links dist --force-reinstall
- name: Build documentation
run: sphinx-build docs/ public/ -b html
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: documentation
path: public

release-documentation:
needs: [build-documentation]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: documentation
path: public
- name: Deploy documentation to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
twine upload --skip-existing wheels/*

0 comments on commit 67d2d77

Please sign in to comment.