Skip to content

Fix caching problem which caused analysis made by different dictionary setups to be the same #183

Fix caching problem which caused analysis made by different dictionary setups to be the same

Fix caching problem which caused analysis made by different dictionary setups to be the same #183

Workflow file for this run

name: build
on:
push:
branches: [ develop ]
pull_request:
types: [opened, synchronize, reopened]
branches: [ develop ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
es-version:
- 'es:8.8.1'
- 'es:8.7.1'
- 'es:8.6.2'
- 'es:8.5.3'
- 'es:8.4.3'
- 'es:8.2.3'
- 'es:7.17.10'
- 'es:7.14.2'
- 'es:7.10.2'
- 'os:2.8.0'
- 'os:2.7.0'
- 'os:2.6.0'
env:
mainJob: ${{ matrix.es-version == 'es:8.8.1' }}
githubRef: ${{ github.ref }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Cache SonarCloud packages
if: env.mainJob == 'true'
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar-${{ hashFiles('build.gradle') }}
- name: Extract version
uses: eskatos/gradle-command-action@v2
with:
arguments: -PengineVersion=${{ matrix.es-version }} printVersionForGithubActions
cache-read-only: false # ${{ github.ref != 'refs/heads/develop' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build # This stage sets up gradle caching
uses: eskatos/gradle-command-action@v2
with:
arguments: -PengineVersion=${{ matrix.es-version }} --info clean build koverXmlReport
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Analyze with sonarqube
if: env.mainJob == 'true'
uses: eskatos/gradle-command-action@v2
with:
arguments: -PengineVersion=${{ matrix.es-version }} --info sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Cache elasticsearch download
uses: actions/cache@v3
with:
path: build/integration/${{ env.ENGINE_KIND }}-${{ env.ENGINE_VERSION }}-linux-x86_64.tar.gz
key: ${{ env.ENGINE_KIND }}-${{ env.ENGINE_VERSION }}
- name: Cache dictionary download
uses: actions/cache@v3
with:
path: build/integration/sudachi-dictionary-20230110-small.zip
key: sudachi-dictionary-20230110
- name: Integration test
env:
ES_KIND: ${{ env.ENGINE_KIND }}
ES_VERSION: ${{ env.ENGINE_VERSION }}
PLUGIN_VERSION: ${{ env.PROJ_VERSION }}
RUN_ES_DAEMON: 1
DIC_VERSION: 20230110
run: |
bash test-scripts/00-install-elasticsearch.sh
sleep 30
bash test-scripts/10-make-index.sh
python3 test-scripts/20-put-docs.py
python3 test-scripts/30-test-docs.py
bash test-scripts/80-delete-index.sh
bash test-scripts/10-make-index.sh
python3 test-scripts/20-put-docs.py
python3 test-scripts/30-test-docs.py
bash test-scripts/80-delete-index.sh
bash test-scripts/10-make-index.sh
python3 test-scripts/20-put-docs.py
python3 test-scripts/30-test-docs.py
bash test-scripts/80-delete-index.sh
bash test-scripts/10-make-index.sh
python3 test-scripts/20-put-docs.py
python3 test-scripts/30-test-docs.py
bash test-scripts/80-delete-index.sh
- uses: actions/upload-artifact@v3
name: Upload reports when failed
if: failure()
with:
name: failure-reports
path: |
build/reports
build/integration/elasticsearch-*/logs
- uses: actions/upload-artifact@v3
name: Upload built packages
if: success()
with:
name: build-artifacts
path: |
build/distributions/*.zip
- uses: actions/upload-artifact@v3
name: Upload SPI jar
if: env.mainJob == 'true'
with:
name: build-artifacts
path: |
spi/build/libs/sudachi-*.jar
- name: 'Publish SPI jar to maven central'
uses: eskatos/gradle-command-action@v2
if: env.mainJob == 'true' && success() && startsWith(github.ref, 'refs/heads/develop')
with:
arguments: -PengineVersion=${{ matrix.es-version }} --info publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
GITHUB_USERNAME: GITHUB_ACTOR
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_USER_PASSWORD: ${{ secrets.MAVEN_USER_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}