1+ name : RAG Module Integration Tests
2+
3+ on :
4+ pull_request :
5+ branches : [wip]
6+ types : [opened, synchronize, reopened]
7+ paths :
8+ - ' src/**'
9+ - ' tests/**'
10+ - ' data/**'
11+ - ' docker-compose-test.yml'
12+ - ' Dockerfile.llm_orchestration_service'
13+ - ' .github/workflows/pytest-integration-check.yml'
14+
15+ jobs :
16+ pytest-integration-tests :
17+ runs-on : ubuntu-latest
18+ timeout-minutes : 80
19+
20+ steps :
21+ - name : Checkout code
22+ uses : actions/checkout@v4
23+
24+ - name : Validate required secrets
25+ id : validate_secrets
26+ run : |
27+ echo "Validating required environment variables..."
28+ MISSING_SECRETS=()
29+
30+ # Check Azure OpenAI secrets
31+ if [ -z "${{ secrets.AZURE_OPENAI_ENDPOINT }}" ]; then
32+ MISSING_SECRETS+=("AZURE_OPENAI_ENDPOINT")
33+ fi
34+
35+ if [ -z "${{ secrets.AZURE_OPENAI_API_KEY }}" ]; then
36+ MISSING_SECRETS+=("AZURE_OPENAI_API_KEY")
37+ fi
38+
39+ if [ -z "${{ secrets.AZURE_OPENAI_DEPLOYMENT_NAME }}" ]; then
40+ MISSING_SECRETS+=("AZURE_OPENAI_DEPLOYMENT_NAME")
41+ fi
42+
43+ if [ -z "${{ secrets.AZURE_OPENAI_EMBEDDING_DEPLOYMENT }}" ]; then
44+ MISSING_SECRETS+=("AZURE_OPENAI_EMBEDDING_DEPLOYMENT")
45+ fi
46+
47+ if [ -z "${{ secrets.AZURE_OPENAI_EMBEDDING_ENDPOINT }}" ]; then
48+ MISSING_SECRETS+=("AZURE_OPENAI_EMBEDDING_ENDPOINT")
49+ fi
50+
51+ if [ -z "${{ secrets.SALT }}" ]; then
52+ MISSING_SECRETS+=("SALT")
53+ fi
54+
55+ if [ -z "${{ secrets.ENCRYPTION_KEY }}" ]; then
56+ MISSING_SECRETS+=("ENCRYPTION_KEY")
57+ fi
58+
59+ if [ -z "${{ secrets.NEXTAUTH_SECRET }}" ]; then
60+ MISSING_SECRETS+=("NEXTAUTH_SECRET")
61+ fi
62+
63+
64+ # If any secrets are missing, fail
65+ if [ ${#MISSING_SECRETS[@]} -gt 0 ]; then
66+ echo "missing=true" >> $GITHUB_OUTPUT
67+ echo "secrets_list=${MISSING_SECRETS[*]}" >> $GITHUB_OUTPUT
68+ echo " Missing required secrets: ${MISSING_SECRETS[*]}"
69+ exit 1
70+ else
71+ echo "missing=false" >> $GITHUB_OUTPUT
72+ echo " All required secrets are configured"
73+ fi
74+
75+ - name : Comment PR with missing secrets error
76+ if : failure() && steps.validate_secrets.outputs.missing == 'true'
77+ uses : actions/github-script@v7
78+ with :
79+ script : |
80+ const missingSecrets = '${{ steps.validate_secrets.outputs.secrets_list }}'.split(' ');
81+ const secretsList = missingSecrets.map(s => `- \`${s}\``).join('\n');
82+
83+ const comment = `## RAG Module Integration Tests: Missing Required Secrets
84+
85+ RAG Module Integration tests cannot run because the following GitHub secrets are not configured:
86+
87+ ${secretsList}
88+
89+ ### How to Fix
90+
91+ 1. Go to **Settings** → **Secrets and variables** → **Actions**
92+ 2. Add the missing secrets with the appropriate values:
93+
94+ **Azure OpenAI Configuration:**
95+ - \`AZURE_OPENAI_ENDPOINT\` - Your Azure OpenAI resource endpoint (e.g., \`https://your-resource.openai.azure.com/\`)
96+ - \`AZURE_OPENAI_API_KEY\` - Your Azure OpenAI API key
97+ - \`AZURE_OPENAI_DEPLOYMENT_NAME\` - Chat model deployment name (e.g., \`gpt-4o-mini\`)
98+ - \`AZURE_OPENAI_EMBEDDING_DEPLOYMENT\` - Embedding model deployment name (e.g., \`text-embedding-3-large\`)
99+
100+
101+ 3. Re-run the workflow after adding the secrets
102+
103+ ### Note
104+ Tests will not run until all required secrets are configured.
105+
106+ ---
107+ *Workflow: ${context.workflow} | Run: [#${context.runNumber}](${context.payload.repository.html_url}/actions/runs/${context.runId})*`;
108+
109+ // Find existing comment
110+ const comments = await github.rest.issues.listComments({
111+ owner: context.repo.owner,
112+ repo: context.repo.repo,
113+ issue_number: context.issue.number
114+ });
115+
116+ const existingComment = comments.data.find(
117+ comment => comment.user.login === 'github-actions[bot]' &&
118+ comment.body.includes('RAG Module Integration Tests: Missing Required Secrets')
119+ );
120+
121+ if (existingComment) {
122+ await github.rest.issues.updateComment({
123+ owner: context.repo.owner,
124+ repo: context.repo.repo,
125+ comment_id: existingComment.id,
126+ body: comment
127+ });
128+ } else {
129+ await github.rest.issues.createComment({
130+ owner: context.repo.owner,
131+ repo: context.repo.repo,
132+ issue_number: context.issue.number,
133+ body: comment
134+ });
135+ }
136+
137+ - name : Set up Python
138+ if : success()
139+ uses : actions/setup-python@v5
140+ with :
141+ python-version-file : ' .python-version'
142+
143+ - name : Set up uv
144+ if : success()
145+ uses : astral-sh/setup-uv@v6
146+
147+ - name : Install dependencies (locked)
148+ if : success()
149+ run : uv sync --frozen
150+
151+ - name : Create test directories with proper permissions
152+ if : success()
153+ run : |
154+ mkdir -p test-vault/agents/llm
155+ mkdir -p test-vault/agent-out
156+ # Set ownership to current user and make writable
157+ sudo chown -R $(id -u):$(id -g) test-vault
158+ chmod -R 777 test-vault
159+ # Ensure the agent-out directory is world-readable after writes
160+ sudo chmod -R a+rwX test-vault/agent-out
161+
162+ - name : Make Cron-Manager scripts executable
163+ if : success()
164+ run : |
165+ chmod +x DSL/CronManager/script/*.sh
166+ ls -la DSL/CronManager/script/
167+
168+ - name : Build Docker images
169+ if : success()
170+ run : docker compose -f docker-compose-test.yml build
171+
172+ - name : Run Pytest Integration tests with testcontainers
173+ if : success()
174+ id : run_tests
175+ env :
176+ # Azure OpenAI - Chat Model
177+ AZURE_OPENAI_API_KEY : ${{ secrets.AZURE_OPENAI_API_KEY }}
178+ AZURE_OPENAI_ENDPOINT : ${{ secrets.AZURE_OPENAI_ENDPOINT }}
179+ AZURE_OPENAI_DEPLOYMENT_NAME : ${{ secrets.AZURE_OPENAI_DEPLOYMENT_NAME }}
180+ # Azure OpenAI - Embedding Model
181+ AZURE_OPENAI_EMBEDDING_DEPLOYMENT : ${{ secrets.AZURE_OPENAI_EMBEDDING_DEPLOYMENT }}
182+ AZURE_OPENAI_EMBEDDING_ENDPOINT : ${{ secrets.AZURE_OPENAI_EMBEDDING_ENDPOINT }}
183+ SALT : ${{ secrets.SALT }}
184+ ENCRYPTION_KEY : ${{ secrets.ENCRYPTION_KEY }}
185+ NEXTAUTH_SECRET : ${{ secrets.NEXTAUTH_SECRET }}
186+ run : |
187+ # Run tests with testcontainers managing Docker Compose
188+ uv run python -m pytest tests/integration_tests/ -v --tb=short --log-cli-level=INFO
189+
190+ - name : Fix permissions on test artifacts
191+ if : always()
192+ run : |
193+ sudo chown -R $(id -u):$(id -g) test-vault || true
194+ sudo chmod -R a+rX test-vault || true
195+
196+ - name : Cleanup Docker resources
197+ if : always()
198+ run : |
199+ docker compose -f docker-compose-test.yml down -v --remove-orphans || true
200+ docker system prune -f || true
0 commit comments