Skip to content

Commit

Permalink
feat: enable pyapp release builds (#409)
Browse files Browse the repository at this point in the history
* chore(ci): additional pyapp build modifications

* chore: remove deprecated config

* fix: version correction

* chore: more tests

* feat: use v4 of code checkout

* fix: madness

* chore: i dunno

* feat: something new

* fix: additional updates

* feat: set ordering

* feat: set ordering

* feat: disable cross compile as a test

* feat: disable envs that need cross

* feat: sudo only on linux

* feat: disable musl builds

* chore: adjust release builder

* feat: make binary package name unique per target

* fix: missing dollar sign

* fix: upgrade actions

* feat: another adjustment

* chore: assets updated

* chore: use merge-multiple

* fix: add individual asset types

* fix: merge-multiple works
  • Loading branch information
cofin authored Apr 26, 2024
1 parent 0715006 commit 34990ed
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 41 deletions.
82 changes: 42 additions & 40 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,44 +49,47 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Fetch all tags
fetch-depth: 0

- name: Install build dependencies
run: python -m pip install --upgrade build wheel setuptools cython mypy
- name: Install Hatch
run: pip install --upgrade hatch hatch-pip-compile

- name: Build
run: python -m build
run: hatch build

- uses: actions/upload-artifact@v4
with:
name: artifacts
name: wheels
path: dist/*
if-no-files-found: error
overwrite: true

build-binaries:
name: Build binary application for ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
needs:
- collection-scripts
- pure-python-wheel-and-sdist
strategy:
fail-fast: false
matrix:
job:
# Linux
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
cross: true
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
cross: true
- target: i686-unknown-linux-gnu
os: ubuntu-22.04
cross: true
os: ubuntu-latest
cross: false
# - target: x86_64-unknown-linux-musl
# os: ubuntu-latest
# cross: false
# - target: aarch64-unknown-linux-gnu
# os: ubuntu-latest
# cross: false
# - target: i686-unknown-linux-gnu
# os: ubuntu-latest
# cross: false
# Windows
- target: x86_64-pc-windows-msvc
os: windows-2022
Expand All @@ -102,12 +105,21 @@ jobs:
CARGO: cargo
CARGO_BUILD_TARGET: ${{ matrix.job.target }}
PYAPP_REPO: pyapp
PYAPP_VERSION: v0.16.0
PYAPP_VERSION: v0.18.0
PYAPP_PROJECT_FEATURES: oracle,postgres,mssql,mysql,server,remote
PYAPP_DISTRIBUTION_EMBED: "1"
PYAPP_UV_ENABLED: "1"
HATCH_BUILD_LOCATION: dist
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Fetch all tags
fetch-depth: 0

- name: Install musl-tools on Linux
run: sudo apt-get install --yes musl musl-dev musl-tools
if: ${{ matrix.job.os == 'Linux' }}

- name: Clone PyApp
run: git clone --depth 1 --branch $PYAPP_VERSION https://github.com/ofek/pyapp $PYAPP_REPO
Expand All @@ -120,8 +132,8 @@ jobs:
- name: Install Hatch
run: pip install -U hatch hatch-pip-compile


- name: Install Rust toolchain
if: ${{ !matrix.job.cross }}
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
Expand All @@ -145,20 +157,25 @@ jobs:
cargo -V
hatch --version
- uses: actions/download-artifact@v4
with:
name: wheels
path: ${{ github.workspace }}/dist
merge-multiple: true


- name: Build Binary
working-directory: /home/runner/work/database-assessment/database-assessment/
working-directory: ${{ github.workspace }}
run: |-
current_version=$(hatch version)
hatch build
PYAPP_UV_ENABLED="1" PYAPP_PROJECT_PATH="$(ls ${PWD}/dist/dma-${current_version}-py3-none-any.whl)" PYAPP_PROJECT_FEATURES="oracle,postgres,mssql,mysql,server,remote" PYAPP_DISTRIBUTION_EMBED="1" hatch build -t app
PYAPP_PROJECT_PATH="${{ github.workspace }}/dist/dma-${current_version}-py3-none-any.whl" PYAPP_PROJECT_FEATURES="oracle,postgres,mssql,mysql,server,remote" PYAPP_DISTRIBUTION_EMBED="1" hatch -v build -t app
- name: Upload built binary package
uses: actions/upload-artifact@v4
with:
name: binaries
name: binaries-${{ env.CARGO_BUILD_TARGET }}
path: dist/app/*
if-no-files-found: error
overwrite: true

publish:
name: Publish release
Expand All @@ -171,13 +188,6 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: collections
path: dist
merge-multiple: true

- uses: actions/download-artifact@v4
with:
name: artifacts
path: dist
merge-multiple: true

Expand All @@ -187,15 +197,7 @@ jobs:
# skip_existing: true
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}

- uses: actions/download-artifact@v4
with:
name: binaries
path: dist
merge-multiple: true

- name: Add assets to current release
- name: Add assets to release
uses: softprops/action-gh-release@v2
with:
files: dist/*
merge-multiple: true
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ sources = ["src"]
[tool.hatch.build.targets.sdist]
exclude = ["/.github", "/docs"]

[tool.hatch.build.targets.app]
[tool.hatch.build.targets.binary]
pyapp-version = "0.18.0"
python = "3.12"


#####################
# Environment Setup #
#####################
Expand Down

0 comments on commit 34990ed

Please sign in to comment.