Skip to content

Composite jobs (#349) #334

Composite jobs (#349)

Composite jobs (#349) #334

name: Test DO Functions
on:
workflow_dispatch:
inputs:
env:
description: "Target environment"
type: choice
required: true
default: prod
options: [edge, staging,prod]
# Run every day
schedule:
- cron: "0 6 * * *"
# Run on changes to Python files in src/functions/
push:
paths:
- 'src/functions/**/*.py'
jobs:
test-functions-on-production:
environment: ${{ inputs.env || 'prod' }}
runs-on: ubuntu-latest
env:
DEEP_ORIGIN_ENV: ${{ inputs.env || 'prod' }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.5.27"
- name: Set up Python
run: uv python install
- name: Select API token
run: |
ENV="${{ inputs.env || 'prod' }}"
if [ "$ENV" = "prod" ]; then
echo "DEEPORIGIN_TOKEN=${{ secrets.DEEPORIGIN_TOKEN_PROD }}" >> "$GITHUB_ENV"
echo "DEEPORIGIN_REFRESH_TOKEN=${{ secrets.DEEPORIGIN_REFRESH_TOKEN_PROD }}" >> "$GITHUB_ENV"
echo "DEEPORIGIN_ORG_KEY=${{ secrets.DEEPORIGIN_ORG_KEY_PROD }}" >> "$GITHUB_ENV"
elif [ "$ENV" = "staging" ]; then
echo "DEEPORIGIN_TOKEN=${{ secrets.DEEPORIGIN_TOKEN_STAGING }}" >> "$GITHUB_ENV"
echo "DEEPORIGIN_REFRESH_TOKEN=${{ secrets.DEEPORIGIN_REFRESH_TOKEN_STAGING }}" >> "$GITHUB_ENV"
echo "DEEPORIGIN_ORG_KEY=${{ secrets.DEEPORIGIN_ORG_KEY_STAGING }}" >> "$GITHUB_ENV"
elif [ "$ENV" = "edge" ]; then
echo "DEEPORIGIN_TOKEN=${{ secrets.DEEPORIGIN_TOKEN_EDGE }}" >> "$GITHUB_ENV"
echo "DEEPORIGIN_REFRESH_TOKEN=${{ secrets.DEEPORIGIN_REFRESH_TOKEN_EDGE }}" >> "$GITHUB_ENV"
echo "DEEPORIGIN_ORG_KEY=${{ secrets.DEEPORIGIN_ORG_KEY_EDGE }}" >> "$GITHUB_ENV"
fi
- name: Set environment variables for Client
run: |
echo "DEEPORIGIN_ENV=${{ inputs.env || 'prod' }}" >> "$GITHUB_ENV"
- name: Install dependencies
run: uv sync --extra tools --extra test --extra plots
- name: Run tests against a live instance
run: uv run pytest -v -s --log-cli-level=ERROR -k test_functions