-
Notifications
You must be signed in to change notification settings - Fork 1
125 lines (125 loc) · 3.83 KB
/
build-and-test.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
123
124
125
name: CI
on: push
jobs:
unit-test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11.0.18
cache: 'gradle'
- name: Verify tests
run: |
sh scripts/verify-test-files.sh
- name: Build & Unit Test
uses: GabrielBB/xvfb-action@v1.6
with:
run: |
./gradlew koverReport
zip -rg unit-test-results.zip build/reports/tests/unitTest
zip -rq coverage-html.zip build/reports/kover/html
- name: Export test results
uses: actions/upload-artifact@v3
with:
name: unit-test-results
path: unit-test-results.zip
- name: Export coverage stats
uses: actions/upload-artifact@v3
with:
name: kover-report
path: coverage-html.zip
- name: Export snapshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: failed-snapshots
path: |
/home/runner/**/*.failed.png
/home/runner/**/*.comparison.png
- name: Update coverage
id: update-coverage
if: github.ref == 'refs/heads/main'
run: |
python scripts/update-coverage.py
- name: Commit coverage stats
uses: EndBug/add-and-commit@v7
if: github.ref == 'refs/heads/main'
with:
add: './README.md'
message: "Update coverage stats: ${{ steps.update-coverage.outputs.COVERAGE }}"
integration-and-e2e:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11.0.18
cache: 'gradle'
- name: Integration & E2E
uses: GabrielBB/xvfb-action@v1.6
env:
AWS_SYNC: ${{ secrets.AWS_SYNC }}
AWS_LOGS: ${{ secrets.AWS_LOGS }}
with:
run: ./gradlew integrationAndE2E --info
- name: Export test results
uses: actions/upload-artifact@v3
with:
name: integration-and-e2e-results
path: /home/runner/work/Dartzee/Dartzee/build/reports/tests/integrationAndE2E/**/*.html
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11.0.18
- name: Build JAR
run: ./gradlew jar --info
- name: Export JAR
uses: actions/upload-artifact@v3
with:
name: dartzee-jar
path: /home/runner/work/Dartzee/Dartzee/build/libs/Dartzee.jar
test-jar:
name: Test JAR - Java ${{ matrix.java-version }}
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [build]
strategy:
matrix:
java-version: [8, 11]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{ matrix.java-version }}
- name: Download JAR
uses: actions/download-artifact@v3
with:
name: dartzee-jar
path: /home/runner/work/Dartzee/Dartzee/build/libs
- name: Test JAR
run: |
nohup java -jar build/libs/Dartzee.jar > dartzee-log.log 2>&1 &
echo "Waiting for Dartzee to start..."
attempt_counter=0
max_attempts=10
until $(cat dartzee-log.log | grep -Eq [databaseCurrent]); do
if [ ${attempt_counter} -eq ${max_attempts} ];then
echo "Max attempts reached"
exit 1
fi
printf '.'
attempt_counter=$(($attempt_counter+1))
sleep 5
done
echo "Dartzee started successfully"