Smoke tests #3471
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: Smoke tests | |
| run-name: Smoke tests ${{ github.event_name == 'workflow_dispatch' && format('({0})', inputs.server-tag) || '' }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| # For build-and-optionally-test-wheels-on-one-platform.yml | |
| # No way to only set this if tests are enabled in that workflow, AFAIK | |
| statuses: write | |
| on: | |
| # Using push instead of pull_request so that commits with no applicable code changes will not trigger a rebuild | |
| # This saves compute cost | |
| push: | |
| paths-ignore: | |
| # Changes to code examples in API docs may affect doctest results | |
| # - doc/**/* | |
| - .readthedocs.yml | |
| # Only for ignoring git commits when using 'git blame' | |
| - .git-blame-ignore-revs | |
| # Only used by QE for building their own wheels | |
| - .build.yml | |
| # Other misc files not related to source code changes | |
| - benchmarks/**/* | |
| tags-ignore: | |
| - '**' | |
| # Have to add this or tags-ignore will cause workflow to never run | |
| branches: | |
| - '**' | |
| workflow_dispatch: | |
| inputs: | |
| server-tag: | |
| description: Server tag | |
| type: string | |
| required: true | |
| env: | |
| LOWEST_SUPPORTED_PY_VERSION: '3.10' | |
| # pull_request event doesn't support inputs | |
| # Our JFrog docker repo doesn't automatically update the latest tag, so we can't use it (it currently points to an old nightly build) | |
| # 8.1 tag is also currently pointing to a dev 8.0 server build as of this writing... | |
| SERVER_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.server-tag || '8.1.2.1' }} | |
| PLATFORM_TAG: linux_x86_64 | |
| COVERAGE_REPORT_ARTIFACT_NAME: coverage-report | |
| jobs: | |
| # For reusable workflows to access environment variables | |
| get-env-vars: | |
| outputs: | |
| lowest-supported-python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }} | |
| server-tag: ${{ env.SERVER_TAG }} | |
| platform-tag: ${{ env.PLATFORM_TAG }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: no-op | |
| run: echo 1 | |
| build: | |
| needs: get-env-vars | |
| uses: ./.github/workflows/build-and-optionally-test-wheels-on-one-platform.yml | |
| with: | |
| platform-tag: ${{ needs.get-env-vars.outputs.platform-tag }} | |
| server-tag: ${{ needs.get-env-vars.outputs.server-tag }} | |
| env-vars-for-building: SKIP_REPAIR_WHEEL=1 | |
| secrets: inherit | |
| build-and-test-using-debug-interpreter: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-dbg | |
| PYTHON_BINARY=python3-dbg | |
| echo PYTHON_BINARY="$PYTHON_BINARY" >> "$GITHUB_ENV" | |
| "$PYTHON_BINARY" -m pip install build -c requirements.txt | |
| "$PYTHON_BINARY" -m build | |
| "$PYTHON_BINARY" -m pip install dist/*.whl | |
| - name: Run Aerospike server | |
| uses: ./.github/actions/setup-server-and-tests | |
| with: | |
| oidc-provider-name: ${{ vars.OIDC_PROVIDER_NAME }} | |
| oidc-audience: ${{ vars.OIDC_AUDIENCE }} | |
| server-edition: enterprise | |
| features-content: ${{ secrets.FEATURES_CONTENT }} | |
| server-tag: ${{ env.SERVER_TAG }} | |
| - run: | | |
| "$PYTHON_BINARY" -m pip install pytest -c requirements.txt | |
| "$PYTHON_BINARY" -m pytest ./new_tests | |
| working-directory: test | |
| generate-coverage-report: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }} | |
| architecture: 'x64' | |
| - name: Build client | |
| # Use --wheel command to generate object .o files in build/temp*/src/main directory | |
| # They will also contain .gcno files there | |
| # and .gcda files will be generated there after running the tests | |
| run: | | |
| python3 -m pip install build -c requirements.txt | |
| COVERAGE=1 UNOPTIMIZED=1 python3 -m build --wheel | |
| - name: Install client | |
| # Install in user directory to prevent permission errors | |
| run: python3 -m pip install --user . | |
| - run: pip install -r requirements.txt | |
| working-directory: test | |
| - name: Run Aerospike server | |
| uses: ./.github/actions/setup-server-and-tests | |
| with: | |
| oidc-provider-name: ${{ vars.OIDC_PROVIDER_NAME }} | |
| oidc-audience: ${{ vars.OIDC_AUDIENCE }} | |
| server-edition: enterprise | |
| features-content: ${{ secrets.FEATURES_CONTENT }} | |
| server-tag: ${{ env.SERVER_TAG }} | |
| - run: python3 -m pytest --cov=aerospike_helpers --cov-report xml:coverage.xml ./new_tests | |
| working-directory: test | |
| - name: Copy over source files to build dir | |
| if: ${{ !cancelled() }} | |
| # The build/temp*/src/main directory will contain a hierarchy of object .o files | |
| # But the source files must be stored in the same folder hierarchy at build/temp*/src/main/src/main | |
| run: | | |
| cd build/temp*/src/main | |
| mkdir -p src/main/ | |
| mkdir -p cdt_types/src/main/cdt_types | |
| mkdir -p client/src/main/client | |
| mkdir -p geospatial/src/main/geospatial | |
| mkdir -p global_hosts/src/main/global_hosts | |
| mkdir -p key_ordered_dict/src/main/key_ordered_dict | |
| mkdir -p nullobject/src/main/nullobject | |
| mkdir -p query/src/main/query | |
| mkdir -p scan/src/main/scan | |
| mkdir -p transaction/src/main/transaction | |
| mkdir -p config_provider/src/main/config_provider | |
| cd ../../../../ | |
| cp src/main/*.c build/temp*/src/main/src/main | |
| cp src/main/cdt_types/*.c build/temp*/src/main/cdt_types/src/main/cdt_types/ | |
| cp src/main/client/*.c build/temp*/src/main/client/src/main/client/ | |
| cp src/main/geospatial/*.c build/temp*/src/main/geospatial/src/main/geospatial/ | |
| cp src/main/global_hosts/*.c build/temp*/src/main/global_hosts/src/main/global_hosts/ | |
| cp src/main/key_ordered_dict/*.c build/temp*/src/main/key_ordered_dict/src/main/key_ordered_dict/ | |
| cp src/main/nullobject/*.c build/temp*/src/main/nullobject/src/main/nullobject/ | |
| cp src/main/query/*.c build/temp*/src/main/query/src/main/query/ | |
| cp src/main/scan/*.c build/temp*/src/main/scan/src/main/scan/ | |
| cp src/main/transaction/*.c build/temp*/src/main/transaction/src/main/transaction/ | |
| cp src/main/config_provider/*.c build/temp*/src/main/config_provider/src/main/config_provider/ | |
| - name: Generate coverage report for all object files | |
| if: ${{ !cancelled() }} | |
| run: | | |
| cd build/temp*/src/main | |
| find . -type f -name "*.o" -execdir gcov {} \; | |
| - name: Move aerospike_helpers coverage report to this directory | |
| if: ${{ !cancelled() }} | |
| run: mv test/coverage.xml build/temp*/src/main | |
| - name: Upload coverage report folder to Github | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: ${{ env.COVERAGE_REPORT_ARTIFACT_NAME }} | |
| path: build/temp*/src/main/ | |
| coverage-upload: | |
| needs: generate-coverage-report | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-22.04 | |
| env: | |
| COVERAGE_REPORT_DIR: coverage-report | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| submodules: recursive | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: ${{ env.COVERAGE_REPORT_ARTIFACT_NAME }} | |
| path: ./${{ env.COVERAGE_REPORT_DIR }} | |
| - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| directory: ${{ env.COVERAGE_REPORT_DIR }} | |
| verbose: true # optional (default = false) | |
| fail_ci_if_error: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| test-stubs-or-code-examples: | |
| strategy: | |
| matrix: | |
| test: [ | |
| stubtest, | |
| doctest, | |
| code-examples | |
| ] | |
| fail-fast: false | |
| needs: [ | |
| get-env-vars, | |
| build | |
| ] | |
| env: | |
| SPHINX_MINIMUM_SUPPORTED_PYTHON_VERSION: 3.12 | |
| runs-on: ${{ needs.build.outputs.runner-os-used-for-build }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: ${{ env.SPHINX_MINIMUM_SUPPORTED_PYTHON_VERSION }} | |
| architecture: 'x64' | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: ${{ vars.GH_ARTIFACT_NAME_PREFIX_FOR_BUILDS }}-${{ env.SPHINX_MINIMUM_SUPPORTED_PYTHON_VERSION }}-${{ env.PLATFORM_TAG }} | |
| - name: Install client | |
| run: pip install ./*.whl | |
| - if: ${{ matrix.test == 'doctest' || matrix.test == 'code-examples' }} | |
| uses: aerospike/shared-workflows/.github/actions/setup-aerospike-server@bd168dedaa4fc0b17a560541779d815540eded2d # v3.7.0 | |
| with: | |
| num-nodes: 1 | |
| oidc-provider: ${{ vars.OIDC_PROVIDER_NAME }} | |
| oidc-audience: ${{ vars.OIDC_AUDIENCE }} | |
| server-tag: ${{ matrix.test == 'code-examples' && '8.1.3.0-35-20260629033923' || needs.get-env-vars.outputs.server-tag }} | |
| server-container-repo: database-docker-virtual/aerospike-server | |
| config-file: ./.github/workflows/aerospike-ce.conf | |
| - name: Run canonical code examples | |
| if: ${{ matrix.test == 'code-examples' }} | |
| run: | | |
| # This is required for the TTL code example | |
| docker run --rm --network host aerospike/aerospike-tools asinfo -v "set-config:context=namespace;id=test;nsup-period=1" | |
| docker run --rm --network host aerospike/aerospike-tools asinfo -v "set-config:context=namespace;namespace=test;default-ttl=10S" | |
| python3 -m examples.run_all_examples | |
| - name: Install test dependencies | |
| if: ${{ matrix.test == 'doctest' }} | |
| run: | | |
| pip install -r requirements.txt | |
| sphinx-build -b doctest . doctest | |
| working-directory: doc | |
| shell: bash -ex {0} | |
| - name: Validate type stubs | |
| if: ${{ matrix.test == 'stubtest' }} | |
| run: | | |
| pip install mypy -c .github/workflows/requirements.txt | |
| stubtest aerospike --allowlist stubtest-allowlist --ignore-disjoint-bases | |
| shell: bash -ex {0} | |
| test-sanitizer: | |
| needs: get-env-vars | |
| uses: ./.github/workflows/build-and-optionally-test-wheels-on-one-platform.yml | |
| with: | |
| python-versions: '["${{ needs.get-env-vars.outputs.lowest-supported-python-version }}"]' | |
| platform-tag: ${{ needs.get-env-vars.outputs.platform-tag }} | |
| run_tests: true | |
| server-tag: ${{ needs.get-env-vars.outputs.server-tag }} | |
| env-vars-for-building: SKIP_REPAIR_WHEEL=1;SANITIZER=1 | |
| secrets: inherit | |
| test-full-suite: | |
| needs: [ | |
| build, | |
| get-env-vars | |
| ] | |
| strategy: | |
| matrix: | |
| type: | |
| - dont_validate_keys | |
| # This is disabled because the test code's strong consistency test returns an error | |
| # ns_info = as_client.info_all("get-config:context=namespace;namespace=test") | |
| # exception.ServerError: (1, 'invalid id from 127.0.0.1:4333', 'src/main/aerospike/as_info.c', 360, False) | |
| # - lowest_supported_server_version | |
| fail-fast: false | |
| uses: ./.github/workflows/test-artifact.yml | |
| with: | |
| runner-os-json-string: '"${{ needs.build.outputs.runner-os-used-for-build }}"' | |
| python-version: ${{ needs.get-env-vars.outputs.lowest-supported-python-version }} | |
| server-tag: ${{ matrix.type == 'lowest_supported_server_version' && '7.1' || needs.get-env-vars.outputs.server-tag }} | |
| validate-keys: false | |
| secrets: inherit | |
| test-ce: | |
| needs: [ | |
| build, | |
| get-env-vars | |
| ] | |
| strategy: | |
| matrix: | |
| py-version: ${{ fromJson(needs.build.outputs.python-versions) }} | |
| fail-fast: false | |
| uses: ./.github/workflows/test-artifact.yml | |
| with: | |
| runner-os-json-string: '"${{ needs.build.outputs.runner-os-used-for-build }}"' | |
| python-version: ${{ matrix.py-version }} | |
| server-tag: ${{ needs.get-env-vars.outputs.server-tag }} | |
| test-ce: true | |
| secrets: inherit | |
| test-ee: | |
| needs: [ | |
| build, | |
| get-env-vars | |
| ] | |
| uses: ./.github/workflows/test-artifact.yml | |
| with: | |
| runner-os-json-string: '"${{ needs.build.outputs.runner-os-used-for-build }}"' | |
| python-version: ${{ needs.get-env-vars.outputs.lowest-supported-python-version }} | |
| server-tag: ${{ needs.get-env-vars.outputs.server-tag }} | |
| test-file: 'test_{mrt_functionality,admin_*,compress}.py' | |
| secrets: inherit | |
| test-metrics: | |
| needs: build | |
| strategy: | |
| matrix: | |
| suffix: | |
| - ext_metrics_node_close_listener | |
| - ext_metrics_cluster_name | |
| fail-fast: false | |
| runs-on: ${{ needs.build.outputs.runner-os-used-for-build }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }} | |
| architecture: 'x64' | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: ${{ vars.GH_ARTIFACT_NAME_PREFIX_FOR_BUILDS }}-${{ env.LOWEST_SUPPORTED_PY_VERSION }}-${{ env.PLATFORM_TAG }} | |
| - run: python3 -m pip install ./*.whl | |
| - run: python3 -m pip install -r requirements.txt | |
| working-directory: test/standalone | |
| - run: python3 test_${{ matrix.suffix }}.py | |
| working-directory: test/standalone | |
| # This is an e2e test to check that the user agent was sent correctly to the server | |
| test-user-agent: | |
| needs: [ | |
| build, | |
| get-env-vars | |
| ] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test-script-args: | |
| - "false" | |
| - "true" | |
| - "true my_app_id" | |
| runs-on: ${{ needs.build.outputs.runner-os-used-for-build }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }} | |
| architecture: 'x64' | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: ${{ vars.GH_ARTIFACT_NAME_PREFIX_FOR_BUILDS }}-${{ env.LOWEST_SUPPORTED_PY_VERSION }}-${{ env.PLATFORM_TAG }} | |
| - run: python3 -m pip install ./*.whl | |
| - id: setup-aerospike-server | |
| uses: aerospike/shared-workflows/.github/actions/setup-aerospike-server@bd168dedaa4fc0b17a560541779d815540eded2d # v3.7.0 | |
| with: | |
| enable-security: ${{ startsWith(matrix.test-script-args, 'true') }} | |
| num-nodes: 1 | |
| oidc-provider: ${{ vars.OIDC_PROVIDER_NAME }} | |
| oidc-audience: ${{ vars.OIDC_AUDIENCE }} | |
| features-content: ${{ secrets.FEATURES_CONTENT }} | |
| server-tag: ${{ needs.get-env-vars.outputs.server-tag }} | |
| server-container-repo: database-docker-virtual/aerospike-server${{ startsWith(matrix.test-script-args, 'true') && '-enterprise' || '' }} | |
| # Even for server versions < 8.1 that don't support user agent, this client version should still work on older servers | |
| - name: Run client in background | |
| run: ./test-user-agent-e2e.bash ${{ matrix.test-script-args }} | |
| working-directory: test/standalone | |
| - if: ${{ !cancelled() }} | |
| run: | | |
| docker logs --tail 100 "$CONTAINER_NAME" | |
| env: | |
| CONTAINER_NAME: ${{ steps.setup-aerospike-server.outputs.container-names }} |