-
Notifications
You must be signed in to change notification settings - Fork 2
198 lines (167 loc) · 6.02 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Build
on:
push:
paths:
- "data/**"
- "pos_tagger_scripts/build-lt.sh"
- "lt-changes/**"
- ".github/workflows/build.yml"
pull_request:
branches:
- "main"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: Set paths
run: |
lt_dir="${{ github.workspace }}/lt"
echo "LT_HOME=${lt_dir}/languagetool" >> $GITHUB_ENV
echo "FR_DICT_HOME=${lt_dir}/french-pos-dict" >> $GITHUB_ENV
echo "LT_TMP_DIR=${lt_dir}/tmp" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
path: ${{ env.FR_DICT_HOME }}
repository: ${{ env.GITHUB_ACTION_REPOSITORY }}
fetch-depth: 0
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
env:
LT_BRANCH: "master"
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
- name: Check Poetry config
working-directory: ${{ env.FR_DICT_HOME }}
run: poetry check
- name: Install Python dependencies
working-directory: ${{ env.FR_DICT_HOME }}
run: poetry install --no-root
env:
POETRY_HTTP_BASIC_GITLAB_USERNAME: "lt-ai-package-registry"
POETRY_HTTP_BASIC_GITLAB_PASSWORD: ${{ secrets.POETRY_HTTP_BASIC_GITLAB_PASSWORD }}
- name: Set dictionary version
working-directory: ${{ env.FR_DICT_HOME }}
run: echo "FR_DICT_VERSION=test-$(date "+%Y-%m-%d")-$RANDOM" >> $GITHUB_ENV
- name: Set up Perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: "5.38"
- name: Install Perl dependencies
run: cpan install "Switch" "Text::Unaccent::PurePerl"
- name: Set up JDK 17 for x64
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
architecture: x64
- name: Checkout LT
uses: actions/checkout@v3
with:
repository: languagetool-org/languagetool
ref: ${{ env.LT_BRANCH }}
path: ${{ env.LT_HOME }}
token: ${{ secrets.LT_OS_TOKEN }}
- name: Cache LT Build
uses: actions/cache@v2
with:
path: |
${{ env.LT_HOME }}/languagetool-standalone/target
${{ env.LT_HOME }}/languagetool-dev/target
~/.m2
key: lt-build-${{ hashFiles('lt/languagetool/pom.xml', 'lt/languagetool/**/*.java') }}
id: lt-cache
- name: Build LT
if: steps.lt-cache.outputs.cache-hit != 'true'
run: mvn clean install -DskipTests
working-directory: ${{ env.LT_HOME }}
- name: Build LT Dev
if: steps.lt-cache.outputs.cache-hit != 'true'
run: mvn clean compile assembly:single
working-directory: ${{ env.LT_HOME }}/languagetool-dev
- name: Build POS tagging dictionary
working-directory: ${{ env.FR_DICT_HOME }}
run: |
poetry run python "dict_tools/scripts/build_tagger_dicts.py" \
--language fr \
--force-install \
--no-force-compile \
--spelling \
--install-version "${{ env.FR_DICT_VERSION }}"
- name: Update dictionary version in LT pom.xml
working-directory: ${{ env.FR_DICT_HOME }}
run: |
poetry run python "dict_tools/scripts/update_pom.py" \
--new-version "${{ env.FR_DICT_VERSION }}" \
--package-name "french-pos-dict"
- name: Test LT
working-directory: ${{ env.LT_HOME }}
run: |
mvn clean install -DskipTests
./build.sh fr test
- name: Archive Java src for deployment
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: src
path: ${{ env.FR_DICT_HOME }}/results/java-lt/src
deploy:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
# Necessary since downloading artefacts with an 'overwrite' option is not supported
- name: Empty out src directory
run: rm -rf results/java-lt/src/*
- name: Download artefact from upstream workflow
uses: actions/download-artifact@v4
with:
name: src
path: results/java-lt/src/
- name: Set dictionary version
run: echo "FR_DICT_VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//g')" >> $GITHUB_ENV
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
- name: Check Poetry config
run: poetry check
- name: Install Python dependencies
run: poetry install --no-root
env:
POETRY_HTTP_BASIC_GITLAB_USERNAME: "lt-ai-package-registry"
POETRY_HTTP_BASIC_GITLAB_PASSWORD: ${{ secrets.POETRY_HTTP_BASIC_GITLAB_PASSWORD }}
- name: Add dictionary version to package pom
run: |
poetry run python "dict_tools/scripts/update_pom.py" \
--new-version "${{ env.FR_DICT_VERSION }}" \
--package-name "french-pos-dict" \
--verbosity debug
- name: Set up JDK 17 for x64
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
architecture: x64
- name: Import GPG Key
run: echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
- name: Deploy to SonaType
env:
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
working-directory: results/java-lt
run: mvn clean deploy -P release -s ${{ github.workspace }}/results/java-lt/settings.xml