diff --git a/.github/workflows/matrix-slow.yml b/.github/workflows/matrix-slow.yml new file mode 100644 index 0000000..734f9b1 --- /dev/null +++ b/.github/workflows/matrix-slow.yml @@ -0,0 +1,37 @@ +name: Build Matrix (Slow Tests) + +on: + workflow_call: + outputs: + matrix: + description: "Generates the slow test build matrix" + value: ${{ jobs.set-matrix-slow.outputs.matrix }} + +jobs: + set-matrix-slow: + runs-on: "ubuntu-24.04" + permissions: + contents: read + steps: + - name: Check out Repository + id: check-out-repository + uses: actions/checkout@v6 + + - name: Set up Python & Poetry Environment + id: set-up-python-and-poetry-environment + uses: exasol/python-toolbox/.github/actions/python-environment@v7 + with: + python-version: "3.10" + poetry-version: "2.3.0" + + - name: Generate Matrix + id: generate-matrix + run: poetry run -- nox -s matrix:slow + + - name: Set Matrix + id: set-matrix + run: | + echo "matrix=$(poetry run -- nox -s matrix:slow)" >> $GITHUB_OUTPUT + + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} diff --git a/.github/workflows/slow-checks.yml b/.github/workflows/slow-checks.yml index 70a744c..ff33e3e 100644 --- a/.github/workflows/slow-checks.yml +++ b/.github/workflows/slow-checks.yml @@ -4,12 +4,22 @@ on: workflow_call: jobs: + build-slow-matrix: + name: Build Slow Matrix + uses: ./.github/workflows/matrix-slow.yml + permissions: + contents: read run-integration-tests: - name: Run Integration Tests + name: Run Integration Tests (${{ matrix.test-name }}) + needs: + - build-slow-matrix runs-on: "ubuntu-24.04" permissions: contents: read + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.build-slow-matrix.outputs.matrix) }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: @@ -26,7 +36,10 @@ jobs: - name: Run Integration Tests id: run-integration-tests - run: poetry run -- nox -s test:integration -- --coverage + run: | + poetry run coverage run \ + --rcfile=pyproject.toml \ + -m pytest -v "${{ matrix.test-path }}" env: SAAS_HOST: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_HOST }} SAAS_ACCOUNT_ID: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_ACCOUNT_ID }} @@ -38,6 +51,6 @@ jobs: id: upload-artifacts uses: actions/upload-artifact@v7 with: - name: coverage-python3.10-slow + name: coverage-python3.10-slow-${{ matrix.test-name }} path: .coverage include-hidden-files: true diff --git a/noxfile.py b/noxfile.py index 17822bb..da0fa24 100644 --- a/noxfile.py +++ b/noxfile.py @@ -26,6 +26,19 @@ DEST_DIR = "exasol/saas/client/openapi" +def _slow_test_matrix() -> dict[str, list[dict[str, str]]]: + files = sorted(Path("test/integration").glob("test_*.py")) + return { + "include": [ + { + "test-name": path.stem.removeprefix("test_").replace("_", "-"), + "test-path": str(path), + } + for path in files + ] + } + + def _download_openapi_json() -> Path: url = f"{SAAS_HOST}/openapi.json" response = requests.get(url) @@ -127,3 +140,9 @@ def check_api_outdated(session: Session): """ generate_api(session) session.run("git", "diff", "--exit-code", DEST_DIR) + + +@nox.session(name="matrix:slow", python=False) +def slow_matrix(session: Session): + """Output the build matrix for slow integration tests as JSON.""" + print(json.dumps(_slow_test_matrix()))