Update MANIFEST.in; exclude _version.py #30
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: tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| is_release: | |
| description: "Set to true if a release version." | |
| required: true | |
| default: false | |
| type: boolean | |
| sha: | |
| description: "The git SHA to use for release. Only set if needing to publish" | |
| required: false | |
| default: "" | |
| type: string | |
| version: | |
| description: "The Release version. Allowed format: x.y.z[-alphaN | -betaN | -rcN | -devN | -postN]" | |
| required: false | |
| default: "" | |
| type: string | |
| config: | |
| description: "JSON formatted object representing various build system input parameters." | |
| required: false | |
| default: "" | |
| type: string | |
| workflow_call: | |
| inputs: | |
| is_release: | |
| description: "Set to true if a release version." | |
| required: true | |
| default: false | |
| type: boolean | |
| sha: | |
| description: "The git SHA to use for release. Only set if needing to publish" | |
| required: false | |
| default: "" | |
| type: string | |
| version: | |
| description: "The Release version. Allowed format: x.y.z[-alphaN | -betaN | -rcN | -devN | -postN]" | |
| required: false | |
| default: "" | |
| type: string | |
| config: | |
| description: "JSON formatted object representing various build system input parameters." | |
| required: false | |
| default: "" | |
| type: string | |
| outputs: | |
| workflow_run_id: | |
| description: "The workflow run ID" | |
| value: ${{ github.run_id }} | |
| 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_tests | |
| path: | | |
| ci_scripts/ | |
| validate-input: | |
| needs: [ci-scripts, default-linux-runner] | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| env: | |
| CBCI_IS_RELEASE: ${{ inputs.is_release }} | |
| CBCI_SHA: ${{ inputs.sha }} | |
| CBCI_VERSION: ${{ inputs.version }} | |
| CBCI_CONFIG: ${{ inputs.config }} | |
| steps: | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_tests | |
| 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 }} | |
| outputs: | |
| stage_matrices: ${{ steps.build_matrices.outputs.stage_matrices }} | |
| steps: | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_tests | |
| 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) | |
| if: inputs.sha != '' | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.sha }} | |
| - name: Checkout (no SHA) | |
| if: inputs.sha == '' | |
| uses: actions/checkout@v4 | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_tests | |
| 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 | |
| path: | | |
| pycbac_test/ | |
| lint: | |
| needs: [validate-input, default-linux-runner] | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| env: | |
| CBCI_VERSION: ${{ inputs.version }} | |
| steps: | |
| - name: Checkout (with SHA) | |
| if: inputs.sha != '' | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.sha }} | |
| - name: Checkout (no SHA) | |
| if: inputs.sha == '' | |
| uses: actions/checkout@v4 | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_tests | |
| 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: Execute linting | |
| run: | | |
| ls -alh | |
| ./ci_scripts/gha.sh lint | |
| sdist-wheel: | |
| needs: [lint, default-linux-runner] | |
| runs-on: ${{ needs.default-linux-runner.outputs.runner }} | |
| env: | |
| CBCI_VERSION: ${{ inputs.version }} | |
| CBCI_CONFIG: ${{ inputs.config }} | |
| outputs: | |
| sdist_name: ${{ steps.create_sdist.outputs.sdist_name }} | |
| wheel_name: ${{ steps.create_wheel.outputs.wheel_name }} | |
| steps: | |
| - name: Checkout (with SHA) | |
| if: inputs.sha != '' | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.sha }} | |
| - name: Checkout (no SHA) | |
| if: inputs.sha == '' | |
| uses: actions/checkout@v4 | |
| - name: Download CI scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ci_scripts_tests | |
| path: ci_scripts | |
| - name: Enable CI Scripts | |
| run: | | |
| chmod +x ci_scripts/gha.sh | |
| - name: Setup 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: Create sdist | |
| id: create_sdist | |
| run: | | |
| ./ci_scripts/gha.sh sdist | |
| exit_code=0 | |
| sdist_name=$(./ci_scripts/gha.sh get_sdist_name) || exit_code=$? | |
| if [ $exit_code -ne 0 ]; then | |
| echo "Failed to obtain sdist name." | |
| exit 1 | |
| fi | |
| echo "SDIST_NAME=$sdist_name" | |
| echo "sdist_name=$sdist_name" >> "$GITHUB_OUTPUT" | |
| - name: Create wheel | |
| id: create_wheel | |
| run: | | |
| ./ci_scripts/gha.sh wheel | |
| wheel_name=$(find ./dist -name '*.whl' | cut -c 8-) | |
| echo "WHEEL_NAME=$wheel_name" | |
| echo "wheel_name=$wheel_name" >> "$GITHUB_OUTPUT" | |
| - name: Upload Python sdk | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| retention-days: 1 | |
| name: pycbac-artifact-sdist | |
| path: | | |
| ./dist/*.tar.gz | |
| - name: Upload Python wheel | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| retention-days: 1 | |
| name: pycbac-artifact-wheel | |
| path: | | |
| ./dist/*.whl | |
| alpine-unit-tests: | |
| needs: [setup, test-setup, sdist-wheel, 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 sdist | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_sdist_install }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-sdist | |
| path: pycbac | |
| - name: Download wheel | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_wheel_install }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-wheel | |
| path: pycbac | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup | |
| 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 sdist install | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_sdist_install }} | |
| 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 | |
| SDIST_NAME=${{ needs.sdist-wheel.outputs.sdist_name }} | |
| echo "SDIST_NAME=$SDIST_NAME.tar.gz" | |
| python -m pip install ${SDIST_NAME}.tar.gz | |
| 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 | |
| - name: Run unit tests in docker via wheel install | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_wheel_install }} | |
| 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 | |
| WHEEL_NAME=${{ needs.sdist-wheel.outputs.wheel_name }} | |
| echo "WHEEL_NAME=$WHEEL_NAME" | |
| python -m pip install ${WHEEL_NAME} | |
| 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 couchbase tests: $PYTEST_CMD" | |
| eval "$PYTEST_CMD" | |
| fi | |
| linux-unit-tests: | |
| needs: [setup, test-setup, sdist-wheel] | |
| 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 sdist | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_sdist_install }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-sdist | |
| path: pycbac | |
| - name: Download wheel | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_wheel_install }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-wheel | |
| path: pycbac | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup | |
| path: pycbac | |
| - name: Run unit tests via sdist install | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_sdist_install }} | |
| 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 }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| ls -alh | |
| python -m pip install -r requirements-test.txt | |
| SDIST_NAME=${{ needs.sdist-wheel.outputs.sdist_name }} | |
| echo "SDIST_NAME=$SDIST_NAME.tar.gz" | |
| python -m pip install ${SDIST_NAME}.tar.gz | |
| 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 | |
| python -m pip uninstall couchbase-analytics -y | |
| - name: Run unit tests via wheel install | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_wheel_install }} | |
| 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 }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| ls -alh | |
| python -m pip install -r requirements-test.txt | |
| WHEEL_NAME=${{ needs.sdist-wheel.outputs.wheel_name }} | |
| echo "WHEEL_NAME=$WHEEL_NAME" | |
| python -m pip install ${WHEEL_NAME} --no-cache-dir | |
| 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, sdist-wheel] | |
| 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 sdist | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_sdist_install }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-sdist | |
| path: pycbac | |
| - name: Download wheel | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_wheel_install }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-wheel | |
| path: pycbac | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup | |
| path: pycbac | |
| - name: Run unit tests via sdist install | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_sdist_install }} | |
| 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 }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| ls -alh | |
| python -m pip install -r requirements-test.txt | |
| SDIST_NAME=${{ needs.sdist-wheel.outputs.sdist_name }} | |
| echo "SDIST_NAME=$SDIST_NAME.tar.gz" | |
| python -m pip install ${SDIST_NAME}.tar.gz | |
| 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 | |
| python -m pip uninstall couchbase-analytics -y | |
| - name: Run unit tests via wheel install | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_wheel_install }} | |
| 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 }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| ls -alh | |
| python -m pip install -r requirements-test.txt | |
| WHEEL_NAME=${{ needs.sdist-wheel.outputs.wheel_name }} | |
| echo "WHEEL_NAME=$WHEEL_NAME" | |
| python -m pip install ${WHEEL_NAME} --no-cache-dir | |
| 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, sdist-wheel] | |
| 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 sdist | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_sdist_install }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-sdist | |
| path: pycbac | |
| - name: Download wheel | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_wheel_install }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-wheel | |
| path: pycbac | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup | |
| path: pycbac | |
| - name: Run unit tests via sdist install | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_sdist_install }} | |
| 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 }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| dir | |
| python -m pip install -r requirements-test.txt | |
| $SDIST_NAME="${{ needs.sdist-wheel.outputs.sdist_name }}" + ".tar.gz" | |
| echo "SDIST_NAME=$SDIST_NAME" | |
| python -m pip install "$SDIST_NAME" | |
| 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 | |
| } | |
| python -m pip uninstall couchbase-analytics -y | |
| - name: Run unit tests via wheel install | |
| if: ${{ fromJson(needs.setup.outputs.stage_matrices).test_unit.test_wheel_install }} | |
| 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 }} | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| cd pycbac | |
| dir | |
| python -m pip install -r requirements-test.txt | |
| $WHEEL_NAME="${{ needs.sdist-wheel.outputs.wheel_name }}" | |
| echo "WHEEL_NAME=$WHEEL_NAME" | |
| python -m pip install "$WHEEL_NAME" --no-cache-dir | |
| 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, sdist-wheel] | |
| 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_tests | |
| path: ci_scripts | |
| - name: Enable CI Scripts | |
| run: | | |
| chmod +x ci_scripts/gha.sh | |
| - name: Download wheel | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-artifact-wheel | |
| path: pycbac | |
| - name: Download test setup | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pycbac-test-setup | |
| 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 }} | |
| 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 | |
| WHEEL_NAME=${{ needs.sdist-wheel.outputs.wheel_name }} | |
| echo "WHEEL_NAME=$WHEEL_NAME" | |
| python -m pip install ${WHEEL_NAME} | |
| 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 }} |