From 40ebf7751d0af9a3083973b7b3c22b2a6cac342f Mon Sep 17 00:00:00 2001 From: Anastasiia Pokasova Date: Thu, 25 Apr 2024 11:23:12 +0300 Subject: [PATCH 1/6] Add workflow for stage tests --- .github/workflows/stage-tests.yml | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/stage-tests.yml diff --git a/.github/workflows/stage-tests.yml b/.github/workflows/stage-tests.yml new file mode 100644 index 000000000..0b5677732 --- /dev/null +++ b/.github/workflows/stage-tests.yml @@ -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 From fefde8be6faec97a8ef426e41949304c5ecfb660 Mon Sep 17 00:00:00 2001 From: Anastasiia Pokasova Date: Thu, 25 Apr 2024 11:40:06 +0300 Subject: [PATCH 2/6] Update tests Dockerfile --- tests/backend/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/backend/Dockerfile b/tests/backend/Dockerfile index e14d098c4..021b5c2be 100644 --- a/tests/backend/Dockerfile +++ b/tests/backend/Dockerfile @@ -5,9 +5,11 @@ 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 tests/backend /src/tests/backend -CMD ["pytest", "tests/backend", "-v"] +CMD ["pytest", "tests/backend", "-sv", "-m", "regression"] From 91126420fd4bf95e38e6de343eb3b65d4d710556 Mon Sep 17 00:00:00 2001 From: Anastasiia Pokasova Date: Thu, 25 Apr 2024 11:59:41 +0300 Subject: [PATCH 3/6] Add stage tests config docker-compose.stage.yml --- compose/stage/docker-compose.stage.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compose/stage/docker-compose.stage.yml b/compose/stage/docker-compose.stage.yml index 5e03c286e..f1bba62ac 100644 --- a/compose/stage/docker-compose.stage.yml +++ b/compose/stage/docker-compose.stage.yml @@ -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 ] From 25bd173f29040db0121f684525c9bdf8062d62d7 Mon Sep 17 00:00:00 2001 From: Anastasiia Pokasova Date: Thu, 25 Apr 2024 12:02:12 +0300 Subject: [PATCH 4/6] Update docker-compose.stage.yml --- compose/stage/docker-compose.stage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/stage/docker-compose.stage.yml b/compose/stage/docker-compose.stage.yml index f1bba62ac..d01672cb4 100644 --- a/compose/stage/docker-compose.stage.yml +++ b/compose/stage/docker-compose.stage.yml @@ -117,7 +117,7 @@ services: - ../../apiconfig:/src/apiconfig - ../../database:/src/database - ../../git_storage:/src/git_storage - -../../tests:/src/tests + - ../../tests:/src/tests # # flower: # env_file: [ ../.envs/.env.dev.local ] From 268681db781f8338311884d8138c8492429490ac Mon Sep 17 00:00:00 2001 From: Anastasiia Pokasova Date: Thu, 25 Apr 2024 12:12:55 +0300 Subject: [PATCH 5/6] Update requirements.txt --- tests/requirements.txt | Bin 432 -> 310 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 0ca63e0e2052a564535c0990eefd9c526863b7cd..668627c20fdace6a9a605b42035de9eb5d2d6e98 100644 GIT binary patch literal 310 zcmYk0L2AS>3`O??bBZoYl-LPOTM+aJWj0+FHx`M(wvt%MbZ%d}VQ6;J*XQXCPM$}R zDZSP8;AC9Cq32LrqG>Xl=j||l*@a9HW}n_IZBH}|_+LC+&!_1wlmzht3iSE3(7fh7 zA!^Vsp#BOY$I7x$+z=bk3YrpI6UFt23SLVvn?%)v)@9luD}XE;IA(CZK)3fDBetN+ zo2!YIL-omv-76}Gi9AKO2E-07MK8_X_m;>EKhf&*F1;`Z}uRZkX>p=S>Drn4+D4{l(%(G6r4e+9moA<1)D&O@$rQ~Vw9D8YR%dFb7>IVVbKq3GD From 357a3b59ed3517ce4323e4d4c205827880437d1d Mon Sep 17 00:00:00 2001 From: Anastasiia Pokasova Date: Thu, 25 Apr 2024 13:23:22 +0300 Subject: [PATCH 6/6] Update Dockerfile --- tests/backend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/backend/Dockerfile b/tests/backend/Dockerfile index 021b5c2be..e27cb6447 100644 --- a/tests/backend/Dockerfile +++ b/tests/backend/Dockerfile @@ -10,6 +10,7 @@ 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", "-sv", "-m", "regression"]