Apache Solr open-source search software
LUCENE-9792: add testRegressions task that downloads and runs hunspell regression tests. (#2407)
Dawid Weiss515a41dee97f
diff --git a/.github/workflows/hunspell.yml b/.github/workflows/hunspell.ymlnew file mode 100644index 00000000000..65ab047bdfc--- /dev/null+++ b/.github/workflows/hunspell.yml@@ -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 testRegressionsdiff --git a/lucene/analysis/common/build.gradle b/lucene/analysis/common/build.gradleindex 24c949f3f8d..6fba70adb2c 100644--- a/lucene/analysis/common/build.gradle+++ b/lucene/analysis/common/build.gradle@@ -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}}-}\ No newline at end of file+}