-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (103 loc) · 3.26 KB
/
pipeline.yml
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
name: CI Pipeline
on:
pull_request:
branches:
- main
jobs:
backend:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.8.2
ports:
- 3306:3306
env:
MYSQL_USER: ${{ secrets.MYSQL_USER }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }}
MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}
options: --health-cmd="mysqladmin ping --silent" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Wait for MariaDB to be ready
run: |
for i in {1..30}; do
if mysqladmin ping -h127.0.0.1 --silent; then
echo "MariaDB is up!";
break;
fi
echo "Waiting for MariaDB...";
sleep 1;
done
- name: Setup Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.4.2
- name: Build and Test Backend
env:
MYSQL_USER: ${{ secrets.MYSQL_USER }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
REACT_APP_API_KEY: ${{ secrets.REACT_APP_API_KEY }}
REACT_APP_TOKEN: ${{ secrets.REACT_APP_TOKEN }}
run: gradle clean build test
frontend:
runs-on: ubuntu-latest
needs: backend
strategy:
matrix:
node-version: [ 18.x ]
os: [ ubuntu-latest ]
browser: [ chrome, firefox ]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci --force
- name: Install Compose
uses: ndeloof/[email protected]
with:
legacy: true
version: v2.1.0
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker-compose build --no-cache --force
- name: Start Docker Containers
run: |
docker-compose up --detach --build
docker-compose exec -T app wait-for-it localhost
- name: Run Cypress Smoke Tests
uses: cypress-io/github-action@v4
with:
command: npm run cypress:run:smoke:test -- --browser ${{ matrix.browser }}
parallel: true
- name: Run Cypress Sanity Tests
uses: cypress-io/github-action@v4
with:
command: npm run cypress:run:sanity:test -- --browser ${{ matrix.browser }}
parallel: true
- name: Generate Allure Report
uses: simple-elf/allure-report-action@master
if: always()
with:
allure_results: allure-results
- name: Deploy Allure Report to GitHub Pages
if: always()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-report
- name: Stop Docker Containers
if: always()
run: docker-compose down