From ae3c118a9b6447556656134d2b45041d4dba6fbb Mon Sep 17 00:00:00 2001 From: Leo Romanovsky Date: Mon, 25 Nov 2024 15:19:14 -0800 Subject: [PATCH] chore: upgrade deprecated macos-12 builds to macos-latest; expand matrix testing --- .github/workflows/python.yml | 111 ++++++++++++++++------------------- 1 file changed, 50 insertions(+), 61 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index a52361cc..09d153e4 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -23,35 +23,26 @@ permissions: jobs: linux: - runs-on: ${{ matrix.platform.runner }} + runs-on: ${{ matrix.runner }} strategy: + fail-fast: false matrix: - platform: - - runner: ubuntu-latest - target: x86_64 - - runner: ubuntu-latest - target: x86 - - runner: ubuntu-latest - target: aarch64 - - runner: ubuntu-latest - target: armv7 - - runner: ubuntu-latest - target: s390x - - runner: ubuntu-latest - target: ppc64le + runner: [ubuntu-latest] + target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] + python-version: ["3.12"] steps: - uses: actions/checkout@v4 with: submodules: true - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: ${{ matrix.python-version }} - name: Build wheels uses: PyO3/maturin-action@v1 - if: ${{ startsWith(matrix.platform.target, 'x86') }} + if: ${{ startsWith(matrix.target, 'x86') }} with: - target: ${{ matrix.platform.target }} + target: ${{ matrix.target }} args: --release --out dist --find-interpreter --manifest-path ./python-sdk/Cargo.toml sccache: 'true' manylinux: auto @@ -59,9 +50,9 @@ jobs: yum install -y perl-IPC-Cmd devtoolset-10-libatomic-devel - name: Build wheels uses: PyO3/maturin-action@v1 - if: ${{ !startsWith(matrix.platform.target, 'x86') }} + if: ${{ !startsWith(matrix.target, 'x86') }} with: - target: ${{ matrix.platform.target }} + target: ${{ matrix.target }} args: --release --out dist --find-interpreter --manifest-path ./python-sdk/Cargo.toml sccache: 'true' manylinux: auto @@ -72,11 +63,11 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-linux-${{ matrix.platform.target }} + name: wheels-linux-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.python-version }} path: dist - name: pytest - if: ${{ startsWith(matrix.platform.target, 'x86_64') }} + if: ${{ startsWith(matrix.target, 'x86_64') }} shell: bash run: | set -ex @@ -87,10 +78,10 @@ jobs: npm ci npm run with-server test:python - name: pytest - if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }} + if: ${{ !startsWith(matrix.target, 'x86') && matrix.target != 'ppc64' }} uses: uraimo/run-on-arch-action@v2 with: - arch: ${{ matrix.platform.target }} + arch: ${{ matrix.target }} distro: ubuntu22.04 githubToken: ${{ github.token }} install: | @@ -104,39 +95,34 @@ jobs: npm run with-server test:python musllinux: - runs-on: ${{ matrix.platform.runner }} + runs-on: ${{ matrix.runner }} strategy: + fail-fast: false matrix: - platform: - - runner: ubuntu-latest - target: x86_64 - - runner: ubuntu-latest - target: x86 - - runner: ubuntu-latest - target: aarch64 - - runner: ubuntu-latest - target: armv7 + runner: [ubuntu-latest] + target: [x86_64, x86, aarch64, armv7] + python-version: ["3.12"] steps: - uses: actions/checkout@v4 with: submodules: true - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: ${{ matrix.python-version }} - name: Build wheels uses: PyO3/maturin-action@v1 with: - target: ${{ matrix.platform.target }} + target: ${{ matrix.target }} args: --release --out dist --find-interpreter --manifest-path ./python-sdk/Cargo.toml sccache: 'true' manylinux: musllinux_1_2 - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-musllinux-${{ matrix.platform.target }} + name: wheels-musllinux-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.python-version }} path: dist - name: pytest - if: ${{ startsWith(matrix.platform.target, 'x86_64') }} + if: ${{ startsWith(matrix.target, 'x86_64') }} uses: addnab/docker-run-action@v3 with: image: alpine:latest @@ -154,10 +140,10 @@ jobs: # `npm ci` just hangs on Alpine armv7 now. # Disabling tests until this issue is fixed: # https://github.com/nodejs/docker-node/issues/1829 - if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'armv7' }} + if: ${{ !startsWith(matrix.target, 'x86') && matrix.target != 'armv7' }} uses: uraimo/run-on-arch-action@v2 with: - arch: ${{ matrix.platform.target }} + arch: ${{ matrix.target }} distro: alpine_latest githubToken: ${{ github.token }} install: | @@ -172,35 +158,34 @@ jobs: npm run with-server test:python windows: - runs-on: ${{ matrix.platform.runner }} + runs-on: ${{ matrix.runner }} strategy: + fail-fast: false matrix: - platform: - - runner: windows-latest - target: x64 - - runner: windows-latest - target: x86 + runner: [windows-latest] + target: [x64, x86] + python-version: ["3.12"] steps: - uses: actions/checkout@v4 with: submodules: true - uses: actions/setup-python@v5 with: - python-version: 3.x - architecture: ${{ matrix.platform.target }} + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.target }} - name: Build wheels uses: PyO3/maturin-action@v1 with: - target: ${{ matrix.platform.target }} + target: ${{ matrix.target }} args: --release --out dist --find-interpreter --manifest-path ./python-sdk/Cargo.toml sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-windows-${{ matrix.platform.target }} + name: wheels-windows-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.python-version }} path: dist - name: pytest - if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} + if: ${{ !startsWith(matrix.target, 'aarch64') }} shell: bash run: | set -ex @@ -212,39 +197,43 @@ jobs: npm run with-server test:python macos: - runs-on: ${{ matrix.platform.runner }} + runs-on: ${{ matrix.runner }} strategy: + fail-fast: false matrix: - platform: - - runner: macos-12 - target: x86_64 - # - runner: macos-14 - # target: aarch64 + runner: [macos-latest] + target: [aarch64] # x86_64 + python-version: ["3.12"] steps: - uses: actions/checkout@v4 with: submodules: true - uses: actions/setup-python@v5 with: - python-version: 3.x + python-version: ${{ matrix.python-version }} - name: Build wheels uses: PyO3/maturin-action@v1 with: - target: ${{ matrix.platform.target }} + target: ${{ matrix.target }} args: --release --out dist --find-interpreter --manifest-path ./python-sdk/Cargo.toml sccache: 'true' - - name: List dist directory - run: ls -l dist + - name: Debug dist contents + run: | + echo "Contents of dist directory:" + ls -la dist/ + echo "File details:" + file dist/* - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-macos-${{ matrix.platform.target }} + name: wheels-macos-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.python-version }} path: dist - name: pytest run: | set -ex python3 -m venv .venv source .venv/bin/activate + python --version pip install --upgrade pip pip install eppo-server-sdk --no-index --find-links dist --force-reinstall -v pip install pytest cachetools