Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support network, add more host URLs, and set default tests to preview.gov.tools #2805

Merged
merged 5 commits into from
Jan 30, 2025
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ on:
deployment:
required: true
type: choice
default: "govtool.cardanoapi.io/api"
default: "z6b8d2f7a-zca4a4c45-gtw.z937eb260.rustrocks.fr"
options:
- "sanchogov.tools/api"
- "staging.govtool.byron.network/api"
- "govtool.cardanoapi.io/api"
- "z6b8d2f7a-zca4a4c45-gtw.z937eb260.rustrocks.fr"
- "dev-sanchonet.govtool.byron.network/api"
- "be.gov.tools"
network:
required: true
type: choice
default: "preview"
options:
- "sanchonet"
- "preview"
- "mainnet"
- "preprod"

jobs:
backend-tests:
Expand Down Expand Up @@ -42,16 +54,9 @@ jobs:
fi
python ./setup.py
python -m pytest --alluredir allure-results
if [[ "${{ env.NETWORK }}" == "preprod" ]]; then
echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREPROD }}" >> $GITHUB_ENV
elif [[ "${{ env.NETWORK }}" == "sanchonet" ]]; then
echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_SANCHONET }}" >> $GITHUB_ENV
else
echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREVIEW }}" >> $GITHUB_ENV
fi
env:
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }}
NETWORK: ${{ vars.NETWORK }}
NETWORK: ${{ inputs.network || vars.NETWORK }}
KUBER_API_KEY: ${{ secrets.KUBER_API_KEY }}

- name: Upload report
Expand Down
28 changes: 17 additions & 11 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ on:
deployment:
required: true
type: choice
default: "govtool.cardanoapi.io"
default: "preview.gov.tools"
options:
- "sanchogov.tools"
- "staging.govtool.byron.network"
- "govtool.cardanoapi.io"
- "preview.gov.tools"
- "gov.tools"
network:
required: true
type: choice
default: "preview"
options:
- "sanchonet"
- "preview"
- "mainnet"
- "preprod"

workflow_run:
workflows: ["Build and deploy GovTool to TEST server"]
Expand Down Expand Up @@ -56,23 +65,19 @@ jobs:
chmod +w ./lib/_mock
npm run generate-wallets

# Set network variables based on deployment input and environment
if [[ "${{inputs.deployment}}" == "gov.tools" ]]; then
export NETWORK='mainnet'
else
export NETWORK="${{ vars.NETWORK }}"
fi

# Set API keys based on the network
if [[ "${{ vars.NETWORK }}" == "preprod" ]]; then
if [[ "${{ env.NETWORK }}" == "preprod" ]]; then
export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_PREPROD }}"
export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_PREPROD }}"
elif [[ "${{ vars.NETWORK }}" == "sanchonet" ]]; then
elif [[ "${{ env.NETWORK }}" == "sanchonet" ]]; then
export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_SANCHONET }}"
export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_SANCHONET }}"
else
elif [[ "${{ env.NETWORK }}" == "preview" ]]; then
export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_PREVIEW }}"
export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_PREVIEW }}"
else
export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_PREVIEW }}"
export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_MAINNET }}"
fi

npm test
Expand All @@ -96,6 +101,7 @@ jobs:
API_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}/api
DOCS_URL: ${{ vars.DOCS_URL }}
KUBER_API_KEY: ${{secrets.KUBER_API_KEY}}
NETWORK: ${{ inputs.network || vars.NETWORK }}
TEST_WORKERS: ${{vars.TEST_WORKERS}}
CI: ${{vars.CI}}
FAUCET_ADDRESS: ${{vars.FAUCET_ADDRESS}}
Expand Down
2 changes: 1 addition & 1 deletion tests/govtool-backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
METRICS_API_SECRET = os.getenv("METRICS_API_SECRET")
KUBER_API_URL = f'https://{os.getenv("NETWORK","preview")}.kuber.cardanoapi.io'
KUBER_API_KEY = os.getenv("KUBER_API_KEY")
FAUCET_API_URL = f'https://faucet.${os.getenv("NETWORK","preview")}.world.dev.cardano.org'
FAUCET_API_URL = f'https://faucet.{os.getenv("NETWORK","preview")}.world.dev.cardano.org'
FACUET_API_KEY = os.getenv("FAUCET_API_KEY")