-
Notifications
You must be signed in to change notification settings - Fork 173
213 lines (204 loc) · 6.76 KB
/
ci.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: CI
# Use bash by default on all platforms.
defaults:
run:
shell: bash
on:
push:
paths-ignore:
- '*.rst'
- NEWS
pull_request:
branches: master
paths-ignore:
- '*.rst'
- NEWS
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- name: "C distribution build"
CFLAGS_DIST_BUILD: '-O2 -Wall -W -std=c90 -Wdeclaration-after-statement -Werror'
- name: "C distribution build (clang)"
CFLAGS_DIST_BUILD: '-O2 -Wall -W -std=c90 -Wdeclaration-after-statement -Werror'
CC: clang
- name: "C"
c_tests: y
CFLAGS: '-O2 -Wall -W -std=c99 -Werror'
- name: "C (clang)"
c_tests: y
CFLAGS: '-O2 -Wall -W -std=c99 -Werror'
CC: clang
- name: java
JAVA: java
JAVAC: javac
JAVACFLAGS: '-Xlint:all -Werror'
- name: go_old
os: 'ubuntu-22.04'
apt_packages: 'golang-1.13'
GO: go
- name: go_new
os: 'ubuntu-24.04'
apt_packages: 'golang-1.22'
GO: go
- name: javascript_node
NODE: node
apt_packages: 'nodejs'
- name: rust
RUST: rust
apt_packages: 'rustc'
- name: csharp
MCS: mcs
apt_packages: 'mono-devel'
- name: Pascal
FPC: fpc
apt_packages: 'fpc'
- name: Python 3.8
PYTHON: python3.8
os: 'ubuntu-20.04'
apt_packages: 'python3.8'
# The pure Python versions run slowly - when we used travis for CI
# we used to need to thin the testdata for languages such as Arabic
# where there's a lot to avoid the build exceeding the maximum time
# allowed for a CI job. GHA allows jobs to take up to 6 hours so
# we should no longer need to do this.
THIN_FACTOR: 1
- name: Python 3.10
PYTHON: python3.10
os: 'ubuntu-22.04'
apt_packages: 'python3.10'
THIN_FACTOR: 1
- name: Python 3.12
PYTHON: python3.12
os: 'ubuntu-24.04'
apt_packages: 'python3.12'
THIN_FACTOR: 1
- name: Python (pypy3)
PYTHON: pypy3
apt_packages: 'pypy3'
- name: Ada
gprbuild: gprbuild
apt_packages: 'gnat gprbuild'
- name: Windows (C)
os: windows-latest
c_tests: y
ccache: sccache
- name: Windows (Go)
os: windows-latest
GO: go
MAKE: mingw32-make
mingw64_packages: 'mingw-w64-ucrt-x86_64-go'
ccache: sccache
fail-fast: false
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
env:
CC: ${{ matrix.CC || 'gcc' }}
MAKE: ${{ matrix.MAKE || 'make' }}
STEMMING_DATA: 'snowball-data'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
- name: Checkout data
run: |
# Try to check out a branch of the same name from the snowball-data
# repo sibling of this snowball repo, so that PRs requiring changes to
# both can be CI tested easily.
#
# For a PR, GHA will have merged the PR branch into upstream master so
# we need to similarly merge the snowball-data branch into upstream
# master of the snowball-data repo as there may be changes there
# required by snowball master.
#
# If there's no such branch (or repo) we just use the standard
# snowball-data repo's default branch. If there is such a branch but
# the merge fails, we treat that as a fatal error.
UPSTREAM_REPO_URL=https://github.com/snowballstem/snowball-data.git
if [ -n "$GITHUB_HEAD_REF" ] ; then
# Pull-request.
GH_BRANCH=${GITHUB_HEAD_REF}
GH_REPO_OWNER=${GITHUB_ACTOR}
GH_REPO_URL=https://github.com/$GH_REPO_OWNER/snowball-data.git
git clone "$UPSTREAM_REPO_URL"
cd snowball-data
git remote add pr "$GH_REPO_URL"
git config --global user.email "[email protected]"
git config --global user.name "CI"
echo "Trying branch $GH_BRANCH from $GH_REPO_URL"
if git fetch pr && git branch --track "$GH_BRANCH" pr/"$GH_BRANCH" ; then
git merge "$GH_BRANCH"
else
echo "Falling back to $UPSTREAM_REPO_URL"
fi
else
# Push.
GH_BRANCH=${GITHUB_REF_NAME}
GH_REPO_OWNER=${GITHUB_REPOSITORY_OWNER}
GH_REPO_URL=https://github.com/$GH_REPO_OWNER/snowball-data.git
echo "Trying branch $GH_BRANCH from $GH_REPO_URL"
if ! git clone -b "$GH_BRANCH" "$GH_REPO_URL" ; then
echo "Falling back to $UPSTREAM_REPO_URL"
git clone "$UPSTREAM_REPO_URL"
fi
fi
- name: Install CCache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.name }}
variant: ${{ matrix.ccache || 'ccache' }}
- name: Install Ubuntu packages
if: matrix.apt_packages
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.apt_packages }}
- name: Install mingw64 packages
if: matrix.mingw64_packages
uses: msys2/setup-msys2@v2
with:
msystem: ucrt64
install: base-devel ${{ matrix.mingw64_packages }}
- name: Build
run: $MAKE CC="${{ matrix.ccache || 'ccache' }} $CC"
- name: Test C dist
if: matrix.CFLAGS_DIST_BUILD
run: |
pip install setuptools
$MAKE dist
mkdir tmp
cd tmp
tar xf ../dist/libstemmer_c-*.tar.gz
cd libstemmer_c-*
$MAKE CFLAGS="${{ matrix.CFLAGS_DIST_BUILD }}"
- name: Test C
if: matrix.c_tests
run: $MAKE check CC="$CC"
- name: Test Python
if: matrix.PYTHON
run: $MAKE check_python python="${{ matrix.PYTHON }}" THIN_FACTOR="${{ matrix.THIN_FACTOR }}"
- name: Test Java
if: matrix.JAVA && matrix.JAVAC
run: $MAKE check_java JAVA="${{ matrix.JAVA }}" JAVAC="${{ matrix.JAVAC }}"
- name: Test C#
if: matrix.MCS
run: $MAKE check_csharp MCS="${{ matrix.MCS }}"
- name: Test Javascript
if: matrix.NODE
run: $MAKE check_js NODE="${{ matrix.NODE }}"
- name: Test Rust
if: matrix.RUST
run: $MAKE check_rust RUST="${{ matrix.RUST }}"
- name: Test Go
if: matrix.GO
run: |
go mod init github.com/snowballstem/snowball
$MAKE check_go GO="${{ matrix.GO }}"
- name: Test Pascal
if: matrix.FPC
run: $MAKE check_pascal FPC="${{ matrix.FPC }}"
- name: Test Ada
if: matrix.gprbuild
run: $MAKE check_ada gprbuild="${{ matrix.gprbuild }}"