Skip to content

Commit

Permalink
Only build sdist once
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmb committed Dec 11, 2023
1 parent 7910d7f commit d60b32c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
44 changes: 35 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,51 @@ name: Build
on: [push, pull_request]

jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
outputs:
sdist_name: ${{ steps.build_sdist.outputs.sdist_name }}
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Debug patch
run: patch -d uwsgi -p1 < uwsgi-version-debug.txt

- name: Build sdist
id: build_sdist
run: |
git submodule update --init
make sdist
echo "sdist_name=pyuwsgi-$(make version)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist

build_wheels:
name: Build wheels for ${{ matrix.os }}
needs: [build_sdist]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-11]
fail-fast: false

steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
with:
submodules: true
name: dist
path: dist

- name: Debug patch
run: patch -d uwsgi -p1 < uwsgi-version-debug.txt
- name: Unpack sdist
run: |
tar -xvzf "dist/${{ needs.build_sdist.outputs.sdist_name }}.tar.gz"
rm -rf dist
- name: Set up QEMU
if: runner.os == 'Linux'
Expand All @@ -30,7 +60,7 @@ jobs:
uses: pypa/[email protected]
with:
output-dir: dist
package-dir: ./uwsgi
package-dir: ./${{ needs.build_sdist.outputs.sdist_name }}
env:
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64
Expand All @@ -46,10 +76,6 @@ jobs:
CIBW_BEFORE_BUILD_MACOS: IS_MACOS=1 ./pre_build.sh
CIBW_BEFORE_BUILD_LINUX: ./pre_build.sh && (yum install -y zlib-devel || apk add zlib-dev)

- name: Create sdist
run: |
rm -rf uwsgi && git submodule update --init
pipx run build --sdist --outdir dist uwsgi
- uses: actions/upload-artifact@v3
with:
name: dist
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ dist/pyuwsgi-$(VERSION).tar.gz: build/pyuwsgi-$(VERSION)
.PHONY: sdist
sdist: dist/pyuwsgi-$(VERSION).tar.gz

.PHONY: print-version
print-version:
@echo $(VERSION)

.PHONY: update
update:
cd uwsgi; git pull
Expand Down

0 comments on commit d60b32c

Please sign in to comment.