[rust] Skip unnecessary calls to find_among (#202) #119
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: 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 "ci@example.org" | |
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 }}" |