-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workflow for e2e test run on demand
- Loading branch information
1 parent
5c93d12
commit db57891
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: e2e tests on demand | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
edaqa_ref: | ||
description: 'ref of the eda-qa repository, default is main' | ||
required: false | ||
default: 'main' | ||
|
||
env: | ||
EDA_QA_PATH: "./eda-qa" | ||
REGISTRY: quay.io | ||
QUAY_USER: ansible+eda_gha | ||
|
||
jobs: | ||
api-e2e-tests: | ||
if: github.repository == 'ansible/eda-server' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ env.QUAY_USER }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Run api in background | ||
working-directory: tools/docker | ||
env: | ||
DJANGO_SETTINGS_MODULE: aap_eda.settings.default | ||
EDA_DEBUG: "false" | ||
run: | | ||
docker-compose -p eda -f docker-compose-dev.yaml pull | ||
docker-compose -p eda -f docker-compose-dev.yaml build | ||
docker-compose -p eda -f docker-compose-dev.yaml up -d | ||
while ! curl -s http://localhost:8000/_healthz | grep -q "OK"; do | ||
echo "Waiting for API to be ready..." | ||
sleep 1 | ||
done | ||
- name: Fetch test suite | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
repository: ansible/eda-qa | ||
ref: ${{ github.event.inputs.edaqa_ref }} | ||
path: ${{ env.EDA_QA_PATH }} | ||
token: ${{ secrets.EDA_QA_GITHUB_TOKEN }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install dependencies | ||
working-directory: ${{ env.EDA_QA_PATH }} | ||
run: pip install . | ||
|
||
- name: Run tests | ||
working-directory: ${{ env.EDA_QA_PATH }} | ||
env: | ||
EDAQA_FERNET_PASSWORD: ${{ secrets.EDAQA_FERNET_PASSWORD }} | ||
EDAQA_ENV: authenticated | ||
run: pytest | ||
|
||
- name: Print EDA logs | ||
if: always() | ||
working-directory: tools/docker | ||
run: | | ||
docker-compose -p eda -f docker-compose-stage.yaml logs | ||