-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (62 loc) · 2.22 KB
/
Copy pathpytest_dispatch.yml
File metadata and controls
70 lines (62 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Dispatch pytest (-k)
on:
workflow_dispatch:
inputs:
environment:
description: Platform API environment to run tests against
type: choice
options:
- dev
- staging
- prod
required: true
test_expression:
description: Pytest -k expression (e.g. test name substring or keyword expression)
type: string
required: true
jobs:
pytest:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v6
- name: Validate test expression
env:
TEST_EXPR: ${{ inputs.test_expression }}
run: |
if [ -z "${TEST_EXPR// }" ]; then
echo "::error::test_expression cannot be empty"
exit 1
fi
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
version: "0.5.27"
- name: Set up Python
run: uv python install 3.13
- name: Set environment variables
env:
TARGET_ENV: ${{ inputs.environment }}
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: Run pytest
env:
TARGET_ENV: ${{ inputs.environment }}
TEST_K: ${{ inputs.test_expression }}
run: uv run pytest --env "$TARGET_ENV" -k "$TEST_K" -v