Build and upload Python 3.12.4 (dry run) #245
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and upload Python runtime | |
run-name: "Build and upload Python ${{ inputs.python_version }}${{ inputs.dry_run && ' (dry run)' || '' }}" | |
on: | |
workflow_dispatch: | |
inputs: | |
python_version: | |
description: "Python version (eg: 3.12.0)" | |
type: string | |
required: true | |
stack: | |
description: "Stack(s)" | |
type: choice | |
options: | |
- auto | |
- heroku-20 | |
- heroku-22 | |
- heroku-24 | |
default: auto | |
required: false | |
runner_size: | |
description: "Runner size" | |
type: choice | |
options: | |
- large | |
- xlarge | |
- 2xlarge | |
required: true | |
dry_run: | |
description: "Skip uploading to S3 (dry run)" | |
type: boolean | |
default: true | |
required: false | |
permissions: | |
contents: read | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "us-east-1" | |
S3_BUCKET: "heroku-buildpack-python" | |
# Unfortunately these jobs cannot be easily written as a matrix since `matrix.exclude` does not | |
# support expression syntax, and the `matrix` context is not available inside the job `if` key. | |
jobs: | |
heroku-20: | |
if: inputs.stack == 'heroku-20' || inputs.stack == 'auto' | |
runs-on: pub-hk-ubuntu-22.04-${{ inputs.runner_size }} | |
env: | |
STACK_VERSION: "20" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build Docker image | |
run: docker build --platform="linux/amd64" --pull --tag buildenv --build-arg=STACK_VERSION builds/ | |
- name: Compile and package Python runtime | |
run: docker run --rm --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}" | |
- name: Test Python runtime | |
run: | | |
RUN_IMAGE='heroku/heroku:${{ env.STACK_VERSION }}' | |
ARCHIVE_FILENAME='python-${{ inputs.python_version }}-ubuntu-${{ env.STACK_VERSION }}.04-amd64.tar.zst' | |
docker run --rm --volume="${PWD}/upload:/upload:ro" --volume="${PWD}/builds:/builds:ro" "${RUN_IMAGE}" /builds/test_python_runtime.sh "/upload/${ARCHIVE_FILENAME}" | |
heroku-22: | |
# On Heroku-22 we only support Python 3.9+. | |
if: inputs.stack == 'heroku-22' || (inputs.stack == 'auto' && !startsWith(inputs.python_version,'3.8.')) | |
runs-on: pub-hk-ubuntu-22.04-${{ inputs.runner_size }} | |
env: | |
STACK_VERSION: "22" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build Docker image | |
run: docker build --platform="linux/amd64" --pull --tag buildenv --build-arg=STACK_VERSION builds/ | |
- name: Compile and package Python runtime | |
run: docker run --rm --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}" | |
- name: Test Python runtime | |
run: | | |
RUN_IMAGE='heroku/heroku:${{ env.STACK_VERSION }}' | |
ARCHIVE_FILENAME='python-${{ inputs.python_version }}-ubuntu-${{ env.STACK_VERSION }}.04-amd64.tar.zst' | |
docker run --rm --volume="${PWD}/upload:/upload:ro" --volume="${PWD}/builds:/builds:ro" "${RUN_IMAGE}" /builds/test_python_runtime.sh "/upload/${ARCHIVE_FILENAME}" | |
heroku-24: | |
# On Heroku-24 we only support Python 3.10+. | |
if: inputs.stack == 'heroku-24' || (inputs.stack == 'auto' && !startsWith(inputs.python_version,'3.8.') && !startsWith(inputs.python_version,'3.9.')) | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: ["amd64", "arm64"] | |
runs-on: ${{ matrix.arch == 'arm64' && 'pub-hk-ubuntu-22.04-arm' || 'pub-hk-ubuntu-22.04' }}-${{ inputs.runner_size }} | |
env: | |
STACK_VERSION: "24" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build Docker image | |
run: docker build --platform="linux/${{ matrix.arch }}" --pull --tag buildenv --build-arg=STACK_VERSION builds/ | |
- name: Compile and package Python runtime | |
run: docker run --rm --volume="${PWD}/upload:/tmp/upload" buildenv ./build_python_runtime.sh "${{ inputs.python_version }}" | |
- name: Test Python runtime | |
run: | | |
RUN_IMAGE='heroku/heroku:${{ env.STACK_VERSION }}' | |
ARCHIVE_FILENAME='python-${{ inputs.python_version }}-ubuntu-${{ env.STACK_VERSION }}.04-${{ matrix.arch }}.tar.zst' | |
docker run --rm --volume="${PWD}/upload:/upload:ro" --volume="${PWD}/builds:/builds:ro" "${RUN_IMAGE}" /builds/test_python_runtime.sh "/upload/${ARCHIVE_FILENAME}" |