From ecf9a7f9e697e5146297cabcf7bfd6946a1dd9ce Mon Sep 17 00:00:00 2001 From: sujeito-operator Date: Mon, 24 Aug 2026 01:56:52 +0300 Subject: [PATCH] CI: collapse macos_build and ubuntu_build into a single job Co-Authored-By: Ivan Pozdeev --- .github/actions/build-python/action.yml | 47 +++++++++++++++++++++++++ .github/workflows/build.yml | 37 +++++++++++++++++++ .github/workflows/macos_build.yml | 43 ---------------------- .github/workflows/ubuntu_build.yml | 43 ---------------------- 4 files changed, 84 insertions(+), 86 deletions(-) create mode 100644 .github/actions/build-python/action.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/macos_build.yml delete mode 100644 .github/workflows/ubuntu_build.yml diff --git a/.github/actions/build-python/action.yml b/.github/actions/build-python/action.yml new file mode 100644 index 00000000..253d99bd --- /dev/null +++ b/.github/actions/build-python/action.yml @@ -0,0 +1,47 @@ +name: Build a Python version +description: > + Install python-build's system dependencies for the current runner's OS, build + the requested version from source with `pyenv install`, and check that the + interpreter that comes out is the one that was asked for. +inputs: + python-version: + description: A version as accepted by `pyenv install`. + required: true +runs: + using: composite + steps: + # The two OSes differ only in this step. + - if: runner.os == 'macOS' + shell: bash + run: | + #prerequisites + brew install openssl readline sqlite3 xz tcl-tk@8 libb2 zstd + - if: runner.os == 'Linux' + shell: bash + run: | + #prerequisites + sudo apt-get update -q; sudo apt install -yq make build-essential libssl-dev zlib1g-dev \ + libbz2-dev libreadline-dev libsqlite3-dev curl \ + libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev + - shell: bash + run: | + #envvars + export PYENV_ROOT="$GITHUB_WORKSPACE" + echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV + echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH + - shell: bash + run: | + #build + pyenv --debug install ${{ inputs.python-version }} && rc=$? || rc=$? + if [[ $rc -ne 0 ]]; then echo config.log:; cat "${TMPDIR:-/tmp}"/python-build*/*/config.log; false; fi + pyenv global ${{ inputs.python-version }} + pyenv rehash + - shell: bash + run: | + #print version + python --version + python -m pip --version + - shell: python # Prove that actual Python == expected Python + env: + EXPECTED_PYTHON: ${{ inputs.python-version }} + run: import os, sys ; assert sys.version.startswith(os.getenv("EXPECTED_PYTHON")) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..ad0f4ee1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,37 @@ +name: build +on: + push: + branches: [master] + pull_request: {} + +permissions: + contents: read + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: + - macos-14 + - macos-15 + - macos-15-intel + - macos-26 + - macos-26-intel + - ubuntu-22.04 + - ubuntu-22.04-arm + - ubuntu-24.04 + - ubuntu-24.04-arm + python-version: + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + - uses: ./.github/actions/build-python + with: + python-version: ${{ matrix.python-version }} + diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml deleted file mode 100644 index b30511ac..00000000 --- a/.github/workflows/macos_build.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: macos_build -on: - push: - branches: [master] - pull_request: {} - -permissions: - contents: read # to fetch code (actions/checkout) - -jobs: - macos_build: - strategy: - fail-fast: false - matrix: - python-version: - - "3.10" - - "3.11" - - "3.12" - - "3.13" - - "3.14" - runs-on: macos-latest - steps: - - uses: actions/checkout@v7 - - run: | - brew install openssl readline sqlite3 xz tcl-tk@8 libb2 zstd - - run: | - #envvars - export PYENV_ROOT="$GITHUB_WORKSPACE" - echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV - echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH - - run: | - #build - pyenv --debug install ${{ matrix.python-version }} && rc=$? || rc=$? - if [[ $rc -ne 0 ]]; then echo config.log:; cat $TMPDIR/python-build*/*/config.log; false; fi - pyenv global ${{ matrix.python-version }} - - run: | - #print version - python --version - python -m pip --version - - shell: python # Prove that actual Python == expected Python - env: - EXPECTED_PYTHON: ${{ matrix.python-version }} - run: import os, sys ; assert sys.version.startswith(os.getenv("EXPECTED_PYTHON")) diff --git a/.github/workflows/ubuntu_build.yml b/.github/workflows/ubuntu_build.yml deleted file mode 100644 index 697f4bd7..00000000 --- a/.github/workflows/ubuntu_build.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: ubuntu_build -on: - push: - branches: [master] - pull_request: {} - -permissions: - contents: read # to fetch code (actions/checkout) - -jobs: - ubuntu_build: - strategy: - fail-fast: false - matrix: - python-version: - - "3.10" - - "3.11" - - "3.12" - - "3.13" - - "3.14" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - - run: | - sudo apt-get update -q; sudo apt install -yq make build-essential libssl-dev zlib1g-dev \ - libbz2-dev libreadline-dev libsqlite3-dev curl \ - libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev - # https://github.com/pyenv/pyenv#installation - - run: pwd - - env: - PYENV_ROOT: /home/runner/work/pyenv/pyenv - run: | - echo $PYENV_ROOT - echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH - bin/pyenv --debug install ${{ matrix.python-version }} - bin/pyenv global ${{ matrix.python-version }} - bin/pyenv rehash - - run: python --version - - run: python -m pip --version - - shell: python # Prove that actual Python == expected Python - env: - EXPECTED_PYTHON: ${{ matrix.python-version }} - run: import os, sys ; assert sys.version.startswith(os.getenv("EXPECTED_PYTHON"))