Rework CI and release workflows to maximize reuse. #27
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- 3.* | |
workflow_call: | |
inputs: | |
build-number: | |
description: "The build number to add to the built package" | |
default: "custom" | |
type: "string" | |
outputs: | |
PYTHON_VER: | |
description: "The Python major.minor version." | |
value: ${{ jobs.config.outputs.PYTHON_VER }} | |
PYTHON_VERSION: | |
description: "The full Python version." | |
value: ${{ jobs.config.outputs.PYTHON_VERSION }} | |
BZIP2_VERSION: | |
description: "The BZip2 version used for the build." | |
value: ${{ jobs.config.outputs.BZIP2_VERSION }} | |
LIBFFI_VERSION: | |
description: "The libFFI version used for the build." | |
value: ${{ jobs.config.outputs.LIBFFI_VERSION }} | |
MPDECIMAL_VERSION: | |
description: "The mpdecimal version used for the build." | |
value: ${{ jobs.config.outputs.MPDECIMAL_VERSION }} | |
OPENSSL_VERSION: | |
description: "The OpenSSL version used for the build." | |
value: ${{ jobs.config.outputs.OPENSSL_VERSION }} | |
XZ_VERSION: | |
description: "The XZ version used for the build." | |
value: ${{ jobs.config.outputs.XZ_VERSION }} | |
env: | |
FORCE_COLOR: "1" | |
defaults: | |
run: | |
shell: bash | |
# Cancel active CI runs for a PR before starting another run | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
config: | |
runs-on: macOS-latest | |
outputs: | |
PYTHON_VER: ${{ steps.extract.outputs.PYTHON_VER }} | |
PYTHON_VERSION: ${{ steps.extract.outputs.PYTHON_VERSION }} | |
BUILD_NUMBER: ${{ steps.extract.outputs.BUILD_NUMBER }} | |
BZIP2_VERSION: ${{ steps.extract.outputs.BZIP2_VERSION }} | |
LIBFFI_VERSION: ${{ steps.extract.outputs.LIBFFI_VERSION }} | |
MPDECIMAL_VERSION: ${{ steps.extract.outputs.MPDECIMAL_VERSION }} | |
OPENSSL_VERSION: ${{ steps.extract.outputs.OPENSSL_VERSION }} | |
XZ_VERSION: ${{ steps.extract.outputs.XZ_VERSION }} | |
steps: | |
- uses: actions/[email protected] | |
- name: Extract config variables | |
id: extract | |
run: | | |
PYTHON_VER=$(make config | grep "PYTHON_VER=" | cut -d "=" -f 2) | |
PYTHON_VERSION=$(make config | grep "PYTHON_VERSION=" | cut -d "=" -f 2) | |
BZIP2_VERSION=$(make config | grep "BZIP2_VERSION=" | cut -d "=" -f 2) | |
LIBFFI_VERSION=$(make config | grep "LIBFFI_VERSION=" | cut -d "=" -f 2) | |
MPDECIMAL_VERSION=$(make config | grep "MPDECIMAL_VERSION=" | cut -d "=" -f 2) | |
OPENSSL_VERSION=$(make config | grep "OPENSSL_VERSION=" | cut -d "=" -f 2) | |
XZ_VERSION=$(make config | grep "XZ_VERSION=" | cut -d "=" -f 2) | |
if [ -z "${{ inputs.build-number }}" ]; then | |
BUILD_NUMBER=custom | |
else | |
BUILD_NUMBER=${{ inputs.build-number }} | |
fi | |
echo "PYTHON_VER=${PYTHON_VER}" | tee -a ${GITHUB_OUTPUT} | |
echo "PYTHON_VERSION=${PYTHON_VERSION}" | tee -a ${GITHUB_OUTPUT} | |
echo "BUILD_NUMBER=${BUILD_NUMBER}" | tee -a ${GITHUB_OUTPUT} | |
echo "BZIP2_VERSION=${BZIP2_VERSION}" | tee -a ${GITHUB_OUTPUT} | |
echo "LIBFFI_VERSION=${LIBFFI_VERSION}" | tee -a ${GITHUB_OUTPUT} | |
echo "MPDECIMAL_VERSION=${MPDECIMAL_VERSION}" | tee -a ${GITHUB_OUTPUT} | |
echo "OPENSSL_VERSION=${OPENSSL_VERSION}" | tee -a ${GITHUB_OUTPUT} | |
echo "XZ_VERSION=${XZ_VERSION}" | tee -a ${GITHUB_OUTPUT} | |
build: | |
runs-on: macOS-latest | |
needs: [ config ] | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ['macOS', 'iOS', 'tvOS', 'watchOS'] | |
include: | |
- briefcase-run-args: | |
- run-tests: false | |
- target: macOS | |
run-tests: true | |
- target: iOS | |
briefcase-run-args: ' -d "iPhone SE (3rd generation)"' | |
run-tests: true | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
# Appending -dev ensures that we can always build the dev release. | |
# It's a no-op for versions that have been published. | |
python-version: ${{ needs.config.outputs.PYTHON_VER }}-dev | |
- name: Build ${{ matrix.target }} | |
run: | | |
# Do the build for the requested target. | |
make ${{ matrix.target }} BUILD_NUMBER=${{ needs.config.outputs.BUILD_NUMBER }} | |
- name: Upload build artefacts | |
uses: actions/[email protected] | |
with: | |
name: Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz | |
path: dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz | |
- uses: actions/[email protected] | |
if: matrix.run-tests | |
with: | |
repository: beeware/Python-support-testbed | |
path: Python-support-testbed | |
# TODO - remove the py3.13 reference option. | |
ref: py3.13-support | |
- name: Install dependencies | |
if: matrix.run-tests | |
run: | | |
# TODO - Revert to the development version of Briefcase | |
# Use the development version of Briefcase | |
# python -m pip install git+https://github.com/beeware/briefcase.git | |
python -m pip install git+https://github.com/freakboy3742/briefcase.git@version-bumps | |
- name: Run support testbed check | |
if: matrix.run-tests | |
timeout-minutes: 10 | |
working-directory: Python-support-testbed | |
# TODO - remove the template_branch option. | |
run: briefcase run ${{ matrix.target }} Xcode --test ${{ matrix.briefcase-run-args }} -C support_package=\'../dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz\' -C template_branch=\'framework-lib\' |