Skip to content

Replace "fixes" by "closes" #13481

Replace "fixes" by "closes"

Replace "fixes" by "closes" #13481

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- main-release
pull_request:
merge_group:
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
permissions:
pull-requests: write
jobs:
checkstyle:
name: Checkstyle
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
cache: 'gradle'
- name: Run checkstyle 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 using gradle
run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [Checkstyle](https://checkstyle.sourceforge.io/) to identify issues.
The tool reviewdog already placed comments on GitHub to indicate the places. See the tab "Files" in you PR.
Please carefully follow [the setup guide for the codestyle](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html).
Afterwards, please run checkstyle locally and fix the issues.
More information on code quality in JabRef is available at <https://devdocs.jabref.org/getting-into-the-code/development-strategy.html>.
comment_tag: checkstyle
openrewrite:
name: OpenRewrite
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
cache: 'gradle'
- name: Run OpenRewrite
run: |
./gradlew rewriteDryRun
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [OpenRewrite](https://docs.openrewrite.org/) to ensure "modern" Java coding practices.
The issues found can be **automatically fixed**.
Please execute the gradle task *`rewriteRun`*, check the results, commit, and push.
You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".
comment_tag: openrewrite
modernizer:
name: Modernizer
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
cache: 'gradle'
- name: Run modernizer
run: |
# enable failing of this task if modernizer complains
sed -i "s/failOnViolations = false/failOnViolations = true/" build.gradle
./gradlew modernizer
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
Your code currently does not meet JabRef's code guidelines.
We use [Gradle Modernizer Plugin](https://github.com/andygoossens/gradle-modernizer-plugin#gradle-modernizer-plugin) to ensure "modern" Java coding practices.
Please fix the detected errors, commit, and push.
You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "Modernizer".
comment_tag: modernizer
markdown:
name: Markdown
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'false'
show-progress: 'false'
- name: markdownlint-cli2-action
uses: DavidAnson/markdownlint-cli2-action@v13
with:
globs: |
*.md
docs/**/*.md
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
You modified Markdown (*.md) files.
To ensure consistent styling, we have [markdown-lint](https://github.com/DavidAnson/markdownlint) in place.
[Markdown lint's rules](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#rules) help to keep our Markdown files consistent within this repository and consistent with the Markdown files outside here.
You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "Markdown".
comment_tag: markdown
changelog-non-frozen:
name: CHANGELOG.md
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'false'
show-progress: 'false'
fetch-depth: 0
- name: Lint CHANGELOG.md
run: |
# Install jbang
curl -Ls https://sh.jbang.dev | bash -s - app setup
export PATH=$PATH:$HOME/.jbang/bin
# ensure that refs are available
BRANCH=`git rev-parse HEAD`
git checkout main
# run heylogs verification
jbang --repos jitpack,central -m nbbrd.heylogs.cli.HeylogsCommand com.github.koppor.heylogs:heylogs-cli:jitpack-SNAPSHOT check CHANGELOG.md --gitdiff main...$BRANCH > heylogs.txt || true
# improve output
sed -i 's/consistent-separator/consistent-separator (ignored)/' heylogs.txt
sed -i 's/all-h2-contain-a-version/all-h2-contain-a-version (ignored)/' heylogs.txt
cat heylogs.txt
# exit 1 in case of error
# We have 2 "valid" issues in CHANGELOG.md
grep -q "2 problems" heylogs.txt || exit 1
- name: Add comment on pull request
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@v2
with:
message: >
While the PR was in progress, JabRef released a new version.
You have to merge `upstream/main` and move your entry in `CHANGELOG.md` to section `## [Unreleased]`.
It might also be that another CHANGELOG.md issue arose.
You can check the detailed error output at the tab "Checks", section "Tests" (on the left), subsection "CHANGELOG.md".
comment_tag: changelog
tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
cache: 'gradle'
- name: Run tests
run: xvfb-run --auto-servernum ./gradlew check -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x modernizer
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@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
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/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"
guitests:
name: GUI tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
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 "secretspresent=NO" >> $GITHUB_OUTPUT
else
echo "secretspresent=YES" >> $GITHUB_OUTPUT
fi
env:
SNAPCRAFT_LOGIN_FILE: ${{ secrets.CODECOV_TOKEN }}
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21.0.1
distribution: 'liberica'
cache: 'gradle'
- name: Update test coverage metrics
if: steps.checksecrets.outputs.secretspresent == 'YES'
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@v4
with:
show-progress: 'false'
- uses: gradle/wrapper-validation-action@v1
# This ensures that no git merge conflict markers (<<<, ...) are contained
merge_conflict_job:
name: Find merge conflicts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: 'false'
- name: Merge Conflict finder
uses: olivernybroe/action-conflict-finder@v4.0