Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Jan 19, 2024
1 parent 17b0304 commit 7b24dbf
Show file tree
Hide file tree
Showing 2 changed files with 190 additions and 4 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/dev-workflow-p1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ jobs:
secrets: inherit

test-with-server-rc:
needs: test-with-server-release
if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
uses: ./.github/workflows/build-wheels.yml
with:
run_tests: true
use-server-rc: true
uses: ./.github/workflows/test-server-rc.yml
secrets: inherit
188 changes: 188 additions & 0 deletions .github/workflows/test-server-rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: Test cibuildwheel artifacts against server RC
run-name: Test cibuildwheel artifacts against server RC

on:
workflow_call:
secrets:
DOCKER_HUB_BOT_USERNAME:
required: true
DOCKER_HUB_BOT_PW:
required: true
MAC_M1_SELF_HOSTED_RUNNER_PW:
required: true

jobs:
manylinux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Python versions to build wheels on
python: [
["3.8", "cp38"],
["3.9", "cp39"],
["3.10", "cp310"],
["3.11", "cp311"]
]
platform: [
"x86_64",
"aarch64"
]

steps:
- uses: actions/checkout@v4

- name: Set up QEMU for cross compiling arm64
if: ${{ matrix.platform == 'aarch64' }}
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- run: docker run -d --name manylinux quay.io/pypa/manylinux2014_${{ matrix.platform }} tail -f /dev/null

- uses: ./.github/actions/run-ee-server
with:
use-server-rc: true
server-tag: latest
docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }}

- name: Wait for server to be ready
run: sleep 5

- uses: actions/download-artifact@v4
with:
name: ${{ matrix.python[1] }}-manylinux_${{ matrix.platform }}.build
path: ./

- name: Set config.conf to use Docker IP address of Aerospike server
# config.conf should be copied into the cibuildwheel Docker container
run: |
export SERVER_DOCKER_IP=$(docker container inspect -f '{{ .NetworkSettings.IPAddress }}' aerospike)
# Install crudini
pip install crudini -c ../.github/workflows/requirements.txt
sed -i "s/127.0.0.1:3000//" config.conf
crudini --set config.conf enterprise-edition hosts ${SERVER_DOCKER_IP}:3000
working-directory: test

- name: Copy repo and wheel into manylinux container
run: docker cp ../aerospike-client-python manylinux:/

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

- name: Install test prerequisites
run: docker exec --workdir /aerospike-client-python/test manylinux python${{ matrix.python[0] }} -m pip install -r requirements.txt

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

macOS-x86:
strategy:
fail-fast: false
matrix:
python: [
["3.8", "cp38"],
["3.9", "cp39"],
["3.10", "cp310"],
["3.11", "cp311"]
]
runs-on: macos-12-large
steps:
- uses: actions/checkout@v4

- name: Install Docker Engine
run: brew install colima

- name: Install Docker client
run: brew install docker

- name: Start Docker Engine
run: colima start

- uses: ./.github/actions/run-ee-server
with:
use-server-rc: true
server-tag: latest
docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }}

- name: Wait for server to be ready
run: sleep 5

- uses: actions/download-artifact@v4
with:
name: ${{ matrix.python[1] }}-macosx_x86_64.build
path: ./

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python[0] }}

- run: python${{ matrix.python[0] }} -m pip install *.whl

- run: python${{ matrix.python[0] }} -m pip install -r requirements.txt
working-directory: test

- run: python${{ matrix.python[0] }} -m pytest new_tests/
id: test
working-directory: test

macOS-m1:
runs-on: [
self-hosted,
macOS,
ARM64
]
strategy:
matrix:
python-version: [
["3.8", "cp38"],
["3.9", "cp39"],
["3.10", "cp310"],
["3.11", "cp311"]
]
fail-fast: false
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: ${{ matrix.python-version[1] }}-macosx_arm64.build
path: ./

# Update dependencies if needed
- name: Add brew to path
run: echo PATH=$PATH:/opt/homebrew/bin/ >> $GITHUB_ENV

- name: Install or upgrade Python
run: brew install python@${{ matrix.python-version[0] }}

# Self-hosted runner only
# Need to be able to save Docker Hub credentials to keychain
- run: security unlock-keychain -p ${{ secrets.MAC_M1_SELF_HOSTED_RUNNER_PW }}

- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
password: ${{ secrets.DOCKER_HUB_BOT_PW }}

- name: Run server RC
run: docker run -d -p 3000:3000 --name aerospike ${{ vars.SERVER_RC_REPO_LINK }}

- name: Wait for server to be ready
run: sleep 5

- run: python${{ matrix.python-version[0] }} -m pip install -r requirements.txt
working-directory: test

- run: python${{ matrix.python-version[0] }} -m pytest new_tests/
id: test
working-directory: test

- name: Stop server
if: ${{ always() }}
run: |
docker container stop aerospike
docker container prune -f

0 comments on commit 7b24dbf

Please sign in to comment.