-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
251 additions
and
126 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,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!" |
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,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)' |
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 |
---|---|---|
@@ -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 |
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,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 |
This file was deleted.
Oops, something went wrong.
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,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 |
3 changes: 2 additions & 1 deletion
3
rococo-e2e/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension
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 |
---|---|---|
@@ -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 |
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
Oops, something went wrong.