diff --git a/.github/workflows/test-server-rc.yml b/.github/workflows/test-server-rc.yml new file mode 100644 index 0000000000..2efa03e711 --- /dev/null +++ b/.github/workflows/test-server-rc.yml @@ -0,0 +1,227 @@ +name: Test cibuildwheel artifacts against server RC +run-name: Test cibuildwheel artifacts against server RC + +on: + workflow_call: + inputs: + commit_sha: + type: string + required: false + build-number: + type: string + required: true + description: 'Build number to label in JFrog' + secrets: + JFROG_PLATFORM_URL: + required: true + JFROG_ACCESS_TOKEN: + required: true + 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 + with: + ref: ${{ inputs.commit_sha }} + + - 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/ + + - uses: ./.github/actions/label-jfrog-build + with: + JFROG_PLATFORM_URL: ${{ secrets.JFROG_PLATFORM_URL }} + JFROG_ACCESS_TOKEN: ${{ secrets.JFROG_ACCESS_TOKEN }} + build-number: ${{ inputs.build-number }} + property-name: 'server-rc-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 + with: + ref: ${{ inputs.commit_sha }} + + - 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 + + - uses: ./.github/actions/label-jfrog-build + with: + JFROG_PLATFORM_URL: ${{ secrets.JFROG_PLATFORM_URL }} + JFROG_ACCESS_TOKEN: ${{ secrets.JFROG_ACCESS_TOKEN }} + build-number: ${{ inputs.build-number }} + property-name: 'server-rc-tests' + + 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 + with: + ref: ${{ inputs.commit_sha }} + + - 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 + + - uses: ./.github/actions/label-jfrog-build + with: + JFROG_PLATFORM_URL: ${{ secrets.JFROG_PLATFORM_URL }} + JFROG_ACCESS_TOKEN: ${{ secrets.JFROG_ACCESS_TOKEN }} + build-number: ${{ inputs.build-number }} + property-name: 'server-rc-tests' + + - name: Stop server + if: ${{ always() }} + run: | + docker container stop aerospike + docker container prune -f