Skip to content

Commit 74c5cd2

Browse files
Merge branch 'main' into resources-api
2 parents 292c8fb + d73efc2 commit 74c5cd2

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/e2e-dispatch.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: e2e tests on demand
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
edaqa_ref:
7+
description: 'ref of the eda-qa repository, default is main'
8+
required: false
9+
default: 'main'
10+
pull_request_target:
11+
types: [labeled]
12+
13+
env:
14+
EDA_QA_PATH: "./eda-qa"
15+
REGISTRY: quay.io
16+
QUAY_USER: ansible+eda_gha
17+
18+
jobs:
19+
api-e2e-tests:
20+
if: >
21+
(github.repository == 'ansible/eda-server' && github.event_name == 'workflow_dispatch') ||
22+
(github.repository == 'ansible/eda-server' && github.event_name == 'pull_request_target' &&
23+
contains(github.event.pull_request.labels.*.name, 'run-e2e'))
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@v2
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ env.QUAY_USER }}
34+
password: ${{ secrets.QUAY_PASSWORD }}
35+
36+
- name: Run api in background
37+
working-directory: tools/docker
38+
env:
39+
DJANGO_SETTINGS_MODULE: aap_eda.settings.default
40+
EDA_DEBUG: "false"
41+
run: |
42+
docker-compose -p eda -f docker-compose-dev.yaml build
43+
docker-compose -p eda -f docker-compose-dev.yaml up -d
44+
while ! curl -s http://localhost:8000/_healthz | grep -q "OK"; do
45+
echo "Waiting for API to be ready..."
46+
sleep 1
47+
done
48+
49+
- name: Fetch test suite
50+
uses: actions/checkout@v3
51+
with:
52+
fetch-depth: 0
53+
repository: ansible/eda-qa
54+
ref: ${{ github.event.inputs.edaqa_ref }}
55+
path: ${{ env.EDA_QA_PATH }}
56+
token: ${{ secrets.EDA_QA_GITHUB_TOKEN }}
57+
58+
- name: Set up Python
59+
uses: actions/setup-python@v4
60+
with:
61+
python-version: "3.9"
62+
63+
- name: Install dependencies
64+
working-directory: ${{ env.EDA_QA_PATH }}
65+
run: pip install .
66+
67+
- name: Run tests
68+
working-directory: ${{ env.EDA_QA_PATH }}
69+
env:
70+
EDAQA_FERNET_PASSWORD: ${{ secrets.EDAQA_FERNET_PASSWORD }}
71+
EDAQA_ENV: authenticated
72+
run: pytest
73+
74+
- name: Print EDA logs
75+
if: always()
76+
working-directory: tools/docker
77+
run: |
78+
docker-compose -p eda -f docker-compose-dev.yaml logs
79+

0 commit comments

Comments
 (0)