Skip to content

Commit

Permalink
Continuous integration updates (#24)
Browse files Browse the repository at this point in the history
* Update release.yml

* Add Documentation URL to pyproject.

* Trying the CI build and release

---------

Signed-off-by: David Hart <[email protected]>
  • Loading branch information
dbhart authored Sep 16, 2024
1 parent c27a0fe commit 5031b1f
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 28 deletions.
35 changes: 31 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ concurrency:
cancel-in-progress: false

jobs:
build:
build-main:
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
name: Build the documentation with Sphinx
runs-on: ubuntu-latest
steps:
Expand All @@ -48,9 +49,37 @@ jobs:
with:
path: 'docs/_build/html'

build-tagged:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
name: Build the documentation with Sphinx
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch origin main
- name: troubleshooting
run: |
git branch
git remote -v
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install package
run: |
sudo apt-get install -y doxygen graphviz
pip install -e .[docs]
pip install -r requirements.txt
- name: Build documentation
run: sphinx-build docs/ docs/_build/html/${{ github.ref_name }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/_build/html'

deploy:
name: Deploy documentation to GitHub Pages
needs: build
needs: [build-main, build-tagged]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand All @@ -61,5 +90,3 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
base_path: /sansmic/${{ github.ref_name }}
96 changes: 73 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,89 @@
name: Build wheels and push to PyPI
name: Publish Python 🐍 distribution 📦 to TestPyPI

on:
on:
push:
branches:
- 'main'
tags:
- '*'

jobs:

wheels:
build_wheels:
name: Build distribution 📦 on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macOS-13, macOS-latest, ubuntu-latest]
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- uses: actions/checkout@v4

- uses: pypa/[email protected]
# ...
# with:
# package-dir: .
# output-dir: wheelhouse
# config-file: "{package}/pyproject.toml"

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

make_sdist:
name: Make SDist artifact 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*"
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules

- name: Build SDist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: cibw-sdist
path: dist/*.tar.gz

source:
upload_test:
name: >-
Publish Python 🐍 distribution 📦 to TestPyPI
needs: [build_wheels, make_sdist]
environment:
name: testpypi
url: https://test.pypi.org/p/sansmic
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: build the sdist
run: |
python -m pip install --upgrade build
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

upload_all:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
needs: [build_wheels, make_sdist, upload_test]
environment:
name: release
url: https://pypi.org/p/sansmic
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ tests = [
]

[project.urls]
Documentation = "https://sandialabs.github.io/sansmic"
Issues = "https://github.com/sandialabs/sansmic/issues"
Repository = "https://github.com/sandialabs/sansmic.git"

Expand All @@ -66,7 +67,9 @@ requires = ["setuptools", "pybind11"]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
skip = ["cp313-*", "pp*"]
skip = ["cp313-*", "pp*", "*-win32", "*-manylinux_i686", "*-musllinux*"]
test-extras = "tests"
test-command = "pytest {project}/tests"

[tool.setuptools.package-data]
"sansmic" = ["src/python/sansmic/*.pyd"]
Expand Down

0 comments on commit 5031b1f

Please sign in to comment.