-
Notifications
You must be signed in to change notification settings - Fork 3
151 lines (130 loc) · 4.73 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
name: Build
on:
push:
paths:
- "data/**"
- ".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 "PT_DICT_HOME=${lt_dir}/portuguese-pos-dict" >> $GITHUB_ENV
echo "LT_TMP_DIR=${lt_dir}/tmp" >> $GITHUB_ENV
echo "HUNSPELL_DIR=${lt_dir}/hunspell" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
path: ${{ env.PT_DICT_HOME }}
repository: ${{ env.GITHUB_ACTION_REPOSITORY }}
fetch-depth: 0
submodules: recursive
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
- name: Check Poetry config
working-directory: ${{ env.PT_DICT_HOME }}
run: poetry check
# Ideally this will also install the 'dict_tools' submodule as a separate package ('dictionary-tools')
- name: Install Python dependencies
working-directory: ${{ env.PT_DICT_HOME }}
run: poetry install
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.PT_DICT_HOME }}
run: echo "PT_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: Checkout Hunspell
uses: actions/checkout@v3
with:
repository: hunspell/hunspell
path: ${{ env.HUNSPELL_DIR }}
- name: Compile Hunspell
working-directory: ${{ env.HUNSPELL_DIR }}
run: |
sudo apt-get install autoconf automake autopoint libtool
autoreconf -vfi
./configure
make
sudo make install
sudo ldconfig
which unmunch
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
architecture: x64
- name: Checkout LT
uses: actions/checkout@v3
with:
repository: languagetool-org/languagetool
path: ${{ env.LT_HOME }}
token: ${{ secrets.LT_OS_TOKEN }}
# TODO: remove this once the new tokenisation branch is merged into master!
ref: pt/dict/new_tokenisation
- name: Build LT
working-directory: ${{ env.LT_HOME }}
run: mvn clean install -DskipTests
- name: Build POS tagging dictionary
working-directory: ${{ env.PT_DICT_HOME }}
run: |
poetry run python "dict_tools/scripts/build_tagger_dicts.py" \
--language pt \
--force-install \
--install-version "${{ env.PT_DICT_VERSION }}"
- name: Update dictionary version in LT pom.xml
working-directory: ${{ env.PT_DICT_HOME }}
run: |
poetry run python "dict_tools/scripts/update_pom.py" \
--new-version "${{ env.PT_DICT_VERSION }}" \
--package-name "portuguese-pos-dict"
# This step will also re-compile LT with the new dictionary version in pom.xml
- name: Build spelling dictionaries
working-directory: ${{ env.PT_DICT_HOME }}
run: |
mkdir -p "${{ env.LT_TMP_DIR }}/compounds"
poetry run python "dict_tools/scripts/build_spelling_dicts.py" \
--language pt \
--tmp-dir "${{ env.LT_TMP_DIR }}" \
--force-install \
--install-version "${{ env.PT_DICT_VERSION }}" \
--max-threads "${{ steps.cpu-cores.outputs.count }}"
# TODO: uncomment after testing
# - name: Test LT
# working-directory: ${{ env.LT_HOME }}
# # If it fails, keep going; TODO: change this to 'false' after testing
# continue-on-error: true
# run: |
# mvn clean install -DskipTests
# ./build.sh pt test
- name: Archive Java src for deployment
# TODO: uncomment after this is tested to limit archiving to PRs to main
# TODO: add extra condition here to check for success of tests??
# Only do it after a successful build and push to main
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: src
path: ${{ env.PT_DICT_HOME }}/results/java-lt/src