-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 2.07 KB
/
integration-tests.yml
File metadata and controls
64 lines (55 loc) · 2.07 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
# =====================================================
# CI/CD Workflow: Run Integration Tests
# =====================================================
# Description:
# This workflow executes integration tests for the project.
# It can run in different deployment environments (local, staging, production)
# and conditionally starts/stops local services using Docker Compose.
#
# Triggered via:
# - workflow_call (called from other workflows)
#
# Inputs:
# deployment_env: Deployment environment (e.g., local, staging, prod)
#
# Jobs:
# - run-integration-tests:
# Checks out code, installs dependencies, loads environment variables,
# optionally spins up Docker Compose services for local testing,
# executes integration tests, and cleans up resources.
# =====================================================
name: Run integration tests
on:
workflow_call:
inputs:
deployment_env:
required: true
type: string
description: "Deployment environment (e.g., pr, staging, prod)"
jobs:
run-integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
uv venv
uv pip install -r requirements.txt
- name: Load env vars from .env.test file
uses: xom9ikk/dotenv@v2
with:
path: . # project's root folder
mode: ${{ inputs.deployment_env == 'local' && 'test' || inputs.env_filename }} # .env.deployment_env
- name: Start services (docker-compose)
if: ${{ inputs.deployment_env == 'local' }}
run: docker compose -f docker/docker-compose.yml up --build -d
- name: Wait for pSQL to be ready
if: ${{ inputs.deployment_env == 'local' }}
run: sleep 30
- name: Execute base integration tests
run: uv run pytest tests/integration
- name: Destroy Docker resources
if: ${{ inputs.deployment_env == 'local' }}
run: docker compose -f docker/docker-compose.yml down