LUCENE-9792: add testRegressions task that downloads and runs hunspell regression tests. (#2407)

This commit is contained in:
Dawid Weiss 2021-02-19 21:13:40 +01:00 committed by GitHub
parent 31a64927a4
commit 515a41dee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 80 additions and 1 deletions

36
.github/workflows/hunspell.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: Hunspell regression tests
on:
pull_request:
branches:
- 'master'
paths:
- '.github/workflows/hunspell.yml'
- 'lucene/analysis/common/**'
jobs:
test:
name: Run Hunspell regression tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
key: ${{ runner.os }}-gradle-solrj-${{ hashFiles('versions.lock') }}
restore-keys: |
${{ runner.os }}-gradle-solrj-
${{ runner.os }}-gradle-
- name: Initialize gradle settings
run: ./gradlew localSettings
- name: Run regular and regression tests
run: ./gradlew -p lucene/analysis/common check testRegressions

View File

@ -24,6 +24,49 @@ dependencies {
testImplementation project(':lucene:test-framework')
}
// Fetch the data and enable regression tests against woorm/ libreoffice dictionaries.
task checkoutHunspellRegressionRepos() {
ext {
checkoutDir = file("${buildDir}/hunspell-regressions")
}
outputs.dir checkoutDir
doFirst {
// Clone the repositories we need if they don't exist.
[
"libreoffice": "https://github.com/LibreOffice/dictionaries",
"woorm": "https://github.com/wooorm/dictionaries"
].each { name, repo ->
if (!file("${checkoutDir}/${name}").exists()) {
checkoutDir.mkdirs()
// This will work only if git is available, but I assume it is.
project.exec {
executable "git"
ignoreExitValue false
workingDir checkoutDir
args = [ "clone", "--depth=1", repo, name ]
}
}
}
}
}
task testRegressions(type: Test) {
group "Verification"
description "Run Hunspell regression tests against Woorm/ LibreOffice git repositories."
dependsOn checkoutHunspellRegressionRepos
failFast = true
include "**/TestAllDictionaries*"
systemProperty "hunspell.dictionaries", checkoutHunspellRegressionRepos.checkoutDir
doFirst {
logger.lifecycle("Running Hunspell regression tests...")
}
}
// Pass all hunspell-tests-specific project properties to tests as system properties.
tasks.withType(Test) {
[
@ -37,4 +80,4 @@ tasks.withType(Test) {
systemProperty it, val
}
}
}
}