-
-
Notifications
You must be signed in to change notification settings - Fork 42
161 lines (153 loc) · 5.31 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Build and test
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.15.2'
- 'es:8.14.3'
- '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.3.3'
- 'es:8.2.3'
- 'es:7.17.24'
- 'es:7.17.8'
- 'es:7.14.2'
- 'es:7.10.2'
- 'os:2.17.1'
- 'os:2.16.0'
- 'os:2.15.0'
- '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.15.2' }}
sudachiVersion: 20241021
sudachiKind: core
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: 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: Prepare artifact for sonar analysis
if: env.mainJob == 'true'
run: |
find -iname build -type d -exec tar -cf sonar.tar {} \+
echo ${{ github.event.number }} >> PR_EVENT.txt
echo ${{ github.event.pull_request.head.ref }} >> PR_EVENT.txt
echo ${{ github.event.pull_request.base.ref }} >> PR_EVENT.txt
- name: Upload artifact for sonar analysis
if: env.mainJob == 'true'
uses: actions/upload-artifact@v4
with:
name: sonar-artifact
path: |
sonar.tar
PR_EVENT.txt
- 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-${{ env.sudachiVersion }}-${{ env.sudachiKind }}.zip
key: sudachi-dictionary-${{ env.sudachiVersion }}-${{ env.sudachiKind }}
- 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: ${{ env.sudachiVersion }}
DIC_KIND: ${{ env.sudachiKind }}
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 }}