From f67dfb3245161abc056750a1c2efd4815921b2eb Mon Sep 17 00:00:00 2001 From: Ida Date: Wed, 20 May 2026 16:34:05 +0200 Subject: [PATCH] fix: tests on github --- .github/workflows/int_gateway-int.yml | 14 ++++++++++++-- .github/workflows/main_gateway-prod.yml | 13 ++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/int_gateway-int.yml b/.github/workflows/int_gateway-int.yml index 420f6b99..e2acf9d8 100644 --- a/.github/workflows/int_gateway-int.yml +++ b/.github/workflows/int_gateway-int.yml @@ -18,6 +18,7 @@ concurrency: jobs: test: runs-on: ubuntu-latest + environment: Production steps: - uses: actions/checkout@v5 @@ -41,10 +42,19 @@ jobs: pip install -r requirements.txt --no-cache-dir fi + - name: Verify CONFIG_KEY for pytest + env: + CONFIG_KEY: ${{ secrets.CONFIG_KEY }} + run: | + if [ -z "${CONFIG_KEY}" ]; then + echo "::error::CONFIG_KEY is empty in GitHub Environment 'Production'. Add the int master key as CONFIG_KEY there (must decrypt INT_ENC:* in env-gateway-int.env)." + exit 1 + fi + echo "CONFIG_KEY is set (${#CONFIG_KEY} characters)." + - name: Run tests env: - # env-gateway-int.env: APP_KEY_SYSVAR=CONFIG_KEY — int master key for INT_ENC:* secrets - CONFIG_KEY: ${{ secrets.CONFIG_KEY_INT }} + CONFIG_KEY: ${{ secrets.CONFIG_KEY }} run: python -m pytest tests/ --ignore=tests/demo build: diff --git a/.github/workflows/main_gateway-prod.yml b/.github/workflows/main_gateway-prod.yml index cbd3197c..34846800 100644 --- a/.github/workflows/main_gateway-prod.yml +++ b/.github/workflows/main_gateway-prod.yml @@ -18,6 +18,8 @@ concurrency: jobs: test: runs-on: ubuntu-latest + # Same GitHub Environment as deploy — CONFIG_KEY lives here (not on the build job). + environment: Production steps: - uses: actions/checkout@v5 @@ -41,9 +43,18 @@ jobs: pip install -r requirements.txt --no-cache-dir fi + - name: Verify CONFIG_KEY for pytest + env: + CONFIG_KEY: ${{ secrets.CONFIG_KEY }} + run: | + if [ -z "${CONFIG_KEY}" ]; then + echo "::error::CONFIG_KEY is empty in GitHub Environment 'Production'. Azure App Service settings are not visible to this job — add CONFIG_KEY under Settings → Environments → Production → Environment secrets (same value as in Azure portal)." + exit 1 + fi + echo "CONFIG_KEY is set (${#CONFIG_KEY} characters)." + - name: Run tests env: - # env-gateway-prod.env: APP_KEY_SYSVAR=CONFIG_KEY — prod master key for PROD_ENC:* secrets CONFIG_KEY: ${{ secrets.CONFIG_KEY }} run: python -m pytest tests/ --ignore=tests/demo