Cache linux dependency download #1
Workflow file for this run
This file contains hidden or 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 | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| changed-files: | ||
| required: true | ||
| type: string | ||
| description: Build relenv python builds | ||
| jobs: | ||
| download-dependencies: | ||
| runs-on: | ||
| - ubuntu-24.04 | ||
| strategy: | ||
| fail-fast: true | ||
| env: | ||
| RELENV_DATA: ${{ github.workspace }} | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up Python 3.11 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Install Dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y python3-virtualenv | ||
| virtualenv venv | ||
| venv/bin/python3 -m pip install nox ppbt | ||
| - name: Download Dependencies | ||
| run: | | ||
| venv/bin/python3 -m relenv build --download-only | ||
| - name: Cache Dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ github.workspace }}/download | ||
| key: ${{ github.run_id }}-dependencies | ||
| build_linux: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - 3.10.18 | ||
| - 3.11.13 | ||
| - 3.12.11 | ||
| - 3.13.5 | ||
| host: | ||
| - x86_64 | ||
| - aarch64 | ||
| include: | ||
| - host: x86_64 | ||
| target: x86_64 | ||
| - host: aarch64 | ||
| target: aarch64 | ||
| needs: | ||
| - download-depedencies | ||
| name: "Python ${{ matrix.version }} Linux ${{ matrix.target }} on ${{ matrix.host }}" | ||
| runs-on: | ||
| - ${{ (contains(matrix.host, 'x86_64') && 'ubuntu-24.04') || 'ubuntu-24.04-arm' }} | ||
| env: | ||
| RELENV_DATA: ${{ github.workspace }} | ||
| steps: | ||
| - name: "Throttle Builds" | ||
| shell: bash | ||
| run: | | ||
| t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(0, 600)))'); echo "Sleeping $t seconds"; sleep "$t" | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up Python 3.10 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.10' | ||
| - name: Install Dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential bison python3-all patchelf swig cmake libldap2-dev libsasl2-dev ldap-utils libssl-dev pkg-config libvirt-dev default-libmysqlclient-dev python3-virtualenv | ||
| virtualenv venv | ||
| venv/bin/python3 -m pip install nox ppbt | ||
| - name: Python Version | ||
| run: | | ||
| venv/bin/python3 --version | ||
| venv/bin/python3 -c 'import os; print(os.name)' | ||
| - name: Restore Cached Dependencies | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: ${{ github.workspace }}/download | ||
| key: ${{ github.run_id }}-dependencies | ||
| - name: Build | ||
| run: | | ||
| venv/bin/python3 -m relenv build --no-pretty --arch=${{ matrix.target }} --python=${{ matrix.version }} | ||
| - name: Linux Logs | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: ${{ matrix.version }}-${{ matrix.host }}-${{ matrix.target }}-linux-gnu-logs | ||
| path: logs/* | ||
| retention-days: 5 | ||
| - name: "Upload artifact: build/${{ matrix.version }}-${{ matrix.target }}-linux-gnu.tar.xz" | ||
| uses: actions/upload-artifact@v4 | ||
| if: ${{ matrix.host == matrix.target && always() }} | ||
| with: | ||
| name: ${{ matrix.version }}-${{ matrix.target }}-linux-gnu.tar.xz | ||
| path: build/${{ matrix.version }}-${{ matrix.target }}-linux-gnu.tar.xz | ||
| retention-days: 5 | ||
| build_macos_12_x86_64: | ||
| name: "Python macOS" | ||
| runs-on: macos-13 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - 3.10.18 | ||
| - 3.11.13 | ||
| - 3.12.11 | ||
| - 3.13.5 | ||
| arch: | ||
| - x86_64 | ||
| env: | ||
| RELENV_DATA: ${{ github.workspace }} | ||
| needs: | ||
| - download-dependencies | ||
| steps: | ||
| - name: "Throttle Builds" | ||
| shell: bash | ||
| run: | | ||
| t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(0, 600)))'); echo "Sleeping $t seconds"; sleep "$t" | ||
| - uses: actions/checkout@v3 | ||
| - name: Patch /usr/local | ||
| run: | | ||
| sudo mkdir /tmp/local | ||
| sudo mv -f /usr/local/* /tmp/local/ | ||
| - name: Set up Python 3.11 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Show environment | ||
| run: | | ||
| env | ||
| - name: Install nox | ||
| run: | | ||
| pip3 install nox | ||
| - name: Restore Cached Dependencies | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: ${{ github.workspace }}/download | ||
| key: ${{ github.run_id }}-dependencies | ||
| - name: Build | ||
| run: | | ||
| python3 -m relenv build --no-pretty --python=${{ matrix.version }} | ||
| - name: MacOS Logs | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: ${{ matrix.version }}-${{ matrix.arch }}-macos-logs | ||
| path: logs/* | ||
| retention-days: 5 | ||
| - name: "Upload artifact: build/${{ matrix.version }}-${{ matrix.arch }}-macos.tar.xz" | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.version }}-${{ matrix.arch }}-macos.tar.xz | ||
| path: build/${{ matrix.version }}-${{ matrix.arch }}-macos.tar.xz | ||
| retention-days: 5 | ||
| build_macos_13_arm64: | ||
| name: "Python macOS" | ||
| runs-on: macos-15 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - 3.10.18 | ||
| - 3.11.13 | ||
| - 3.12.11 | ||
| - 3.13.5 | ||
| arch: | ||
| - arm64 | ||
| env: | ||
| RELENV_DATA: ${{ github.workspace }} | ||
| needs: | ||
| - download-dependencies | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Patch include | ||
| run: | | ||
| sudo mkdir /tmp/local | ||
| sudo mv -f /usr/local/* /tmp/local/ | ||
| - name: Set up Python 3.11 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Show environment | ||
| run: | | ||
| env | ||
| - name: Install nox | ||
| run: | | ||
| brew install nox | ||
| - name: Restore Cached Dependencies | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: ${{ github.workspace }}/download | ||
| key: ${{ github.run_id }}-dependencies | ||
| - name: Build | ||
| run: | | ||
| python3 -m relenv build --no-pretty --python=${{ matrix.version }} | ||
| - name: MacOS Logs | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: ${{ matrix.version }}-${{ matrix.arch }}-macos-logs | ||
| path: logs/* | ||
| retention-days: 5 | ||
| - name: Python build | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.version }}-${{ matrix.arch }}-macos.tar.xz | ||
| path: build/${{ matrix.version }}-${{ matrix.arch }}-macos.tar.xz | ||
| retention-days: 5 | ||
| build_windows: | ||
| name: "Python Windows" | ||
| runs-on: windows-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - 3.10.18 | ||
| - 3.11.13 | ||
| - 3.12.11 | ||
| - 3.13.5 | ||
| arch: | ||
| - amd64 | ||
| - x86 | ||
| env: | ||
| RELENV_DATA: ${{ github.workspace }} | ||
| steps: | ||
| - name: "Throttle Builds" | ||
| shell: bash | ||
| run: | | ||
| t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(0, 600)))'); echo "Sleeping $t seconds"; sleep "$t" | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up Python 3.10 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.10' | ||
| - name: Install VS Build Tools | ||
| run: | | ||
| relenv/_scripts/install_vc_build.ps1 -CICD | ||
| - name: Install nox | ||
| run: | | ||
| pip3 install nox | ||
| - name: Fetch Native Build | ||
| if: ${{ matrix.arch != 'amd64' }} | ||
| env: | ||
| RELENV_FETCH_VERSION: 0.18.0 | ||
| run: | | ||
| python3 -m relenv fetch --python=3.10.15 | ||
| - name: Build Python with Relenv | ||
| env: | ||
| RELENV_NATIVE_PY_VERSION: 3.10.15 | ||
| run: | | ||
| python -m relenv build --no-pretty --arch=${{ matrix.arch }} --python=${{ matrix.version }} | ||
| - name: Upload Build Logs | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: ${{ matrix.version }}-${{ matrix.arch }}-windows-logs | ||
| path: logs/* | ||
| retention-days: 5 | ||
| - name: Upload Zipfile | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.version }}-${{ matrix.arch }}-win.tar.xz | ||
| path: build/${{ matrix.version }}-${{ matrix.arch }}-win.tar.xz | ||
| retention-days: 5 | ||