Skip to content

Commit

Permalink
just link python version and distro together
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Jun 20, 2024
1 parent bc6696a commit 7c2900b
Showing 1 changed file with 24 additions and 28 deletions.
52 changes: 24 additions & 28 deletions .github/workflows/stage-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,18 @@ jobs:
["x86_64", "linux/amd64"],
["aarch64", "linux/arm64"],
]
include:
- distro: amazonlinux:2023
python-version: ["3.9", "cp39"]
- distro: amazonlinux:2023
python-version: ["3.11", "cp311"]
- distro: ubuntu:22.04
python-version: ["3.10", "cp310"]
- distro: python:3.8
python-version: ["3.8", "cp38"]
- distro: python:3.9
python-version: ["3.9", "cp39"]
- distro: python:3.10
python-version: ["3.10", "cp310"]
- distro: python:3.11
python-version: ["3.11", "cp311"]
- distro: python:3.12
python-version: ["3.12", "cp312"]
distro-python: [
# Docker image + tag, Python version, Python tag
["amazonlinux:2023", ["3.9", "cp39"]],
["amazonlinux:2023", ["3.11", "cp311"]],
["ubuntu:22.04", ["3.10", "cp310"]],
# Debian 12 (bookworm)
["python:3.8-bookworm", ["3.8", "cp38"]],
["python:3.9-bookworm", ["3.9", "cp39"]],
["python:3.10-bookworm", ["3.10", "cp310"]],
["python:3.11-bookworm", ["3.11", "cp311"]],
["python:3.12-bookworm", ["3.12", "cp312"]]
]
fail-fast: false
runs-on: ubuntu-22.04
steps:
Expand All @@ -147,7 +142,7 @@ jobs:
- uses: actions/download-artifact@v4
if: ${{ !inputs.use_jfrog_builds }}
with:
name: ${{ matrix.python-version[1] }}-manylinux_${{ matrix.platform[0] }}.build
name: ${{ matrix.distro-python[1][1] }}-manylinux_${{ matrix.platform[0] }}.build

- uses: jfrog/setup-jfrog-cli@v4
if: ${{ inputs.use_jfrog_builds }}
Expand All @@ -157,7 +152,8 @@ jobs:

- name: Download JFrog build
if: ${{ inputs.use_jfrog_builds }}
run: jf rt dl --flat --build python-client/${{ inputs.jfrog-build-version-to-test }} "${{ vars.JFROG_REPO_NAME }}/**/*${{ matrix.python-version[1] }}*manylinux*${{ matrix.platform[0] }}.whl"
# The wheel file name doesn't always exactly match the build identifier
run: jf rt dl --flat --build python-client/${{ inputs.jfrog-build-version-to-test }} "${{ vars.JFROG_REPO_NAME }}/**/*${{ matrix.distro-python[1][1] }}*manylinux*${{ matrix.platform[0] }}.whl"

- name: Set up QEMU for cross compiling arm64
if: ${{ matrix.platform[0] == 'aarch64' }}
Expand All @@ -177,36 +173,36 @@ jobs:

- name: Run distro container
# Run distro container on host network to access the server Docker container using localhost
run: docker run --name ${{ env.DISTRO_CONTAINER_NAME }} --platform ${{ matrix.platform[1] }} --network host --detach ${{ matrix.distro }} tail -f /dev/null
run: docker run --name ${{ env.DISTRO_CONTAINER_NAME }} --platform ${{ matrix.platform[1] }} --network host --detach ${{ matrix.distro-python[0] }} tail -f /dev/null

- name: Copy repo to container
run: docker cp . ${{ env.DISTRO_CONTAINER_NAME }}:/aerospike-client-python

- name: 'Amazon Linux 2023: install python 3.11 if applicable'
if: ${{ matrix.distro == 'amazonlinux:2023' && matrix.python-version[0] == '3.11' }}
if: ${{ matrix.distro-python[0] == 'amazonlinux:2023' && matrix.distro-python[1][0] == '3.11' }}
run: docker exec ${{ env.DISTRO_CONTAINER_NAME }} yum install -y python3.11

- name: 'Ubuntu 22.04 Install python 3.10 that comes by default (step 1)'
if: ${{ matrix.distro == 'ubuntu:22.04' }}
if: ${{ matrix.distro-python[0] == 'ubuntu:22.04' }}
run: docker exec ${{ env.DISTRO_CONTAINER_NAME }} apt update

- name: 'Ubuntu 22.04 Install python 3.10 that comes by default (step 2)'
if: ${{ matrix.distro == 'ubuntu:22.04' }}
if: ${{ matrix.distro-python[0] == 'ubuntu:22.04' }}
run: docker exec ${{ env.DISTRO_CONTAINER_NAME }} apt install python3 python3-pip -y

- name: Make sure pip is installed
if: ${{ matrix.distro == 'amazonlinux:2023' || startsWith(matrix.distro, 'python') }}
run: docker exec ${{ env.DISTRO_CONTAINER_NAME }} python${{ matrix.python-version[0] }} -m ensurepip
if: ${{ matrix.distro-python[0] == 'amazonlinux:2023' || startsWith(matrix.distro-python[0], 'python') }}
run: docker exec ${{ env.DISTRO_CONTAINER_NAME }} python${{ matrix.distro-python[1][0] }} -m ensurepip

- name: Install wheel
run: docker exec --workdir /aerospike-client-python/ ${{ env.DISTRO_CONTAINER_NAME }} python${{ matrix.python-version[0] }} -m pip install *.whl
run: docker exec --workdir /aerospike-client-python/ ${{ env.DISTRO_CONTAINER_NAME }} python${{ matrix.distro-python[1][0] }} -m pip install *.whl

- name: Install pytest
run: docker exec --workdir /aerospike-client-python/test ${{ env.DISTRO_CONTAINER_NAME }} python${{ matrix.python-version[0] }} -m pip install pytest -c requirements.txt
run: docker exec --workdir /aerospike-client-python/test ${{ env.DISTRO_CONTAINER_NAME }} python${{ matrix.distro-python[1][0] }} -m pip install pytest -c requirements.txt

- name: Run tests
id: test
run: docker exec --workdir /aerospike-client-python/test ${{ env.DISTRO_CONTAINER_NAME }} python${{ matrix.python-version[0] }} -m pytest new_tests/
run: docker exec --workdir /aerospike-client-python/test ${{ env.DISTRO_CONTAINER_NAME }} python${{ matrix.distro-python[1][0] }} -m pytest new_tests/

macOS:
if: ${{ inputs.test-macos-x86 }}
Expand Down

0 comments on commit 7c2900b

Please sign in to comment.