Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
76 changes: 76 additions & 0 deletions .github/workflows/staging-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Staging tests

on:
pull_request:
types: [labeled]
branches:
- master
- 'rel/**'
issue_comment:
types: [created]
workflow_dispatch:
inputs:
test_envs:
description: 'Tox test environments to run (e.g. py312)'
required: false
default: 'py314'
test_filter:
description: 'Pytest filter expression (-k flag)'
required: false
default: ''

concurrency:
group: staging-tests
cancel-in-progress: false

jobs:
staging-tests:
name: Staging tests
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && github.event.label.name == 'test-staging') ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/test-staging'))
runs-on:
group: infra1-runners-arc
labels: runners-small
steps:
- name: Get PR head SHA (comment trigger)
if: github.event_name == 'issue_comment'
id: pr
run: |
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
echo "sha=$(echo "$PR_DATA" | jq -r .head.sha)" >> "$GITHUB_OUTPUT"
echo "ref=$(echo "$PR_DATA" | jq -r .head.ref)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.pr.outputs.sha || github.event.pull_request.head.sha || github.sha }}

- name: Set up Python
uses: astral-sh/setup-uv@v6
with:
python-version: '3.14'

- name: Install dependencies
run: uv sync --group test --locked

- name: Clean staging environment
run: make clean-staging
env:
TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }}

- name: Load staging environment
run: make load-staging
env:
TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }}

- name: Run staging tests
run: |
make test-staging \
TEST_ENVS=${{ github.event.inputs.test_envs || 'py314' }} \
ADD_ARGS="${{ github.event.inputs.test_filter && format('-k {0}', github.event.inputs.test_filter) || '' }}"
env:
TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ docs/.hugo_build.lock

# Export artifacts from Docker export-controller service
packages/gooddata-sdk/tests/export/exports/default/

# Staging test fixture backups (created by conftest.py, self-heal on next run)
*.staging-backup
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,42 @@ docker compose --profile fdw up -d
This starts a PostgreSQL instance with the gooddata-fdw extension on port 2543.
## Run staging tests
Staging tests run against a shared GoodData staging environment instead of a local docker-compose stack.
They are useful for validating changes against a real deployment.
### Triggers
The staging tests workflow (`.github/workflows/staging-tests.yaml`) can be triggered in three ways:
1. **Label** — Add the `test-staging` label to a PR targeting `master` or `rel/**`.
2. **PR comment** — Post `/test-staging` as a comment on a PR.
3. **Manual dispatch** — Trigger from the Actions tab with optional `test_envs` and `test_filter` inputs.
Only one staging test run executes at a time (concurrency group `staging-tests`, non-cancelling).
### Running staging tests locally
You need a staging API token (`TOKEN`). The workflow uses the `PYTHON_SDK_STG_API_KEY` secret; locally you
pass it via the `TOKEN=` make argument:
```bash
# 1. Clean the staging workspace (removes previous test data)
make clean-staging TOKEN=<your-staging-token>
# 2. Load the demo layout into staging
make load-staging TOKEN=<your-staging-token>
# 3. Run the tests
make test-staging TOKEN=<your-staging-token>
# Optionally limit python version and test filter:
make test-staging TOKEN=<your-staging-token> TEST_ENVS=py312 ADD_ARGS="-k test_catalog"
```
The token is passed as a CLI argument (`--gd-test-token`) to pytest, **not** as an environment variable.
## Run continuous integration tests
Tests in pull request (PR) are executed using docker. The following is done to make test environment as close
to reproducible as possible:
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ test:
for project in $(NO_CLIENT_GD_PROJECTS_DIRS); do $(MAKE) -C packages/$${project} test || RESULT=$$?; done; \
exit $$RESULT

.PHONY: test-staging
test-staging:
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make test-staging TOKEN=<api-token>" && exit 1)
$(MAKE) -C packages/gooddata-sdk test-staging TOKEN=$(TOKEN)

.PHONY: clean-staging
clean-staging:
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make clean-staging TOKEN=<api-token>" && exit 1)
cd packages/tests-support && STAGING=1 TOKEN="$(TOKEN)" python clean_staging.py

.PHONY: load-staging
load-staging:
@test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make load-staging TOKEN=<api-token>" && exit 1)
cd packages/tests-support && STAGING=1 TOKEN="$(TOKEN)" python upload_demo_layout.py

.PHONY: release
release:
if [ -z "$(VERSION)" ]; then echo "Usage: 'make release VERSION=X.Y.Z'"; false; else \
Expand Down
Loading
Loading