Build bindings (run_tests=, use-server-rc=, server-tag=) #20
Workflow file for this run
This file contains 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 binding | |
run-name: Build bindings (run_tests=${{ inputs.run_tests }}, use-server-rc=${{ inputs.use-server-rc }}, server-tag=${{ inputs.server-tag }}) | |
# Builds manylinux bindings and source distribution | |
# If running tests, publish results in commit status | |
# Publishes bindings and source distribution on Github Actions if no tests are run or tests pass | |
on: | |
push: | |
branches: ["stage", "master"] | |
pull_request: | |
branches: ["stage"] | |
types: [ | |
# Default triggers | |
opened, | |
synchronize, | |
reopened, | |
# Additional triggers | |
labeled, | |
unlabeled | |
] | |
workflow_call: | |
inputs: | |
# The dev tests test the artifacts against a server release | |
# The stage tests and release workflow only need to build the artifacts | |
run_tests: | |
description: "Run integration tests" | |
required: true | |
type: boolean | |
default: true | |
commit_sha: | |
type: string | |
required: false | |
# Calling workflow doesn't actually use these 2 options | |
# But we need to set default values for workflow calls | |
use-server-rc: | |
required: false | |
default: true | |
type: boolean | |
server-tag: | |
type: string | |
required: false | |
default: 'latest' | |
secrets: | |
DOCKER_HUB_BOT_USERNAME: | |
required: false | |
DOCKER_HUB_BOT_PW: | |
required: false | |
MAC_M1_SELF_HOSTED_RUNNER_PW: | |
required: false | |
workflow_dispatch: | |
inputs: | |
# If we only want to check that the builds pass on an arbitrary branch | |
run_tests: | |
description: "Run integration tests" | |
required: true | |
type: boolean | |
default: true | |
use-server-rc: | |
type: boolean | |
required: true | |
default: false | |
description: 'Test against server release candidate?' | |
# If we are creating a backport and want to test an arbitrary branch against an older server version | |
server-tag: | |
required: true | |
default: 'latest' | |
description: 'Server docker image tag' | |
jobs: | |
manylinux: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
# nodejs versions to build bindings on | |
nodejs: [ | |
"v108", | |
"v115", | |
"v120" | |
] | |
platform: [ | |
"x86_64", | |
"aarch64" | |
] | |
steps: | |
- name: Show job status for commit | |
uses: myrotvorets/[email protected] | |
with: | |
sha: ${{ github.sha }} | |
context: "Build bindings (${{ matrix.nodejs }}-manylinux_${{ matrix.platform }})" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
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 | |
- uses: ./.github/actions/run-ee-server | |
if: ${{ inputs.run_tests }} | |
with: | |
use-server-rc: ${{ inputs.use-server-rc }} | |
server-tag: ${{ inputs.server-tag }} | |
docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} | |
docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} | |
- name: Set config.conf to use Docker IP address of Aerospike server | |
if: ${{ inputs.run_tests }} | |
# 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: Enable tests | |
if: ${{ inputs.run_tests }} | |
run: echo "TEST_COMMAND=npm test -- --h 172.17.0.2 --port 3000" >> $GITHUB_ENV | |
- name: Disable tests (only run basic import test) | |
if: ${{ !inputs.run_tests }} | |
run: echo "TEST_COMMAND=node -e 'aerospike = require(\".\/lib\/aerospike\")'" >> $GITHUB_ENV | |
- run: sudo apt update | |
- name: Install build dependencies (C Client dependency packages) | |
run: sudo apt install g++ libssl-dev zlib1g-dev; | |
- name: Install build dependencies (make) | |
run: sudo apt-get install -y make; | |
- name: Install build dependencies (make) | |
run: sudo apt install build-essential; | |
- name: Build client | |
run: | | |
./scripts/build-c-client.sh | |
npm install | |
env: | |
CFLAGS: '-Werror' | |
- name: Test client | |
run: | | |
${{ env.TEST_COMMAND }} | |
- name: Send binding to test jobs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.nodejs }}-manylinux_${{ matrix.platform }}.build} | |
path: ./lib/binding/node-*-linux-*/ | |
- name: Set final commit status | |
uses: myrotvorets/[email protected] | |
if: always() | |
with: | |
sha: ${{ github.sha }} | |
status: ${{ job.status }} | |
context: "Build bindings (${{ matrix.nodejs }}-manylinux_${{ matrix.platform }})" | |
macOS-x86: | |
strategy: | |
fail-fast: false | |
matrix: | |
nodejs: [ | |
"v108", | |
"v115", | |
"v120" | |
] | |
runs-on: macos-12-large | |
steps: | |
- name: Show job status for commit | |
uses: myrotvorets/[email protected] | |
with: | |
sha: ${{ github.sha }} | |
context: "Build bindings (${{ matrix.nodejs }}-macosx_x86_64)" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
ref: ${{ inputs.commit_sha }} | |
- name: Install Docker Engine | |
if: ${{ inputs.run_tests }} | |
run: brew install colima | |
- name: Install Docker client | |
if: ${{ inputs.run_tests }} | |
run: brew install docker | |
- name: Start Docker Engine | |
if: ${{ inputs.run_tests }} | |
run: colima start | |
- uses: ./.github/actions/run-ee-server | |
if: ${{ inputs.run_tests }} | |
with: | |
use-server-rc: ${{ inputs.use-server-rc }} | |
server-tag: ${{ inputs.server-tag }} | |
docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} | |
docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} | |
- name: Enable tests | |
if: ${{ inputs.run_tests }} | |
run: echo "TEST_COMMAND=npm test -- --h 172.17.0.2 --port 3000" >> $GITHUB_ENV | |
- name: Disable tests (only run basic import test) | |
if: ${{ !inputs.run_tests }} | |
run: echo "TEST_COMMAND=node -e 'aerospike = require(\".\/lib\/aerospike\")'" >> $GITHUB_ENV | |
- name: Build client | |
run: | | |
./scripts/build-c-client.sh | |
npm install | |
env: | |
CFLAGS: '-Werror' | |
- name: Test client | |
run: | | |
${{ env.TEST_COMMAND }} | |
- name: Save macOS binding | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.nodejs }}-macosx_x86_64.build | |
path: ./lib/binding/*/ | |
- name: Set final commit status | |
uses: myrotvorets/[email protected] | |
if: always() | |
with: | |
status: ${{ job.status }} | |
sha: ${{ github.sha }} | |
context: "Build bindings (${{ matrix.nodejs }}-macosx_x86_64)" | |
macOS-m1: | |
runs-on: [ | |
self-hosted, | |
macOS, | |
ARM64 | |
] | |
strategy: | |
matrix: | |
nodejs-version: [ | |
["v108", "18"], | |
["v115", "20"], | |
["v120", "21"], | |
] | |
fail-fast: false | |
steps: | |
- name: Show job status for commit | |
uses: myrotvorets/[email protected] | |
with: | |
sha: ${{ github.sha }} | |
context: "Build bindings (${{ matrix.nodejs-version[1] }}-macosx_arm64)" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
ref: ${{ inputs.commit_sha }} | |
- name: Install NVM | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
source ~/.zshrc | |
nvm -v | |
nvm install ${{ matrix.nodejs-version[1] }} | |
- name: Setup symlink folders | |
run: | | |
sudo rm -rf /usr/local/opt/openssl; | |
sudo rm -rf /usr/local/opt/libuv; | |
sudo mkdir -p /usr/local/opt; | |
sudo chown -R $(whoami) /usr/local/opt | |
- name: Install brew packages | |
run: | | |
brew install [email protected] | |
brew install [email protected] | |
- name: Set environment for building | |
run: | | |
echo "export PATH="/usr/local/bin/:/usr/local/opt/openssl/bin:$PATH" | |
export LDFLAGS="-L/usr/local/opt/openssl/lib" | |
export CPPFLAGS="-I/usr/local/opt/openssl/include" | |
export EXT_CFLAGS="-I/usr/local/opt/openssl/include"" >> ~/.zshrc; | |
source ~/.zshrc; | |
- name: Setup symlink folders | |
run: | | |
sudo ln -s /usr/local/Cellar/libuv/1.47.0/ /usr/local/opt/libuv; | |
sudo ln -s /usr/local/Cellar/openssl@3/3.2.1/ /usr/local/opt/openssl; | |
# 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 }} | |
if: ${{ inputs.run_tests && inputs.use-server-rc }} | |
- if: ${{ inputs.run_tests && inputs.use-server-rc }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_BOT_PW }} | |
- name: Use server rc | |
if: ${{ inputs.run_tests && inputs.use-server-rc }} | |
run: echo IMAGE_NAME="${{ vars.SERVER_RC_REPO_LINK }}:${{ inputs.server-tag }}" >> $GITHUB_ENV | |
- name: Use server release | |
if: ${{ inputs.run_tests && !inputs.use-server-rc }} | |
run: echo IMAGE_NAME="${{ vars.SERVER_REPO_LINK }}:${{ inputs.server-tag }}" >> $GITHUB_ENV | |
- name: Run server | |
if: ${{ inputs.run_tests }} | |
run: docker run -d -p 3000:3000 --name aerospike ${{ env.IMAGE_NAME }} | |
- name: Build client | |
run: | | |
./scripts/build-c-client.sh | |
npm install | |
env: | |
CFLAGS: '-Werror' | |
- name: Enable tests | |
if: ${{ inputs.run_tests }} | |
run: echo "TEST_COMMAND=npm test -- --h 172.17.0.2 --port 3000" >> $GITHUB_ENV | |
- name: Disable tests (only run basic import test) | |
if: ${{ !inputs.run_tests }} | |
run: echo "TEST_COMMAND=node -e 'aerospike = require(\".\/lib\/aerospike\")'" >> $GITHUB_ENV | |
- name: Test client | |
run: | | |
${{ env.TEST_COMMAND }} | |
- name: Save macOS wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.nodejs-version[0] }}-macosx_arm64.build | |
path: ./lib/binding/*/ | |
- name: Stop server | |
if: ${{ always() && inputs.run_tests }} | |
run: | | |
docker container stop aerospike | |
docker container prune -f | |
- name: Set final commit status | |
uses: myrotvorets/[email protected] | |
if: always() | |
with: | |
sha: ${{ github.sha }} | |
status: ${{ job.status }} | |
context: "Build bindings (${{ matrix.nodejs-version[0] }}-macosx_arm64)" |