-
Notifications
You must be signed in to change notification settings - Fork 7
134 lines (124 loc) · 4.73 KB
/
e2e.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: e2e
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
e2e:
runs-on: ubuntu-latest
env:
PROFILE: docker
PREFIX: dtuchs
steps:
- name: Setup JDK
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: Checkout repository
uses: actions/checkout@v4
- name: Build backend
run: |
gradle jibDockerBuild -x :rococo-e2e:test
- name: Build front
run: |
cd ./rococo-client || exit 1
docker build --build-arg PROFILE=${{ env.PROFILE }} -t ${{ vars.DOCKER_HUB_ACC }}/rococo-client-${{ env.PROFILE }}:0.0.1-SNAPSHOT -t ${{ vars.DOCKER_HUB_ACC }}/rococo-client-${{ env.PROFILE }}:latest .
cd ../ || exit 1
- name: Build tests
run: |
docker build --build-arg ALLURE=${{ secrets.ALLURE_DOCKER_API }} -t ${{ vars.DOCKER_HUB_ACC }}/rococo-e2e:latest -f ./rococo-e2e/Dockerfile .
- name: Run tests
run: |
: # pull browser (see browsers.json)
docker pull selenoid/vnc_chrome:125.0
: # run e2e tests
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
if: always()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 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)'
})
deploy:
runs-on: self-hosted
needs: e2e
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Push required props to GITHUB_ENV
run: |
echo "PROFILE=stage" >> $GITHUB_ENV
echo "PREFIX=dtuchs" >> $GITHUB_ENV
- name: Check changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
auth:
- 'rococo-auth/**'
api:
- 'rococo-api/**'
client:
- 'rococo-client/**'
- name: Docker login
run: |
docker login --username ${{ vars.DOCKER_HUB_ACC }} --password "${{ secrets.DOCKER_HUB_PASSWORD }}"
- name: Deploy auth
if: steps.changes.outputs.auth == 'true'
working-directory: ./
run: |
pwd
gradle :rococo-auth:jib -x :rococo-e2e:test
### run 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
if: steps.changes.outputs.api == 'true'
working-directory: ./
run: |
pwd
gradle :rococo-api:jib -x :rococo-e2e:test
### run 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!"
- name: Build frontend & deploy to stage
if: steps.changes.outputs.client == 'true'
working-directory: ./rococo-client
run: |
pwd
docker build --build-arg PROFILE=${{ env.PROFILE }} -t ${{ vars.DOCKER_HUB_ACC }}/rococo-client-${{ env.PROFILE }}:0.0.1-SNAPSHOT -t ${{ vars.DOCKER_HUB_ACC }}/rococo-client-${{ env.PROFILE }}:latest .
docker push ${{ vars.DOCKER_HUB_ACC }}/rococo-client-${{ env.PROFILE }}:0.0.1-SNAPSHOT
docker push ${{ vars.DOCKER_HUB_ACC }}/rococo-client-${{ env.PROFILE }}:latest
### run e2e test
cd ../ || exit 1
docker compose pull client.rococo.dc
docker compose stop client.rococo.dc && docker compose up -d --no-deps client.rococo.dc
docker system prune -a -f
echo "Deploy frontend to stage done!"