From 34b8d94a8656b8aaba4f6a4ee42bc1f0962b44ef Mon Sep 17 00:00:00 2001 From: "Patrick M. Niedzielski" Date: Thu, 8 Feb 2024 15:34:20 -0500 Subject: [PATCH 1/2] CI: Allow PyPI publishing to be done manually It is useful to be able to dispatch a PyPI upload manually, without creating a new GitHub release, in the case of transient GitHub Actions failures that are not due to a problem in the release itself. This patch enables the `workflow_dispatch` trigger for our `wheels`, and explicitly allows `upload_pypi` to run on `workflow_dispatch`, which allows us to manually and intentionally call this workflow without making a new release. Signed-off-by: Patrick M. Niedzielski --- .github/workflows/build_wheels.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 415ab23..60544c4 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -5,6 +5,7 @@ on: release: types: - published + workflow_dispatch: schedule: # At 12:00 on every day-of-month - cron: "0 12 */1 * *" @@ -161,7 +162,9 @@ jobs: upload_pypi: needs: merge runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' + if: | + github.event_name == 'release' && github.event.action == 'published' + || github.event_name == 'workflow_dispatch' steps: - uses: actions/download-artifact@v4 with: From ce87c1af6a23d9b104c428b7f9113600f6697878 Mon Sep 17 00:00:00 2001 From: "Patrick M. Niedzielski" Date: Thu, 8 Feb 2024 15:40:00 -0500 Subject: [PATCH 2/2] [WIP] CI: Automatically publish docs to GitHub Pages Just as we upload to PyPI on new releases (as well as on manual dispatch of the wheel-building workflow), we also want to build and upload documentation on new releases. We are moving to hosting the documentation locally on our own GitHub pages, so we can do this automatically, rather than invoke a PR on the main `blazingmq` repository. This patch is a work-in-progress, and should not be merged yet. We want to ensure that the documentation is built correctly before we attempt to publish it, so we run this on every build of the wheels, but also only publish to GitHub Pages as a dry run. Signed-off-by: Patrick M. Niedzielski --- .github/workflows/build_wheels.yml | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 60544c4..f772273 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -174,3 +174,56 @@ jobs: with: skip_existing: true password: ${{ secrets.PYPI_PASSWORD }} + + publish_docs: + name: Publish docs to GitHub Pages + needs: merge + runs-on: ubuntu-latest + # Eventually, we want this to be updated only on releases, in the same way + # PyPI uploads are done. For the moment, though, our uploads are dry runs + # only, set below, and we want to test on every build. + # + #if: | + # github.event_name == 'release' && github.event.action == 'published' + # || github.event_name == 'workflow_dispatch' + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Set up dependencies + run: | + sudo apt-get update + sudo apt-get install -qy pkg-config bison libfl-dev libz-dev + + - name: Install Python dependencies + run: | + python3 -m pip install -r requirements-lint-docs.txt + + - name: Download wheel artifact + uses: actions/download-artifact@v4 + with: + name: dist-Linux-cp310-x86_64 + path: blazingmq.whl + + - name: Install Package + run: | + python3 -m pip install blazingmq.whl + + - name: Build docs + run: | + make docs + + - name: Publish docs to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: docs/_build/html + single-commit: true + # Make sure this does not actually publish any documentation, so we + # can test that everything works correctly. + dry-run: true