Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow for stage tests #296

Merged
merged 6 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/stage-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Dreambuilder stage tests
on:
push:
branches:
- "main"
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: |
mkdir compose/.envs && touch compose/.envs/.env.stage && echo ${{ secrets.STAGE__ENV_DATA}} > compose/.envs/.env.stage
- name: Create client_secret
run: |
touch client_secret.json && echo ${{ secrets.CLIENT_SECRET}} > client_secret.json
- name: Create .env for tests
run: |
touch compose/.envs/.env.test && echo ${{ secrets.STAGE__TEST_ENV}} > compose/.envs/.env.test
- name: Build stack
run: docker-compose -f compose/stage/docker-compose.stage.yml build --no-cache postgres redis auth-api distributions-api deployment-worker
- name: Start stack
run: |
docker-compose -f compose/stage/docker-compose.stage.yml up -d postgres redis
docker-compose -f compose/stage/docker-compose.stage.yml up -d auth-api
docker-compose -f compose/stage/docker-compose.stage.yml up -d distributions-api deployment-worker
- name: Build tests
run: |
docker-compose -f compose/stage/docker-compose.stage.yml up tests
12 changes: 11 additions & 1 deletion compose/stage/docker-compose.stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,17 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
# depends_on:
# - redis

tests:
env_file: [ ../.envs/.env.test ]
restart: on-failure
build:
context: ../..
dockerfile: ./tests/backend/Dockerfile
volumes:
- ../../apiconfig:/src/apiconfig
- ../../database:/src/database
- ../../git_storage:/src/git_storage
- ../../tests:/src/tests
#
# flower:
# env_file: [ ../.envs/.env.dev.local ]
Expand Down
7 changes: 5 additions & 2 deletions tests/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ WORKDIR src/
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONBUFFERED 1

COPY tests/backend/requirements.txt .
RUN apt-get update && apt-get install -y --no-install-recommends git

COPY tests/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY services/ services/
COPY tests/backend /src/tests/backend

CMD ["pytest", "tests/backend", "-v"]
CMD ["pytest", "tests/backend", "-sv", "-m", "regression"]
Binary file modified tests/requirements.txt
Binary file not shown.
Loading