forked from hawtio/hawtio
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (159 loc) · 5.57 KB
/
e2e_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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: E2E Test
on:
pull_request_target:
branches:
- 2.x
- 3.x
- 4.x
paths-ignore:
- "**.md"
push:
branches:
- 2.x
- 3.x
- 4.x
paths-ignore:
- "**.md"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-20.04
needs: build
strategy:
fail-fast: false
matrix:
java: ['17', '21']
runtime: ['quarkus', 'springboot']
# browser: ['firefox', 'chrome']
browser: ['firefox'] # chrome disabled because of https://github.com/hawtio/hawtio-next/issues/478
env:
REPORT_DIR: results-${{matrix.runtime}}-${{matrix.java}}-${{matrix.browser}}
steps:
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v3.0.0
- name: Download images
uses: actions/cache/restore@v3
with:
path: /tmp/images
key: e2e-docker-images-${{ matrix.java }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Load images
run: |
for i in /tmp/images/*.tar; do
docker load --input $i
done
- name: ${{ matrix.runtime }} E2E test (Java ${{ matrix.java }})
id: test
run: |
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $PWD/$REPORT_DIR:/hawtio-test-suite/tests/hawtio-test-suite/target \
-v $PWD/$REPORT_DIR/build:/hawtio-test-suite/tests/hawtio-test-suite/build/ \
--shm-size="2g" \
hawtio-test-suite:${{ matrix.java }} -Pe2e-${{ matrix.runtime }} -Dselenide.browser=${{ matrix.browser }} \
-Dio.hawt.test.docker.image=hawtio-${{ matrix.runtime }}-app:${{ matrix.java }}
- name: Prepare report artifacts
if: always()
run: |
mkdir -p results/$REPORT_DIR/
cp $REPORT_DIR/cucumber-reports/* results/$REPORT_DIR/
ls $REPORT_DIR/cucumber-reports/
- name: Archive test artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: 'test-results-${{ matrix.runtime }}-java-${{ matrix.java }}-${{ matrix.browser }}'
path: |
${{ env.REPORT_DIR }}/build/reports/tests/*.png
${{ env.REPORT_DIR }}/*.log
${{ env.REPORT_DIR }}/cucumber-reports/*
- name: Archive failed test reports
uses: actions/upload-artifact@v3
if: always()
with:
name: 'test-results'
path: |
results/**/*
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
java: ['17', '21']
steps:
- name: Checkout code
uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
ref: "refs/pull/${{ github.event.number }}/merge"
- name: Checkout code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v3.0.0
- name: Build
run: |
mvn --batch-mode --no-transfer-progress install -DskipTests -Pe2e -Pdocker-testsuite -Ptests-docker -Dhawtio-container -Ddocker.buildArg.JAVA_VERSION=${{ matrix.java }} -pl :hawtio-test-suite,:hawtio-tests-quarkus,:hawtio-tests-springboot -am
- name: Export docker images
run: |
mkdir -p /tmp/images/
docker save hawtio-test-suite:${{ matrix.java }} > /tmp/images/hawtio-test-suite-${{ matrix.java }}.tar
docker save hawtio-quarkus-app:${{ matrix.java }} > /tmp/images/hawtio-quarkus-app-${{ matrix.java }}.tar
docker save hawtio-springboot-app:${{ matrix.java }} > /tmp/images/hawtio-springboot-app-${{ matrix.java }}.tar
- name: Cache images
uses: actions/cache/save@v3
with:
path: /tmp/images
key: e2e-docker-images-${{ matrix.java }}-${{ github.run_id }}-${{ github.run_attempt }}
publish-results:
runs-on: ubuntu-20.04
needs: test
if: always()
permissions:
checks: write
actions: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Test Results
uses: actions/download-artifact@v3
with:
name: 'test-results'
path: 'test-results'
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
**/Cucumber.xml
json_file: results.json
- name: Install xmllint
run: sudo apt-get install -y xmlstarlet jq
- name: Generate summary
run: |
export CHECK_URL=$(jq -r .check_url results.json)
bash tests/hawtio-test-suite/process_test_results.sh test-results > summary.md
- name: Update summary
run: |
cat summary.md >> $GITHUB_STEP_SUMMARY
- uses: tibdex/github-app-token@v2
if: github.event_name == 'pull_request_target'
id: generate-token
with:
app_id: ${{ secrets.HAWTIO_CI_APP_ID }}
private_key: ${{ secrets.HAWTIO_CI_PRIVATE_KEY }}
- name: Comment PR with summary
if: github.event_name == 'pull_request_target'
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
filePath: summary.md
comment_tag: execution