From 3b5f012442f91f5b5840f8d2a3d71706b31cbb43 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 6 Jul 2024 23:10:48 +0200 Subject: [PATCH] CFR: Publish self-contained application bundle to GH Workflow Artifacts --- .github/workflows/release-app.yml | 66 +++++++++++++++++++++++++++++++ CHANGES.md | 1 + pyproject.toml | 1 + 3 files changed, 68 insertions(+) create mode 100644 .github/workflows/release-app.yml diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml new file mode 100644 index 00000000..a68a725c --- /dev/null +++ b/.github/workflows/release-app.yml @@ -0,0 +1,66 @@ +# Stage PyInstaller application packages through GitHub Actions (GHA) to GitHub Workflow Artifacts section. +# https://github.com/actions/upload-artifact#where-does-the-upload-go +name: "Release: Application Bundle" + +on: + pull_request: ~ + push: + tags: + - '*.*.*' + +jobs: + + cfr: + name: "CFR for OS ${{ matrix.os }}" + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ + "macos-13", # Intel + "macos-latest", # ARM + "ubuntu-latest", # Intel + "windows-latest", # Intel + ] + + steps: + + - name: Acquire sources + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + cache-dependency-path: 'pyproject.toml' + + - name: Set up project + run: pip install --use-pep517 --prefer-binary --editable='.[cfr,release-cfr]' + + - name: Build application bundle + run: poe build-cfr + + - name: Compute artifact suffix (OS-ARCH) + id: artifact-suffix + uses: ASzc/change-string-case-action@v6 + with: + string: "${{ runner.os }}-${{ runner.arch }}" + + - name: Upload artifact for Linux and macOS + if: runner.os != 'Windows' + uses: actions/upload-artifact@v4 + with: + name: "cratedb-cfr-${{ steps.artifact-suffix.outputs.lowercase }}" + path: dist/cratedb-cfr + + - name: Upload artifact for Windows + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: "cratedb-cfr-${{ steps.artifact-suffix.outputs.lowercase }}" + path: dist/cratedb-cfr.exe + + # TODO: Upload to release assets or GitHub Pages, when invoked on "tag" event. + #if: startsWith(github.event.ref, 'refs/tags') diff --git a/CHANGES.md b/CHANGES.md index 75ea8f69..c0f0433e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ - SQLAlchemy: Clean up and refactor SQLAlchemy polyfills to `cratedb_toolkit.util.sqlalchemy` - CFR: Build as a self-contained program using PyInstaller +- CFR: Publish self-contained application bundle to GitHub Workflow Artifacts ## 2024/06/18 v0.0.14 - Add `ctk cfr` and `ctk wtf` diagnostics programs diff --git a/pyproject.toml b/pyproject.toml index 138c63d8..8194a46a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -168,6 +168,7 @@ release = [ "twine<6", ] release-cfr = [ + "poethepoet<0.28", "pyinstaller<7", ] service = [