Merge pull request #65 from sorami/develop #229
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.13.4' | |
- 'es:8.12.2' | |
- 'es:8.11.4' | |
- 'es:8.10.4' | |
- 'es:8.9.2' | |
- 'es:8.8.2' | |
- 'es:8.7.1' | |
- 'es:8.6.2' | |
- 'es:8.5.3' | |
- 'es:8.4.3' | |
- 'es:8.2.3' | |
- 'es:7.17.21' | |
- 'es:7.14.2' | |
- 'es:7.10.2' | |
- 'os:2.14.0' | |
- 'os:2.13.0' | |
- 'os:2.12.0' | |
- 'os:2.11.1' | |
- 'os:2.10.0' | |
- 'os:2.9.0' | |
- 'os:2.8.0' | |
- 'os:2.7.0' | |
- 'os:2.6.0' | |
env: | |
mainJob: ${{ matrix.es-version == 'es:8.13.4' }} | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Cache SonarCloud packages | |
if: env.mainJob == 'true' | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar-${{ hashFiles('build.gradle') }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Extract version and set to github env | |
run: ./gradlew -PengineVersion=${{ matrix.es-version }} printVersionForGithubActions | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: ./gradlew -PengineVersion=${{ matrix.es-version }} --info clean build koverXmlReport | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Analyze with sonarqube | |
if: env.mainJob == 'true' | |
run: ./gradlew -PengineVersion=${{ matrix.es-version }} --info sonar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Cache elasticsearch download | |
uses: actions/cache@v4 | |
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@v4 | |
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 | |
python3 test-scripts/01-integration-test.py | |
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@v4 | |
name: Upload reports when failed | |
if: failure() | |
with: | |
name: failure-reports-${{ env.ENGINE_KIND }}-${{ env.ENGINE_VERSION }} | |
path: | | |
build/reports | |
build/integration/elasticsearch-*/logs | |
- uses: actions/upload-artifact@v4 | |
name: Upload built packages | |
if: success() | |
with: | |
name: build-artifacts-${{ env.ENGINE_KIND }}-${{ env.ENGINE_VERSION }} | |
path: | | |
build/distributions/*.zip | |
- uses: actions/upload-artifact@v4 | |
name: Upload SPI jar | |
if: env.mainJob == 'true' | |
with: | |
name: build-artifacts-spi-${{ env.ENGINE_KIND }}-${{ env.ENGINE_VERSION }} | |
path: | | |
spi/build/libs/sudachi-*.jar | |
- name: 'Publish SPI jar to maven central' | |
if: env.mainJob == 'true' && success() && startsWith(github.ref, 'refs/heads/develop') | |
run: ./gradlew -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 }} |