forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 15
181 lines (177 loc) · 5.53 KB
/
tests.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Tests
on:
push:
branches:
- main
- main-release
pull_request:
# always run on pull requests
workflow_dispatch:
env:
SpringerNatureAPIKey: ${{ secrets.SpringerNatureAPIKey }}
AstrophysicsDataSystemAPIKey: ${{ secrets.AstrophysicsDataSystemAPIKey }}
IEEEAPIKey: ${{ secrets.IEEEAPIKey }}
BiodiversityHeritageApiKey: ${{ secrets.BiodiversityHeritageApiKey}}
GRADLE_OPTS: -Xmx4g
JAVA_OPTS: -Xmx4g
concurrency:
group: tests-${{ github.head_ref }}
cancel-in-progress: true
jobs:
checkstyle:
name: Checkstyle
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 18
distribution: 'temurin'
cache: 'gradle'
- name: Run check style reporter
uses: nikitasavinov/checkstyle-action@master
with:
reporter: github-pr-review
github_token: ${{ secrets.GITHUB_TOKEN }}
checkstyle_config: 'config/checkstyle/checkstyle_reviewdog.xml'
checkstyle_version: '10.3'
- name: Run checkstyle gradle
run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh
- name: Run markdown-lint
uses: avto-dev/markdown-lint@v1
with:
args: CHANGELOG.md CONTRIBUTING.md README.md
config: '.markdownlint.yml'
tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 18
distribution: 'temurin'
cache: 'gradle'
- name: Run tests
run: xvfb-run --auto-servernum ./gradlew check -x checkstyleJmh -x checkstyleMain -x checkstyleTest
env:
CI: "true"
- name: Format failed test results
if: failure()
run: |
sudo apt-get install -qq -y xml-twig-tools xsltproc
scripts/after-failure.sh
databasetests:
name: Database tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 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:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 18
distribution: 'temurin'
cache: 'gradle'
- name: Run tests on PostgreSQL
run: ./gradlew databaseTest --rerun-tasks
env:
CI: "true"
DBMS: "postgresql"
- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- name: Start custom MySQL
uses: mirromutth/[email protected]
with:
host port: 3800
container port: 3307
character set server: 'utf8'
collation server: 'utf8_general_ci'
mysql version: '8.0'
mysql database: 'jabref'
mysql root password: 'root'
- name: Run tests on MySQL
run: ./gradlew databaseTest --rerun-tasks
env:
CI: "true"
DBMS: "mysql"
guitests:
name: GUI tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 18
distribution: 'temurin'
cache: 'gradle'
- name: Run GUI tests
run: xvfb-run --auto-servernum ./gradlew guiTest
env:
CI: "true"
codecoverage:
name: Code coverage
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 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:
- name: Check secrets presence
id: checksecrets
shell: bash
run: |
if [ "CODECOV_TOKEN" == "" ]; then
echo ::set-output name=secretspresent::false
else
echo ::set-output name=secretspresent::true
fi
env:
SNAPCRAFT_LOGIN_FILE: ${{ secrets.CODECOV_TOKEN }}
- name: Checkout source
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 18
distribution: 'temurin'
cache: 'gradle'
- name: Update test coverage metrics
if: ${{ steps.checksecrets.outputs.secretspresent }}
run: xvfb-run --auto-servernum ./gradlew jacocoTestReport && bash <(curl -s https://codecov.io/bash);
env:
CI: "true"
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
DBMS: "postgresql"
# This is https://github.com/marketplace/actions/gradle-wrapper-validation
# It ensures that the jar file is from gradle and not by a strange third party.
gradlevalidation:
name: "Validate Gradle Wrapper"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1