-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (97 loc) · 3.12 KB
/
build.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
name: build
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.7
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: hedb
ports:
# will assign a random free host port
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Cache Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run backend unit tests
working-directory: ./backend
run: mvn clean -Ptest test
- name: Register backend code coverage
uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./backend/target/site/jacoco/jacoco.xml
yml: ./backend/codecov.yml
- name: Publish backend unit tests Report
uses: scacap/action-surefire-report@v1
with:
check_name: Backend Unit Tests Report
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '21.x'
- name: Run integration tests
working-directory: ./backend
run: mvn clean verify -Ptest-int
env:
PSQL_INT_TEST_DB_USERNAME: "postgres"
PSQL_INT_TEST_DB_PASSWORD: "postgres"
- name: Publish integration tests Report
uses: scacap/action-surefire-report@v1
with:
check_name: Integration Tests Report
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Clean DB after integration tests
run: psql -d postgresql://postgres@localhost/hedb -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
env:
PGPASSWORD: postgres
- name: Start backend machine for cypress tests
working-directory: ./backend
run: mvn clean -Ptest-int spring-boot:run &
env:
PSQL_INT_TEST_DB_USERNAME: "postgres"
PSQL_INT_TEST_DB_PASSWORD: "postgres"
- name: Install npm
working-directory: ./frontend
run: npm install
- name: Run Cypress tests
uses: cypress-io/github-action@v4
with:
record: true
working-directory: frontend
start: npm start
wait-on: http://localhost:8081
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cypress_psql_db_name: "hedb"
cypress_psql_db_username: "postgres"
cypress_psql_db_password: "postgres"
cypress_psql_db_host: "localhost"
cypress_psql_db_port: "5432"
ACTIONS_ALLOW_UNSECURE_COMMANDS: true