feat: (DDOS-6506) ensure all write paths apply tags across the client #454
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: Run Level 1 Tests | |
| on: | |
| schedule: | |
| - cron: "0 6 * * *" | |
| pull_request: | |
| paths: | |
| - "**/*.py" | |
| workflow_dispatch: | |
| inputs: | |
| test_level: | |
| description: "Test level to run" | |
| type: choice | |
| default: lv1 | |
| options: | |
| - lv1 | |
| - lv2 | |
| workflow_call: | |
| inputs: | |
| env: | |
| description: "Target environment (dev, staging, or prod)" | |
| type: string | |
| required: true | |
| test_level: | |
| description: "Test level to run (lv1 or lv2)" | |
| type: string | |
| required: false | |
| default: lv1 | |
| jobs: | |
| level-1-tests: | |
| # Only run live tests (with secrets) for non-PR events or PRs from org members/collaborators. | |
| # Prevents external fork PRs from receiving DO_AUTH_TOKEN_* and CI_BOT_GH_PAT. | |
| if: | | |
| github.event_name != 'pull_request' || | |
| contains(fromJSON('["MEMBER","OWNER","COLLABORATOR"]'), | |
| github.event.pull_request.author_association) | |
| runs-on: ubuntu-latest | |
| environment: ${{ matrix.env }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.13"] | |
| env: ${{ fromJSON((inputs.env && format('["{0}"]', inputs.env)) || '["dev","staging","prod"]') }} | |
| steps: | |
| - name: Validate workflow inputs | |
| if: ${{ inputs.env != '' }} | |
| run: | | |
| case "${{ inputs.env }}" in dev|staging|prod) ;; *) echo "Invalid env: ${{ inputs.env }}"; exit 1 ;; esac | |
| case "${{ inputs.test_level }}" in lv1|lv2) ;; *) echo "Invalid test_level: ${{ inputs.test_level }}"; exit 1 ;; esac | |
| - uses: actions/checkout@v6 | |
| with: | |
| repository: deeporiginbio/do-dd-client | |
| ref: ${{ github.event_name == 'release' && 'main' || github.ref }} | |
| token: ${{ github.event_name == 'release' && secrets.CI_BOT_GH_PAT || secrets.GITHUB_TOKEN }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| version: "0.5.27" | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Set environment variables | |
| env: | |
| TARGET_ENV: ${{ matrix.env }} | |
| TOKEN_PROD: ${{ secrets.DO_AUTH_TOKEN_PROD }} | |
| TOKEN_STAGING: ${{ secrets.DO_AUTH_TOKEN_STAGING }} | |
| TOKEN_DEV: ${{ secrets.DO_AUTH_TOKEN_DEV }} | |
| run: | | |
| AUTH_TOKEN_VAR=$(python3 scripts/get_env_var_name.py access_token) | |
| ORG_KEY_VAR=$(python3 scripts/get_env_var_name.py org_key) | |
| ENV_VAR=$(python3 scripts/get_env_var_name.py env) | |
| echo "${ORG_KEY_VAR}=deeporigin" >> "$GITHUB_ENV" | |
| echo "${ENV_VAR}=${TARGET_ENV}" >> "$GITHUB_ENV" | |
| if [ "$TARGET_ENV" = "prod" ]; then | |
| echo "${AUTH_TOKEN_VAR}=${TOKEN_PROD}" >> "$GITHUB_ENV" | |
| elif [ "$TARGET_ENV" = "staging" ]; then | |
| echo "${AUTH_TOKEN_VAR}=${TOKEN_STAGING}" >> "$GITHUB_ENV" | |
| elif [ "$TARGET_ENV" = "dev" ]; then | |
| echo "${AUTH_TOKEN_VAR}=${TOKEN_DEV}" >> "$GITHUB_ENV" | |
| fi | |
| - name: Install dependencies | |
| run: uv sync --extra test --extra tools --extra plots --extra core | |
| - name: Set test level | |
| id: test_level | |
| env: | |
| INPUT_TEST_LEVEL: ${{ inputs.test_level }} | |
| INPUT_ENV: ${{ inputs.env }} | |
| EVENT_TEST_LEVEL: ${{ github.event.inputs.test_level }} | |
| run: | | |
| LEVEL="${INPUT_TEST_LEVEL:-${EVENT_TEST_LEVEL:-lv1}}" | |
| echo "TEST_LEVEL=${LEVEL}" >> "$GITHUB_ENV" | |
| if [[ -n "$INPUT_ENV" && "$LEVEL" == "lv2" ]]; then | |
| SELECTOR="lv1 or lv2" | |
| else | |
| SELECTOR="$LEVEL" | |
| fi | |
| echo "TEST_SELECTOR=${SELECTOR}" >> "$GITHUB_ENV" | |
| - name: "Running tests against a live instance" | |
| env: | |
| TARGET_ENV: ${{ matrix.env }} | |
| run: | | |
| uv run pytest --env "$TARGET_ENV" -k "$TEST_SELECTOR" \ | |
| --junitxml=sdk-test-results.xml \ | |
| --html=sdk-report.html --self-contained-html | |
| - name: Upload SDK test artifacts | |
| uses: actions/upload-artifact@v6 | |
| if: always() | |
| with: | |
| name: sdk-test-results-${{ matrix.env }}-${{ github.run_id }}-${{ github.run_attempt }} | |
| if-no-files-found: warn | |
| path: | | |
| sdk-report.html | |
| sdk-test-results.xml |