-
Notifications
You must be signed in to change notification settings - Fork 195
175 lines (175 loc) · 7.73 KB
/
run_tests.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
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
165
166
167
168
169
170
171
172
173
174
175
name: X-Road tests
on:
# Capture this event so that gradle caches are updated when a PR is merged to develop
# More information on why: https://github.com/gradle/gradle-build-action#using-the-caches-read-only
push:
branches:
- develop
paths:
- 'src/**'
- '.github/**'
- 'ansible/**'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'src/**'
- '.github/**'
- 'ansible/**'
permissions:
contents: write # Required for https://github.com/gradle/actions/tree/main/setup-gradle#github-dependency-graph-support
pull-requests: write # https://github.com/gradle/actions/tree/main/setup-gradle#adding-job-summary-as-a-pull-request-comment
actions: read # Required for https://github.com/dorny/test-reporter
checks: write # Required for https://github.com/dorny/test-reporter
jobs:
BuildAndPackageWithUnitTests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # SonarCloud: Shallow clones should be disabled for a better relevancy of analysis
- name: Ensure required packages
env:
DEBIAN_FRONTEND: noninteractive # Less output to log
run: sudo apt-get update && sudo apt-get install -y curl software-properties-common build-essential unzip debhelper devscripts
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
gradle-home-cache-cleanup: true
dependency-graph: generate-and-submit
add-job-summary-as-pr-comment: always
- name: Build and test source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
working-directory: ./src
run: ./gradlew -Dorg.gradle.jvmargs=-Xmx6g -PsonarqubeHost=https://sonarcloud.io -PsonarqubeProjectKey=nordic-institute_X-Road -PsonarqubeOrganization=nordic-institute -PnvdApiKey=$NVD_API_KEY -PxroadBuildType=RELEASE --stacktrace build sonar test intTest runProxyTest runMetaserviceTest runProxymonitorMetaserviceTest jacocoTestReport dependencyCheckAggregate -Pfrontend-npm-audit
- name: Test report
env:
NODE_OPTIONS: '--max-old-space-size=6144'
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Unit and integration tests
path: src/**/build/test-results/**/TEST-*.xml
reporter: java-junit
list-suites: 'failed'
list-tests: 'failed'
- name: Build RHEL7 packages
run: docker build -t rhel7 ${{ github.workspace }}/src/packages/docker/rpm/ && docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v ${{ github.workspace }}:/workspace rhel7 ./src/packages/build-rpm.sh
- name: Build RHEL8 packages
run: docker build -t rhel8 ${{ github.workspace }}/src/packages/docker/rpm-el8/ && docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v ${{ github.workspace }}:/workspace rhel8 ./src/packages/build-rpm.sh
- name: Build RHEL9 packages
run: docker build -t rhel9 ${{ github.workspace }}/src/packages/docker/rpm-el9/ && docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v ${{ github.workspace }}:/workspace rhel9 ./src/packages/build-rpm.sh
- name: Build Focal packages
env:
DEBEMAIL: 'info@niis.org'
DEBFULLNAME: 'NIIS'
run: ./src/packages/build-deb.sh focal
- name: Build Jammy packages
env:
DEBEMAIL: 'info@niis.org'
DEBFULLNAME: 'NIIS'
run: ./src/packages/build-deb.sh jammy -release
- name: Store deb files for system tests
uses: actions/upload-artifact@v4
with:
name: debian-packages
path: src/packages/build/ubuntu22.04/*.deb
compression-level: 0 #No point in compressing these
RunCSSystemTests:
needs: BuildAndpackageWithUnitTests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true
- name: Initialize docker setup
working-directory: ./.github/docker/centralserver
run: ./init_context.sh
- name: Download debian packages
uses: actions/download-artifact@v4
with:
name: debian-packages
path: ./.github/docker/centralserver/build/packages/develop/debian
- name: List docker build files
run: ls -lah .github/docker/centralserver/build
- name: Run Central Server system tests
working-directory: ./src
run: ./gradlew -Dorg.gradle.jvmargs=-Xmx6g :central-server:admin-service:ui-system-test:systemTest -PsystemTestCsPackageHost=packages -PsystemTestCsDockerRoot=${{ github.workspace }}/.github/docker/centralserver
- name: Test report
env:
NODE_OPTIONS: '--max-old-space-size=6144'
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Central Server system test
path: src/central-server/admin-service/ui-system-test/build/test-results/**/TEST-*.xml
reporter: java-junit
- name: Upload CS screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: CS System Test screenshots
path: src/central-server/admin-service/ui-system-test/build/reports/test-automation/selenide-failures/*.png
RunSSSystemTests:
needs: BuildAndpackageWithUnitTests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true
- name: Download debian packages
uses: actions/download-artifact@v4
with:
name: debian-packages
path: ./src/security-server/system-test/src/intTest/resources/container-files/packages/develop/debian
- name: Run Security Server system tests
working-directory: ./src
run: ./gradlew -Dorg.gradle.jvmargs=-Xmx6g :security-server:system-test:systemTest -PsystemTestSsPackageHost=packages -PsystemTestSsDockerRoot=${{ github.workspace }}/.github/docker/securityserver
- name: Test report
env:
NODE_OPTIONS: '--max-old-space-size=6144'
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Security Server system tests
path: src/security-server/system-test/build/test-results/**/TEST-*.xml
reporter: java-junit
- name: Fix system-test build dir permissions
run: sudo chown -R $USER src/security-server/system-test/build/ss-container-logs/
if: failure()
- name: Upload SS report
uses: actions/upload-artifact@v4
if: failure()
with:
name: SS System Test report
path: |
src/security-server/system-test/build/allure-report/
src/security-server/system-test/build/ss-container-logs/