Skip to content

Commit

Permalink
Fix database tests and enable running using GitHub workflows (#5676)
Browse files Browse the repository at this point in the history
- fix behavior when no entries have to be inserted during a synch
- fix database tests
- have dbms test test only one database
- DBMS to test is passed via environment variable "DBMS", defaulting to PostgreSQL
- add shared information on Canonical BibTeX entry
- some code improvement
- have checkstyle running on github workflows (not on Travis)
- One big workflow for tests
- Make allowPublicKeyRetrieval a property of DBMSConnectionProperties (and create a builder for the properties)
- Add check-outdated-dependencies as workflow
- Add formatting of test results (scripts/after-failure.sh)
- Have fetcher tests and GUI tests run after the database tests (because they currently fail)
- Update gradle from 6.0.0 to 6.0.1
  • Loading branch information
koppor authored Nov 29, 2019
1 parent f9cf996 commit ea5e632
Show file tree
Hide file tree
Showing 28 changed files with 817 additions and 607 deletions.
6 changes: 6 additions & 0 deletions .github/outdatedDependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Outdated dependencies
labels: code-quality, dependencies
---
There are outdated dependencies!
See https://github.com/JabRef/jabref/actions?query=is%3Afailure for details.
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
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
236 changes: 236 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
name: Tests

on: [push]

jobs:
checkstyle:
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
name: Restore gradle chache
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: Restore gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Run checkstyle
run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh
tests:
name: Unit tests
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
name: Restore gradle chache
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: Restore gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- 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: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: 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
name: Restore gradle chache
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: Restore gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- 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/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 --rerun-tasks
env:
CI: "true"
DBMS: "mysql"
fetchertests:
name: Fetcher tests
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
name: Restore gradle chache
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: Restore gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Run fetcher tests
run: ./gradlew fetcherTest
env:
CI: "true"
guitests:
name: GUI tests
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
name: Restore gradle chache
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: Restore gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- 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: 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
name: Restore gradle chache
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: Restore gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Update test coverage metrics
run: xvfb-run --auto-servernum ./gradlew jacocoTestReport && bash <(curl -s https://codecov.io/bash);
env:
CI: "false" # we pretend to run locally - even if tests fail on the CI, they count towards test coverage
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
DBMS: "postgresql"
78 changes: 0 additions & 78 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit ea5e632

Please sign in to comment.