Skip to content

Commit

Permalink
Build pre-populated Python distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed May 9, 2024
1 parent 0b9de73 commit add3624
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 9 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/build-distributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: build distributions

on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
PYTHON_VERSION: "3.12.3"
DIST_VERSION: "20240415"
DIST_URL: "https://github.com/indygreg/python-build-standalone/releases/download"
PYTHONDONTWRITEBYTECODE: "1"

jobs:
binaries:
name: ${{ matrix.job.target }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
job:
- image: quay.io/pypa/manylinux2014_x86_64
target: x86_64-unknown-linux-gnu
- image: custom
target: x86_64-unknown-linux-musl
- image: quay.io/pypa/manylinux_2_28_aarch64
target: aarch64-unknown-linux-gnu
emulation: arm64
- image: quay.io/pypa/manylinux2014_ppc64le
target: ppc64le-unknown-linux-gnu
emulation: ppc64le

steps:
- name: Set up QEMU
if: matrix.job.emulation
uses: docker/setup-qemu-action@v3

- name: Set up Alpine
if: matrix.job.target == 'x86_64-unknown-linux-musl'
run: |-
echo <<'EOL' > Dockerfile
FROM alpine:3.19
RUN apk update && apk add curl build-base cmake openssl openssl-dev openssl-libs-static pkgconfig rustup
RUN rustup-init -t x86_64-unknown-linux-musl --default-toolchain stable --profile minimal -y
ENV PATH="/root/.cargo/bin:${PATH}"
ENV OPENSSL_NO_VENDOR="1"
ENV OPENSSL_STATIC="1"
ENV OPENSSL_LIB_DIR="/usr/lib"
ENV OPENSSL_INCLUDE_DIR="/usr/include"
EOL
docker build . -t ${{ matrix.job.image }}
- name: Set up Docker container
run: >-
docker run --rm -d
--name builder
--workdir /home
--env PYTHONDONTWRITEBYTECODE
${{ matrix.job.image }}
sleep infinity
- name: Download distribution
run: >-
docker exec builder
curl -LO
${{ env.DIST_URL }}/${{ env.DIST_VERSION }}/cpython-${{ env.PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz
- name: Unpack distribution
run: >-
docker exec builder
tar xzf cpython-${{ env.PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz
- name: Install Hatch
run: >-
docker exec builder
/home/python/bin/python -m pip install --no-compile hatch
6 changes: 3 additions & 3 deletions .github/workflows/build-hatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
- hatch-v*
branches:
- master
pull_request:
branches:
- master
# pull_request:
# branches:
# - master

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
# pull_request:
# branches:
# - master

concurrency:
group: docs-deploy
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
# pull_request:
# branches:
# - master

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
Expand Down

0 comments on commit add3624

Please sign in to comment.