verify_release #3
Workflow file for this run
This file contains hidden or 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: verify_release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "The Release version. Allowed format: x.y.z[-alphaN | -betaN | -rcN | -devN | -postN]" | |
| required: true | |
| default: "" | |
| type: string | |
| sha: | |
| description: "The git SHA associated with the version to verify." | |
| required: true | |
| default: "" | |
| type: string | |
| packaging_index: | |
| description: "The packaging index to download the SDK from." | |
| required: true | |
| default: "PYPI" | |
| type: choice | |
| options: | |
| - PYPI | |
| - TEST_PYPI | |
| config: | |
| description: "JSON formatted object representing various build system input parameters." | |
| required: false | |
| default: "" | |
| type: string | |
| workflow_call: | |
| inputs: | |
| version: | |
| description: "The Release version. Allowed format: x.y.z[-alphaN | -betaN | -rcN | -devN | -postN]" | |
| required: true | |
| default: "" | |
| type: string | |
| sha: | |
| description: "The git SHA associated with the version to verify." | |
| required: true | |
| default: "" | |
| type: string | |
| packaging_index: | |
| description: "The packaging index to download the SDK from." | |
| required: true | |
| default: "PYPI" | |
| type: string | |
| config: | |
| description: "JSON formatted object representing various build system input parameters." | |
| required: false | |
| default: "" | |
| type: string | |
| env: | |
| CBCI_PROJECT_TYPE: "ANALYTICS" | |
| CBCI_DEFAULT_PYTHON: "3.9" | |
| CBCI_SUPPORTED_PYTHON_VERSIONS: "3.9 3.10 3.11 3.12 3.13" | |
| CBCI_SUPPORTED_X86_64_PLATFORMS: "linux alpine macos windows" | |
| CBCI_SUPPORTED_ARM64_PLATFORMS: "linux macos" | |
| CBCI_DEFAULT_LINUX_X86_64_PLATFORM: "ubuntu-22.04" | |
| CBCI_DEFAULT_LINUX_ARM64_PLATFORM: "ubuntu-22.04-arm" | |
| CBCI_DEFAULT_MACOS_X86_64_PLATFORM: "macos-13" | |
| CBCI_DEFAULT_MACOS_ARM64_PLATFORM: "macos-14" | |
| CBCI_DEFAULT_WINDOWS_PLATFORM: "windows-2022" | |
| CBCI_DEFAULT_LINUX_CONTAINER: "slim-bookworm" | |
| CBCI_DEFAULT_ALPINE_CONTAINER: "alpine" | |
| CBCI_CBDINO_VERSION: "v0.0.80" | |
| CI_SCRIPTS_URL: "https://raw.githubusercontent.com/couchbaselabs/sdkbuild-jenkinsfiles/master/python/ci_scripts_v1" | |
| jobs: | |
| default-linux-runner: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| runner: ${{ steps.set_runner.outputs.runner }} | |
| steps: | |
| - id: set_runner | |
| run: echo "runner=${{ env.CBCI_DEFAULT_LINUX_X86_64_PLATFORM }}" >> $GITHUB_OUTPUT | |
| ci-scripts: | |
| needs: default-linux-runner | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| steps: | |
| - name: Download CI Scripts | |
| run: | | |
| mkdir ci_scripts | |
| cd ci_scripts | |
| curl -o gha.sh ${CI_SCRIPTS_URL}/gha.sh | |
| curl -o pygha.py ${CI_SCRIPTS_URL}/pygha.py | |
| ls -alh | |
| - name: Upload CI scripts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| retention-days: 1 | |
| name: ci_scripts_verify_${{ inputs.packaging_index }} | |
| path: | | |
| ci_scripts/ | |
| validate-input: | |
| needs: [ci-scripts, default-linux-runner] | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| env: | |
| CBCI_VERSION: ${{ inputs.version }} | |
| CBCI_SHA: ${{ inputs.sha }} | |
| CBCI_PACKAGING_INDEX: ${{ inputs.packaging_index }} | |
| CBCI_CONFIG: ${{ inputs.config }} | |
| steps: | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_verify_${{ inputs.packaging_index }} | |
| path: ci_scripts | |
| - name: Verify Scripts | |
| run: | | |
| ls -alh ci_scripts | |
| chmod +x ci_scripts/gha.sh | |
| ls -alh ci_scripts | |
| - name: Display workflow info | |
| run: | | |
| ./ci_scripts/gha.sh display_info | |
| - name: Validate workflow info | |
| run: | | |
| ./ci_scripts/gha.sh validate_input ${{ github.workflow }} | |
| setup: | |
| needs: [validate-input, default-linux-runner] | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| env: | |
| CBCI_CONFIG: ${{ inputs.config }} | |
| CBCI_PACKAGING_INDEX: ${{ inputs.packaging_index }} | |
| outputs: | |
| stage_matrices: ${{ steps.build_matrices.outputs.stage_matrices }} | |
| steps: | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_verify_${{ inputs.packaging_index }} | |
| path: ci_scripts | |
| - name: Enable CI Scripts | |
| run: | | |
| chmod +x ci_scripts/gha.sh | |
| - name: Setup Python ${{ env.CBCI_DEFAULT_PYTHON }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.CBCI_DEFAULT_PYTHON }} | |
| - name: Confirm Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Build stage matrices | |
| id: build_matrices | |
| run: | | |
| exit_code=0 | |
| STAGE_MATRICES=$(./ci_scripts/gha.sh get_stage_matrices) || exit_code=$? | |
| if [ $exit_code -ne 0 ]; then | |
| echo "Failed to obtain stage matrices." | |
| exit 1 | |
| fi | |
| stage_matrices_json=$(jq -cn --argjson matrices "$STAGE_MATRICES" '$matrices') | |
| echo "STAGE_MATRICES_JSON=$stage_matrices_json" | |
| echo "stage_matrices=$stage_matrices_json" >> "$GITHUB_OUTPUT" | |
| confirm-matrices: | |
| needs: [setup, default-linux-runner] | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| steps: | |
| - name: Alpine Test Unit Stage | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.has_alpine }} | |
| run: | | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_unit.alpine) }}" | |
| - name: Linux Test Unit Stage | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.has_linux }} | |
| run: | | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_unit.linux) }}" | |
| - name: Macos Test Unit Stage | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.has_macos }} | |
| run: | | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_unit.macos) }}" | |
| - name: Windows Test Unit Stage | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.has_windows }} | |
| run: | | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_unit.windows) }}" | |
| - name: Unit Test Commands | |
| run: | | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest) }}" | |
| - name: Integration Test Commands | |
| run: | | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_integration.pytest) }}" | |
| - name: Linux cbdino Stage | |
| if: >- | |
| ${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.has_linux_cbdino | |
| && !fromJson(needs.setup.outputs.stage_matrices).test_integration.skip_cbdino }} | |
| run: | | |
| echo cbdino config: | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_integration.cbdino_config) }}" | |
| echo cbdino linux: | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_integration.linux_cbdino) }}" | |
| - name: Linux Integration Stage | |
| if: >- | |
| ${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.has_linux | |
| && !fromJson(needs.setup.outputs.stage_matrices).test_integration.skip_integration }} | |
| run: | | |
| echo "${{ toJson(fromJson(needs.setup.outputs.stage_matrices).test_integration.test_config) }}" | |
| test-setup: | |
| needs: [confirm-matrices, default-linux-runner] | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| env: | |
| CBCI_CONFIG: ${{ inputs.config }} | |
| steps: | |
| - name: Checkout (with SHA) | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.sha }} | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_verify_${{ inputs.packaging_index }} | |
| path: ci_scripts | |
| - name: Enable CI Scripts | |
| run: | | |
| chmod +x ci_scripts/gha.sh | |
| - name: Setup Python ${{ env.CBCI_DEFAULT_PYTHON }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.CBCI_DEFAULT_PYTHON }} | |
| - name: Confirm Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Build test setup | |
| run: | | |
| ./ci_scripts/gha.sh build_test_setup | |
| - name: Confirm test setup | |
| run: | | |
| echo "pycbac_test directory contents:" | |
| ls -alh pycbac_test | |
| echo "pycbac_test/acb/tests contents:" | |
| ls -alh pycbac_test/acb/tests | |
| echo "pycbac_test/cb/tests contents:" | |
| ls -alh pycbac_test/cb/tests | |
| echo "pycbac_test/tests contents:" | |
| ls -alh pycbac_test/tests | |
| echo "pycbac_test/conftest.py contents:" | |
| cat pycbac_test/conftest.py | |
| echo "pycbac_test/requirements-test.txt contents:" | |
| cat pycbac_test/requirements-test.txt | |
| echo "pycbac_test/pytest.ini contents:" | |
| cat pycbac_test/pytest.ini | |
| echo "pycbac_test/tests/test_config.ini contents:" | |
| cat pycbac_test/tests/test_config.ini | |
| - name: Upload test setup | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| retention-days: 1 | |
| name: pycbac-test-setup-verify-${{ inputs.packaging_index }} | |
| path: | | |
| pycbac_test/ | |
| alpine-unit-tests: | |
| needs: [setup, test-setup, default-linux-runner] | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.has_alpine }} | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.alpine }} | |
| steps: | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Confirm Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup-verify-${{ inputs.packaging_index }} | |
| path: pycbac | |
| - name: Cache Docker image | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/docker_python_image.tar # Path to store the image archive | |
| key: docker-image-python-${{ matrix.python-version }}-${{ env.CBCI_DEFAULT_ALPINE_CONTAINER }} | |
| - name: Pull and save image if not cached | |
| run: | | |
| if [ ! -f /tmp/docker_python_image.tar ]; then | |
| docker pull python:${{ matrix.python-version }}-${{ env.CBCI_DEFAULT_ALPINE_CONTAINER }} | |
| docker save python:${{ matrix.python-version }}-${{ env.CBCI_DEFAULT_ALPINE_CONTAINER }} -o /tmp/docker_python_image.tar | |
| fi | |
| - name: Load image if cached | |
| run: | | |
| if [ -f /tmp/docker_python_image.tar ]; then | |
| docker load -i /tmp/docker_python_image.tar | |
| fi | |
| - name: Run unit tests in docker via pip install (${{ inputs.packaging_index }}) | |
| uses: addnab/docker-run-action@v3 | |
| with: | |
| image: python:${{ matrix.python-version }}-${{ env.CBCI_DEFAULT_ALPINE_CONTAINER }} | |
| options: >- | |
| --platform linux/amd64 | |
| -v ${{ github.workspace }}/pycbac:/pycbac | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| ls -alh | |
| python -m pip install -r requirements-test.txt | |
| INSTALL_CMD="${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.install_cmd }}" | |
| SDK_VERSION="${{ inputs.version }}" | |
| echo "INSTALL_CMD=$INSTALL_CMD" | |
| PIP_CMD="python -m pip $INSTALL_CMD couchbase-analytics==$SDK_VERSION" | |
| eval "$PIP_CMD" | |
| python -m pip list | |
| TEST_ACOUCHBASE_API=${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_acouchbase_api }} | |
| if [ "$TEST_ACOUCHBASE_API" = "true" ]; then | |
| PYTEST_ACB_CMD="${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.acouchbase_cmd }}" | |
| PYTEST_ACB_OPTS="${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.acouchbase_opts }}" | |
| PYTEST_CMD="python -m $PYTEST_ACB_CMD $PYTEST_ACB_OPTS" | |
| echo "Running acouchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| TEST_COUCHBASE_API=${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_couchbase_api }} | |
| if [ "$TEST_COUCHBASE_API" = "true" ]; then | |
| PYTEST_CB_CMD="${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.couchbase_cmd }}" | |
| PYTEST_CB_OPTS="${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.couchbase_opts }}" | |
| PYTEST_CMD="python -m $PYTEST_CB_CMD $PYTEST_CB_OPTS" | |
| echo "Running acouchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| linux-unit-tests: | |
| needs: [setup, test-setup] | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.has_linux }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.linux }} | |
| steps: | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Confirm Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup-verify-${{ inputs.packaging_index }} | |
| path: pycbac | |
| - name: Run unit tests via pip install (${{ inputs.packaging_index }}) | |
| env: | |
| PYTEST_ACB_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.acouchbase_cmd }} | |
| PYTEST_ACB_OPTS: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.acouchbase_opts }} | |
| PYTEST_CB_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.couchbase_cmd }} | |
| PYTEST_CB_OPTS: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.couchbase_opts }} | |
| INSTALL_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.install_cmd }} | |
| SDK_VERSION: ${{ inputs.version }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| ls -alh | |
| python -m pip install -r requirements-test.txt | |
| echo "INSTALL_CMD=$INSTALL_CMD" | |
| PIP_CMD="python -m pip $INSTALL_CMD couchbase-analytics==$SDK_VERSION" | |
| eval "$PIP_CMD" | |
| python -m pip list | |
| TEST_ACOUCHBASE_API=${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_acouchbase_api }} | |
| if [ "$TEST_ACOUCHBASE_API" = "true" ]; then | |
| PYTEST_CMD="python -m $PYTEST_ACB_CMD $PYTEST_ACB_OPTS" | |
| echo "Running acouchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| TEST_COUCHBASE_API=${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_couchbase_api }} | |
| if [ "$TEST_COUCHBASE_API" = "true" ]; then | |
| PYTEST_CMD="python -m $PYTEST_CB_CMD $PYTEST_CB_OPTS" | |
| echo "Running couchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| macos-unit-tests: | |
| needs: [setup, test-setup] | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.has_macos }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.macos }} | |
| steps: | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Confirm Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup-verify-${{ inputs.packaging_index }} | |
| path: pycbac | |
| - name: Run unit tests via pip install (${{ inputs.packaging_index }}) | |
| env: | |
| PYTEST_ACB_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.acouchbase_cmd }} | |
| PYTEST_ACB_OPTS: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.acouchbase_opts }} | |
| PYTEST_CB_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.couchbase_cmd }} | |
| PYTEST_CB_OPTS: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.couchbase_opts }} | |
| INSTALL_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.install_cmd }} | |
| SDK_VERSION: ${{ inputs.version }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| ls -alh | |
| python -m pip install -r requirements-test.txt | |
| echo "INSTALL_CMD=$INSTALL_CMD" | |
| PIP_CMD="python -m pip $INSTALL_CMD couchbase-analytics==$SDK_VERSION" | |
| eval "$PIP_CMD" | |
| python -m pip list | |
| TEST_ACOUCHBASE_API=${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_acouchbase_api }} | |
| if [ "$TEST_ACOUCHBASE_API" = "true" ]; then | |
| PYTEST_CMD="python -m $PYTEST_ACB_CMD $PYTEST_ACB_OPTS" | |
| echo "Running acouchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| TEST_COUCHBASE_API=${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_couchbase_api }} | |
| if [ "$TEST_COUCHBASE_API" = "true" ]; then | |
| PYTEST_CMD="python -m $PYTEST_CB_CMD $PYTEST_CB_OPTS" | |
| echo "Running couchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| windows-unit-tests: | |
| needs: [setup, test-setup] | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.has_windows }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.windows }} | |
| steps: | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Confirm Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup-verify-${{ inputs.packaging_index }} | |
| path: pycbac | |
| - name: Run unit tests via pip install (${{ inputs.packaging_index }}) | |
| env: | |
| PYTEST_ACB_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.acouchbase_cmd }} | |
| PYTEST_ACB_OPTS: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.acouchbase_opts }} | |
| PYTEST_CB_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.couchbase_cmd }} | |
| PYTEST_CB_OPTS: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.pytest.couchbase_opts }} | |
| INSTALL_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.install_cmd }} | |
| SDK_VERSION: ${{ inputs.version }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| dir | |
| python -m pip install -r requirements-test.txt | |
| echo "INSTALL_CMD=$env:INSTALL_CMD" | |
| $PIP_CMD="python -m pip $($env:INSTALL_CMD) couchbase-analytics==$($env:SDK_VERSION)" | |
| iex $PIP_CMD | |
| python -m pip list | |
| $TEST_ACOUCHBASE_API="${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_acouchbase_api }}" | |
| if ( $TEST_ACOUCHBASE_API -eq "true" ) { | |
| $PYTEST_CMD="python -m $($env:PYTEST_ACB_CMD) $($env:PYTEST_ACB_OPTS)" | |
| echo "Running acouchbase tests: $PYTEST_CMD" | |
| iex $PYTEST_CMD | |
| } | |
| $TEST_COUCHBASE_API="${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_couchbase_api }}" | |
| if ( $TEST_COUCHBASE_API = "true" ) { | |
| $PYTEST_CMD="python -m $($env:PYTEST_CB_CMD) $($env:PYTEST_CB_OPTS)" | |
| echo "Running couchbase tests: $PYTEST_CMD" | |
| iex $PYTEST_CMD | |
| } | |
| cbdino-integration-tests: | |
| needs: [setup, test-setup] | |
| if: >- | |
| ${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.has_linux_cbdino | |
| && !fromJson(needs.setup.outputs.stage_matrices).test_integration.skip_cbdino }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.linux_cbdino }} | |
| steps: | |
| - name: Install cbdinocluster | |
| run: | | |
| mkdir -p "$HOME/bin" | |
| CB_DINO_VERSION=${{ env.CBCI_CBDINO_VERSION }} | |
| CB_DINO_TYPE="cbdinocluster-${{ matrix.arch == 'x86_64' && 'linux-amd64' || 'linux-arm64' }}" | |
| wget -nv -O $HOME/bin/cbdinocluster https://github.com/couchbaselabs/cbdinocluster/releases/download/$CB_DINO_VERSION/$CB_DINO_TYPE | |
| chmod +x $HOME/bin/cbdinocluster | |
| echo "$HOME/bin" >> $GITHUB_PATH | |
| - name: Install s3mock | |
| run: | | |
| docker pull adobe/s3mock | |
| docker pull nginx | |
| - name: Initialize cbdinocluster | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cbdinocluster -v init --auto | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Confirm Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_verify_${{ inputs.packaging_index }} | |
| path: ci_scripts | |
| - name: Enable CI Scripts | |
| run: | | |
| chmod +x ci_scripts/gha.sh | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup-verify-${{ inputs.packaging_index }} | |
| path: pycbac | |
| - name: Start couchbase cluster | |
| run: | | |
| cd pycbac | |
| cat cluster_def.yaml | |
| CBDC_ID=$(cbdinocluster -v alloc --def-file=cluster_def.yaml) | |
| CBDC_CONNSTR=$(cbdinocluster -v connstr --analytics $CBDC_ID) | |
| echo "CBDC_ID=$CBDC_ID" >> "$GITHUB_ENV" | |
| echo "CBDC_CONNSTR=$CBDC_CONNSTR" >> "$GITHUB_ENV" | |
| echo "CBDC_CONNSTR=$CBDC_CONNSTR" | |
| cbdinocluster buckets load-sample $CBDC_ID travel-sample | |
| - name: Update test_config.ini | |
| env: | |
| PYCBAC_USERNAME: 'Administrator' | |
| PYCBAC_PASSWORD: 'password' | |
| PYCBAC_FQDN: 'travel-sample.inventory.airline' | |
| CBCONNSTR: ${{ env.CBDC_CONNSTR }} | |
| run: | | |
| ./ci_scripts/gha.sh build_test_config_ini pycbac/tests | |
| - name: Run tests | |
| timeout-minutes: 30 | |
| env: | |
| PYTEST_ACB_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.pytest.acouchbase_cmd }} | |
| PYTEST_ACB_OPTS: ${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.pytest.acouchbase_opts }} | |
| PYTEST_CB_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.pytest.couchbase_cmd }} | |
| PYTEST_CB_OPTS: ${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.pytest.couchbase_opts }} | |
| INSTALL_CMD: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.install_cmd }} | |
| SDK_VERSION: ${{ inputs.version }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| ls -alh | |
| cat tests/test_config.ini | |
| python -m pip install -r requirements-test.txt | |
| echo "INSTALL_CMD=$INSTALL_CMD" | |
| PIP_CMD="python -m pip $INSTALL_CMD couchbase-analytics==$SDK_VERSION" | |
| eval "$PIP_CMD" | |
| python -m pip list | |
| TEST_ACOUCHBASE_API=${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.test_acouchbase_api }} | |
| if [ "$TEST_ACOUCHBASE_API" = "true" ]; then | |
| PYTEST_CMD="python -m $PYTEST_ACB_CMD $PYTEST_ACB_OPTS" | |
| echo "Running acouchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| TEST_COUCHBASE_API=${{ fromJson(needs.setup.outputs.stage_matrices).test_integration.test_couchbase_api }} | |
| if [ "$TEST_COUCHBASE_API" = "true" ]; then | |
| PYTEST_CMD="python -m $PYTEST_CB_CMD $PYTEST_CB_OPTS" | |
| echo "Running couchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| - name: Cleanup cbdino cluster | |
| run: | | |
| cbdinocluster rm ${{ env.CBDC_ID }} |