Skip to content

Commit

Permalink
conf
Browse files Browse the repository at this point in the history
  • Loading branch information
dtuchs committed Jun 23, 2024
1 parent ea203ee commit f231ac6
Show file tree
Hide file tree
Showing 12 changed files with 251 additions and 126 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/api-stage.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/auth-stage.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/client-stage.yaml

This file was deleted.

121 changes: 121 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: auth-stage
on:
pull_request:
types: [opened, reopened, synchronize]
branches-ignore:
- master

jobs:
e2e:
runs-on: ubuntu-latest
env:
PROFILE: docker
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.6
- name: Build back
working-directory: ./
run: |
pwd
gradle jib -x :rococo-e2e:test
- name: Build frontend
working-directory: ./rococo-client
run: |
pwd
docker build --build-arg PROFILE=${{ env.PROFILE }} -t dtuchs/rococo-client-${{ env.PROFILE }}:0.0.1-SNAPSHOT -t dtuchs/rococo-client-${{ env.PROFILE }}:latest .
cd ../ || exit 1
- name: Build tests
working-directory: ./
run: |
pwd
docker build --build-arg ALLURE=${{ secrets.ALLURE_DOCKER_API }} -t dtuchs/rococo-e2e:latest -f ./rococo-e2e/Dockerfile .
- name: Pull chrome
run: |
docker pull selenoid/vnc_chrome:125.0
- name: Run tests
run: |
docker-compose -f docker-compose-e2e.yml up -d
docker ps -a
docker wait rococo-e2e
exit_code=$(docker inspect -f '{{.State.ExitCode}}' rococo-e2e)
echo "### Test logs ###"
docker logs rococo-e2e
docker-compose -f docker-compose-e2e.yml down
docker system prune -a -f
if [ "$exit_code" -eq "0" ]; then
echo "Tests passed successfully!"
exit 0
else
echo "Tests failed!"
exit 1
fi
- name: Comment
- uses: actions/github-script@v7
if: always()
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Thanks for reporting!'
})
deploy:
runs-on: self-hosted
needs: e2e
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Changes
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
auth:
- 'rococo-auth/**'
api:
- 'rococo-api/**'
client:
- 'rococo-client/**'
- name: Push required props to GITHUB_ENV
run: |
echo "PROFILE=stage" >> $GITHUB_ENV
- name: Docker login
run: |
docker login --username dtuchs --password "${{ secrets.DOCKER_HUB_PASSWORD }}"
- name: Deploy auth
working-directory: ./
if: steps.changes.outputs.auth == 'true'
run: |
pwd
gradle :rococo-auth:jib -x :rococo-e2e:test
docker compose pull auth.rococo.dc
docker compose stop auth.rococo.dc && docker compose up -d --no-deps auth.rococo.dc
docker system prune -a -f
echo "Deploy auth to stage done!"
- name: Deploy api
working-directory: ./
if: steps.changes.outputs.api == 'true'
run: |
pwd
gradle :rococo-api:jib -x :rococo-e2e:test
docker compose pull api.rococo.dc
docker compose stop api.rococo.dc && docker compose up -d --no-deps api.rococo.dc
docker system prune -a -f
echo "Deploy api to stage done!"
17 changes: 17 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
docker-compose -f docker-compose-e2e.yml up -d
docker ps -a
docker wait rococo-e2e
exit_code=$(docker inspect -f '{{.State.ExitCode}}' rococo-e2e)
echo "### Test logs ###"
docker logs rococo-e2e
docker-compose -f docker-compose-e2e.yml down
docker system prune -a -f
if [ "$exit_code" -eq "0" ]; then
echo "Tests passed successfully!"
exit 0
else
echo "Tests failed!"
exit 1
fi

#'👋 There is the last [Allure report](http://allure.rococo.website/allure-docker-service/projects/rococo/reports/latest/index.html)\n🕓 All reports [history](http://allureui.rococo.website/ui/allure-docker-service-ui/projects/rococo)'
21 changes: 2 additions & 19 deletions docker-compose-dev.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
#!/bin/bash
source ./docker.properties
export PROFILE="${PROFILE:=docker}"

PROFILE="${PROFILE}" docker compose down

docker_containers="$(docker ps -a -q)"
docker_images="$(docker images --format '{{.Repository}}:{{.Tag}}' | grep 'rococo')"

if [ ! -z "$docker_containers" ]; then
echo "### Stop containers: $docker_containers ###"
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
fi
if [ ! -z "$docker_images" ]; then
echo "### Remove images: $docker_images ###"
docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep 'rococo')
fi

echo "### Build backend images ###"
bash ./gradlew jibDockerBuild -x :rococo-e2e:test
cd rococo-client || exit 1
echo "### Build frontend image ###"
docker build --build-arg PROFILE=${PROFILE} -t dtuchs/rococo-client-${PROFILE}:${FRONT_VERSION} -t dtuchs/rococo-client-${PROFILE}:latest .
docker build --build-arg PROFILE=docker -t dtuchs/rococo-client-docker:0.0.1-SNAPSHOT -t dtuchs/rococo-client-docker:latest .

cd ../
docker images
PROFILE="${PROFILE}" docker compose up -d
PROFILE=docker docker compose up -d
docker ps -a
81 changes: 81 additions & 0 deletions docker-compose-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
services:
rococo-db:
container_name: rococo-db
image: mysql:8.3.0
environment:
- MYSQL_ROOT_PASSWORD=secret
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
interval: 5s
timeout: 5s
retries: 5
ports:
- "3306:3306"
networks:
- rococo-network
dns_search: .

auth.rococo.dc:
container_name: auth.rococo.dc
image: dtuchs/rococo-auth-${PROFILE}:latest
ports:
- "9000:9000"
restart: always
depends_on:
rococo-db:
condition: service_healthy
networks:
- rococo-network
dns_search: .

api.rococo.dc:
container_name: api.rococo.dc
image: dtuchs/rococo-api-${PROFILE}:latest
ports:
- "8080:8080"
restart: always
depends_on:
auth.rococo.dc:
condition: service_started
networks:
- rococo-network
dns_search: .

client.rococo.dc:
container_name: client.rococo.dc
image: dtuchs/rococo-client-${PROFILE}:latest
ports:
- "81:81"
restart: always
depends_on:
api.rococo.dc:
condition: service_started
networks:
- rococo-network
dns_search: .

rococo-e2e:
container_name: rococo-e2e
image: dtuchs/rococo-e2e:latest
depends_on:
client.rococo.dc:
condition: service_started
networks:
- rococo-network
dns_search: .

selenoid:
image: aerokube/selenoid:latest-release
volumes:
- "./selenoid:/etc/selenoid"
- "/var/run/docker.sock:/var/run/docker.sock"
command: [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs", "-limit", "3", "-container-network", "heisenbug-2023-autumn_rococo-network" ]
ports:
- "4444:4444"
networks:
- rococo-network
dns_search: .

networks:
rococo-network:
driver: bridge
2 changes: 0 additions & 2 deletions docker.properties

This file was deleted.

15 changes: 15 additions & 0 deletions rococo-e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG ALLURE

FROM eclipse-temurin:21-jdk

ENV ALLURE_DOCKER_API=${ALLURE}

WORKDIR /heisenbug-2023-autumn
COPY ./gradle ./gradle
COPY ./rococo-e2e ./rococo-e2e
COPY ./build.gradle ./
COPY ./settings.gradle ./
COPY ./gradle.properties ./
COPY ./gradlew ./

RUN ./gradlew test -Dtest.env=docker
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
guru.qa.rococo.jupiter.first.ContextHolderExtension
guru.qa.rococo.jupiter.first.PreconditionsExtension
guru.qa.rococo.jupiter.first.PreconditionsExtension
guru.qa.rococo.jupiter.third.AllureDockerExtension
4 changes: 2 additions & 2 deletions rococo-e2e/src/test/resources/junit-platform.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=concurrent
junit.jupiter.execution.parallel.mode.classes.default=concurrent
junit.jupiter.execution.parallel.config.strategy=fixed
junit.jupiter.execution.parallel.config.fixed.parallelism=6
junit.jupiter.execution.parallel.config.fixed.max-pool-size=6
junit.jupiter.execution.parallel.config.fixed.parallelism=3
junit.jupiter.execution.parallel.config.fixed.max-pool-size=3
Loading

0 comments on commit f231ac6

Please sign in to comment.