Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix database tests and enable running using GitHub workflows #5676

Merged
merged 38 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
567e643
Fix datbase tests and enable running using GitHub workflows
koppor Nov 26, 2019
82eca7d
One big workflow for test and binaries
koppor Nov 28, 2019
98e68c6
Make allowPublicKeyRetrieval a property of DBMSConnectionProperties (…
koppor Nov 28, 2019
e49e694
Final fixes
koppor Nov 28, 2019
6d6ab5e
Setup JDK directly before gradle
koppor Nov 28, 2019
570bc28
Really remove separate test-on-posgres workflow
koppor Nov 28, 2019
77ee500
Revert "Really remove separate test-on-posgres workflow"
koppor Nov 28, 2019
f8ebaf4
Fix checkstyle
koppor Nov 28, 2019
cac6ac6
Merge MySQL and Postgres test into one workflow
koppor Nov 29, 2019
936ea25
Have names lowercase also in deployment.yml
koppor Nov 29, 2019
565f4e4
Sequentially execute database tests - and integrate codecov
koppor Nov 29, 2019
9cd50a1
Enable GUI tests using GitHub workflows
koppor Nov 29, 2019
251d029
Revert "Have names lowercase also in deployment.yml"
koppor Nov 29, 2019
2db3ffc
Fix name of workflow for tests, separate tests into basic, fetchers, …
koppor Nov 29, 2019
1870696
Fix test names
koppor Nov 29, 2019
d3c78c5
Finally remove usage of Travis
koppor Nov 29, 2019
3c859c6
Try to cache gradle wrapper
koppor Nov 29, 2019
f1b394a
Fix YML
koppor Nov 29, 2019
562e201
Run MySQL tests after code coverage (as it takes 15s to setup MySQL)
koppor Nov 29, 2019
778a818
Update gradle from 6.0.0 to 6.0.1
koppor Nov 29, 2019
3fa119f
Add name to start MySQL task
koppor Nov 29, 2019
9317505
One "after failure" job is enough
koppor Nov 29, 2019
72a1de0
Try to get better location of failed tests
koppor Nov 29, 2019
9c858ef
Update test coverage metrics in all cases (failed and non-failed)
koppor Nov 29, 2019
e091e71
only html available; try html2text
koppor Nov 29, 2019
88b5ab4
html2text did not work out
koppor Nov 29, 2019
b888f26
Switch test logger theme to a) mocha and b) mocha.parallel to enable …
koppor Nov 29, 2019
0cbbaee
Don't overoptimize (parallel) - just show skipped and failed tests
koppor Nov 29, 2019
382fd97
Run outdated dependency check weekly
tobiasdiez Nov 29, 2019
f30066e
Create outdatedDependencies.md
tobiasdiez Nov 29, 2019
0446759
Introduce TravisCI environment variable CI
koppor Nov 29, 2019
ae2a0ab
Include checkstyle in main test workflow
tobiasdiez Nov 29, 2019
99de01d
Delete checkstyle.yml
tobiasdiez Nov 29, 2019
02fe4fc
Fix ordering of jacoco call
koppor Nov 29, 2019
a0021ed
Try to find out why fetcher tests are not executed on GitHub workflows
koppor Nov 29, 2019
11bb9b9
Split tests into seperate jobs to parallelize
tobiasdiez Nov 29, 2019
26fe33e
Make sure all tests are executed
tobiasdiez Nov 29, 2019
324f822
Make mysql tests run
tobiasdiez Nov 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/check-outdated-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check dependencies

on:
schedule:
- cron: '0 0 * * 0' # Run every Sunday

jobs:
checkDependencies:
name: Check dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v1
with:
depth: 1
submodules: false
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 13
- name: Look for outdated dependencies
run: ./gradlew -q checkOutdatedDependencies
- name: Report issues
if: failure()
uses: JasonEtco/create-an-issue@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/outdatedDependencies.md
33 changes: 33 additions & 0 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Checkstyle

on: [push]

jobs:
test:
name: Checkstyle
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v1
with:
depth: 1
submodules: false
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 13
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.OS }}-gradle-${{ env.cache-name }}-
${{ runner.OS }}-gradle-
${{ runner.OS }}-
- uses: actions/cache@v1
name: Cache gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Run checkstyle test
run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh
5 changes: 5 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ jobs:
${{ runner.OS }}-gradle-${{ env.cache-name }}-
${{ runner.OS }}-gradle-
${{ runner.OS }}-
- uses: actions/cache@v1
name: Cache gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Download jpackage
# We need to download jpackage from https://jdk.java.net/jpackage/
run: |
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Tests

on: [push]

jobs:
test:
name: Tests
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: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 13
- name: Checkout source
uses: actions/checkout@v1
with:
depth: 1
submodules: false
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.OS }}-gradle-${{ env.cache-name }}-
${{ runner.OS }}-gradle-
${{ runner.OS }}-
- uses: actions/cache@v1
name: Cache gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Run basic tests (without checkstyle)
run: xvfb-run --auto-servernum ./gradlew check -x checkstyleJmh -x checkstyleMain -x checkstyleTest
- name: Run tests on PostgreSQL
run: ./gradlew databaseTest
env:
DBMS: "postgresql"
- name: Update test coverage metrics
run: xvfb-run --auto-servernum ./gradlew jacocoTestReport && bash <(curl -s https://codecov.io/bash);
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
DBMS: "postgresql"
- name: Update test coverage metrics (in case of failure)
run: xvfb-run --auto-servernum ./gradlew jacocoTestReport && bash <(curl -s https://codecov.io/bash);
if: failure()
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
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/mysql-action@v1.1
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
env:
DBMS: "mysql"
- name: Run fetcher tests
run: ./gradlew fetcherTest
- name: Run GUI tests
run: xvfb-run --auto-servernum ./gradlew guiTest
- name: Format failed test results
if: failure()
run: |
sudo apt-get install -qq -y xml-twig-tools xsltproc
scripts/after-failure.sh
78 changes: 0 additions & 78 deletions .travis.yml

This file was deleted.

11 changes: 9 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ plugins {
id 'org.javamodularity.moduleplugin' version '1.5.0'
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.beryx.jlink' version '2.16.4'

// nicer test outputs during running and completion
id 'com.adarshr.test-logger' version '2.0.0'
}

gradle.startParameter.showStacktrace = org.gradle.api.logging.configuration.ShowStacktrace.ALWAYS
Expand Down Expand Up @@ -438,7 +441,6 @@ javadoc {

localization.script = 'scripts/syncLang.py'

// Test tasks
test {
useJUnitPlatform {
excludeTags 'DatabaseTest', 'FetcherTest', 'GUITest'
Expand All @@ -452,6 +454,10 @@ test {
}
}

testlogger {
showPassed false
}

task databaseTest(type: Test) {
useJUnitPlatform {
includeTags 'DatabaseTest'
Expand Down Expand Up @@ -524,8 +530,9 @@ jacocoTestReport {
dependsOn jacocoMerge

reports {
xml.enabled = true // coveralls plugin depends on xml format report
csv.enabled = true
html.enabled = true
xml.enabled = true // coveralls plugin depends on xml format report
}
}

Expand Down
16 changes: 0 additions & 16 deletions buildres/gui-tests.sh

This file was deleted.

25 changes: 25 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# How to test
koppor marked this conversation as resolved.
Show resolved Hide resolved

## Database tests

### PostgreSQL

To quickly host a local PostgreSQL database, execute following statement:

```shell command
docker run -d -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -p 5432:5432 --name db postgres:10 postgres -c log_statement=all
```

Set the environment variable `DBMS` to `postgres` (or leave it unset)

Then, all DBMS Tests (annotated with `@org.jabref.testutils.category.DatabaseTest`) run properly.

### MySQL

A MySQL DBMS can be started using following command:

``´shell command
docker run -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=jabref -p 3800:3307 mysql:8.0 --port=3307
```

Set the environment variable `DBMS` to `mysql`.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 1 addition & 5 deletions scripts/after-failure.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/bin/bash
# taken from https://github.com/lhotari/travis-gradle-test-failures-to-console/blob/master/travis/junit-errors-to-stdout.sh
# based on https://github.com/lhotari/travis-gradle-test-failures-to-console/blob/master/travis/junit-errors-to-stdout.sh
IFS='
'
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ "$TRAVIS" = "true" ]; then
#echo 'Installing xml-twig-tools and xsltproc....'
sudo apt-get install -qq -y --force-yes xml-twig-tools xsltproc > /dev/null
fi
ROOTDIR="$1"
if [ -z "$ROOTDIR" ]; then
ROOTDIR="."
Expand Down
Loading