Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Added github action release workflow #563

Merged
merged 8 commits into from
Apr 11, 2024
Merged

Conversation

t20100
Copy link
Member

@t20100 t20100 commented Apr 10, 2024

This PR adds a release workflow that is triggered when publishing a release in github and that can be run manually.

This workflow:

  • Builds and tests the source tarball
  • Builds and tests the wheels with cibuildwheel
  • Builds the documentation and saves it as a zip file
  • Publishes the tarball and wheels in pypi when the workflow is triggered by a published release (and after validation)

To make it work it requires to:

This is adapted from cibuildwheel documentation:

It's similar to silx's release.yml and hdf5plugin's release.yml

@t20100
Copy link
Member Author

t20100 commented Apr 10, 2024

  • Added nbsphinx to requirements.txt
  • Updated sphinx config to accomodate with readthedocs changes (and ease documentation generation in release workflow)

name: Build and deploy

on:
workflow_dispatch:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To enable running manually from the Action page

Comment on lines +67 to +68
env:
READTHEDOCS: "True" # To skip checking that fabio is installed locally
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be remove if the doc's conf.py was not checking for place where fabio is installed.

Comment on lines +97 to +99
- os: macos-14
cibw_archs: "arm64"
macos_target: "11.0"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use macos M1 machines.

Comment on lines +133 to +134
environment:
name: pypi
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This environment name needs to be declared in pypi.org

name: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run only when triggered by a published release

Comment on lines 23 to 29
import fabio
project_dir = os.path.abspath(os.path.join(__file__, "..", "..", ".."))
build_dir = os.path.abspath(fabio.__file__)
if on_rtd:
if os.environ.get('READTHEDOCS') == 'True':
print("On Read The Docs")
print("build_dir", build_dir)
print("project_dir", project_dir)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the whole try/except block needed.
One need to make sure to install the same version of fabio as the one that is used to build the doc, but is it worth preventing generating the doc from an installed version?

Comment on lines -64 to -69
if not on_rtd:
try:
import sphinx_rtd_theme
extensions.append('sphinx_rtd_theme')
except:
print("sphinx_rtd_theme is not available")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readthedocs no longer set the theme automatically

@t20100 t20100 marked this pull request as ready for review April 10, 2024 15:17
@t20100
Copy link
Member Author

t20100 commented Apr 10, 2024

For an example of workflow run, see: https://github.com/t20100/fabio/actions/runs/8633327052 (Artifacts can be downloaded at the bottom of the web page)

Note: The tests of the sdist failed on a test with randomly generated data.

@t20100 t20100 requested a review from kif April 10, 2024 15:19
@kif
Copy link
Member

kif commented Apr 11, 2024

Let's give it a try to build a release

@kif kif merged commit c487eb3 into silx-kit:main Apr 11, 2024
6 of 7 checks passed
@t20100
Copy link
Member Author

t20100 commented Apr 11, 2024

This run https://github.com/t20100/fabio/actions/runs/8648448087 provides zip with generated wheels for testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants