Skip to content

Commit 10f132b

Browse files
authored
Update to grobid 0.9.0 (#183)
* chore: update to grobid 0.9.0 * chore: update copyright * fix: replace old library for test coverage * fix: kotlin tests * fix: download models from HF * feat: add summary after docker build --------- Signed-off-by: Luca Foppiano <luca@foppiano.org>
1 parent 7281ac5 commit 10f132b

23 files changed

Lines changed: 228 additions & 97 deletions

.github/workflows/ci-build-manual.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
with:
1919
fetch-tags: true
2020
fetch-depth: 0
21-
- name: Set up JDK 17
21+
- name: Set up JDK 21
2222
uses: actions/setup-java@v4
2323
with:
24-
java-version: '17.0.10+7'
24+
java-version: '21'
2525
distribution: 'temurin'
2626
cache: 'gradle'
2727
- name: Build with Gradle
@@ -46,5 +46,29 @@ jobs:
4646
registry: docker.io
4747
pushImage: true
4848
tags: ${{ github.event.inputs.custom_tag}}
49-
- name: Image digest
50-
run: echo ${{ steps.docker_build.outputs.digest }}
49+
- name: Job summary
50+
if: always()
51+
env:
52+
IMAGE_FULL_NAME: ${{ steps.docker_build.outputs.imageFullName }}
53+
IMAGE_NAME: ${{ steps.docker_build.outputs.imageName }}
54+
IMAGE_TAGS: ${{ steps.docker_build.outputs.tags }}
55+
IMAGE_DIGEST: ${{ steps.docker_build.outputs.digest }}
56+
run: |
57+
{
58+
if [ -z "$IMAGE_DIGEST" ]; then
59+
echo "_Built but not pushed (pull request)_"
60+
echo ""
61+
fi
62+
echo "## Docker image"
63+
echo ""
64+
echo "| Field | Value |"
65+
echo "|----------|-------|"
66+
echo "| Image | \`$IMAGE_FULL_NAME\` |"
67+
echo "| Tags | \`$IMAGE_TAGS\` |"
68+
echo "| Digest | \`$IMAGE_DIGEST\` |"
69+
echo "| Registry | \`docker.io\` |"
70+
echo ""
71+
echo '```'
72+
echo "docker pull $IMAGE_FULL_NAME"
73+
echo '```'
74+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/ci-build.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Set up JDK 17
16+
- name: Set up JDK 21
1717
uses: actions/setup-java@v4
1818
with:
19-
java-version: '17.0.10+7'
19+
java-version: '21'
2020
distribution: 'temurin'
2121
cache: 'gradle'
2222
- name: Build with Gradle
2323
run: ./gradlew build -x test
2424

25-
- name: Test with Gradle Jacoco and Coveralls
26-
run: ./gradlew test jacocoTestReport coveralls --no-daemon
25+
- name: Test with Gradle Jacoco
26+
run: ./gradlew test jacocoTestReport --no-daemon
2727

2828
- name: Coveralls GitHub Action
2929
uses: coverallsapp/github-action@v2
@@ -61,5 +61,29 @@ jobs:
6161
registry: docker.io
6262
pushImage: ${{ github.event_name != 'pull_request' }}
6363
tags: latest-develop
64-
- name: Image digest
65-
run: echo ${{ steps.docker_build.outputs.digest }}
64+
- name: Job summary
65+
if: always()
66+
env:
67+
IMAGE_FULL_NAME: ${{ steps.docker_build.outputs.imageFullName }}
68+
IMAGE_NAME: ${{ steps.docker_build.outputs.imageName }}
69+
IMAGE_TAGS: ${{ steps.docker_build.outputs.tags }}
70+
IMAGE_DIGEST: ${{ steps.docker_build.outputs.digest }}
71+
run: |
72+
{
73+
if [ -z "$IMAGE_DIGEST" ]; then
74+
echo "_Built but not pushed (pull request)_"
75+
echo ""
76+
fi
77+
echo "## Docker image"
78+
echo ""
79+
echo "| Field | Value |"
80+
echo "|----------|-------|"
81+
echo "| Image | \`$IMAGE_FULL_NAME\` |"
82+
echo "| Tags | \`$IMAGE_TAGS\` |"
83+
echo "| Digest | \`$IMAGE_DIGEST\` |"
84+
echo "| Registry | \`docker.io\` |"
85+
echo ""
86+
echo '```'
87+
echo "docker pull $IMAGE_FULL_NAME"
88+
echo '```'
89+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/ci-integration-manual.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
uses: actions/checkout@v4
2121
with:
2222
path: ./grobid/grobid-quantities
23-
- name: Set up JDK 17
23+
- name: Set up JDK 21
2424
uses: actions/setup-java@v4
2525
with:
26-
java-version: '17.0.10+7'
26+
java-version: '21'
2727
distribution: 'temurin'
2828
cache: 'gradle'
2929
- name: Build and run integration tests

.github/workflows/ci-release.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set up JDK 17
20+
- name: Set up JDK 21
2121
uses: actions/setup-java@v4
2222
with:
23-
java-version: '17.0.10+7'
23+
java-version: '21'
2424
distribution: 'temurin'
2525
cache: 'gradle'
2626
- name: Build with Gradle
2727
run: ./gradlew build -x test
2828

29-
- name: Test with Gradle Jacoco and Coveralls
30-
run: ./gradlew test jacocoTestReport coveralls --no-daemon
29+
- name: Test with Gradle Jacoco
30+
run: ./gradlew test jacocoTestReport --no-daemon
3131

3232
- name: Coveralls GitHub Action
3333
uses: coverallsapp/github-action@v2
@@ -70,5 +70,29 @@ jobs:
7070
registry: docker.io
7171
pushImage: ${{ github.event_name != 'pull_request' }}
7272
tags: ${{ steps.set_tags.outputs.tags }}
73-
- name: Image digest
74-
run: echo ${{ steps.docker_build.outputs.digest }}
73+
- name: Job summary
74+
if: always()
75+
env:
76+
IMAGE_FULL_NAME: ${{ steps.docker_build.outputs.imageFullName }}
77+
IMAGE_NAME: ${{ steps.docker_build.outputs.imageName }}
78+
IMAGE_TAGS: ${{ steps.docker_build.outputs.tags }}
79+
IMAGE_DIGEST: ${{ steps.docker_build.outputs.digest }}
80+
run: |
81+
{
82+
if [ -z "$IMAGE_DIGEST" ]; then
83+
echo "_Built but not pushed (pull request)_"
84+
echo ""
85+
fi
86+
echo "## Docker image"
87+
echo ""
88+
echo "| Field | Value |"
89+
echo "|----------|-------|"
90+
echo "| Image | \`$IMAGE_FULL_NAME\` |"
91+
echo "| Tags | \`$IMAGE_TAGS\` |"
92+
echo "| Digest | \`$IMAGE_DIGEST\` |"
93+
echo "| Registry | \`docker.io\` |"
94+
echo ""
95+
echo '```'
96+
echo "docker pull $IMAGE_FULL_NAME"
97+
echo '```'
98+
} >> "$GITHUB_STEP_SUMMARY"

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22

33
# Set the version of Python and other tools you might need
44
build:
5-
os: ubuntu-22.04
5+
os: ubuntu-24.04
66
tools:
77
python: "3.11"
88

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7+
## [0.9.0]
8+
9+
### Changed
10+
11+
+ Updated to Grobid version 0.9.0
12+
+ Bumped Java toolchain from 17 to 21 (required by Grobid 0.9.0)
13+
+ Bumped Gradle wrapper from 7.2 to 9.0.0
14+
+ Bumped Kotlin from 1.8.21 to 2.0.21
15+
+ Migrated Shadow plugin from `com.github.johnrengelman.shadow:7.1.0` to `com.gradleup.shadow:8.3.10` (new coordinates after the original repo was archived)
16+
+ Bumped Dropwizard from 4.0.13 to 4.0.17, dropwizard-guicey from 7.0.0 to 7.3.1, dropwizard-metrics from 4.2.22 to 4.2.38
17+
+ Bumped Jackson from 2.14.3 to 2.21.1
18+
+ Bumped Guava from 31.0.1-jre to 33.5.0-jre, commons-io from 2.14.0 to 2.21.0, commons-lang3 from 3.12.0 to 3.20.0, commons-collections4 from 4.4 to 4.5.0, httpclient from 4.5.13 to 4.5.14
19+
+ Bumped JEP from 4.0.2 to 4.3.1
20+
+ Bumped JUnit BOM from 5.10.2 to 5.14.1, EasyMock from 5.2.0 to 5.6.0, MockK from 1.13.9 to 1.13.17
21+
+ Migrated `application` block to use `mainClass` (Gradle 9 compatibility) and corrected the main class to `org.grobid.service.main.GrobidQuantitiesApplication`
22+
+ Updated CI workflows and Dockerfile builder image to JDK 21
23+
+ Removed the abandoned `com.github.kt3k.coveralls` Gradle plugin (unmaintained since 2020 and unable to detect GitHub Actions as a CI service). Coverage is already uploaded by the `coverallsapp/github-action@v2` step in the CI workflows, which reads the Jacoco XML report directly.
24+
25+
### Fixed
26+
27+
+ Spelling fix in exception messages ("occured" → "occurred")
28+
+ Worked around a Kotlin 2.0.21 K2 compiler `StackOverflowError` in `IrConstDeclarationAnnotationTransformer` that surfaced when compiling `LabellingUtilsTest.kt` on CI runners with small default JVM stacks (the test file has seven methods with nested string-concatenation chains that produce a deeply nested `IrCall` tree). Bumped the Kotlin compiler daemon stack via `kotlin.daemon.jvmargs=-Xmx2g -Xss4m` in `gradle.properties`. To be removed once upstream Kotlin fixes the recursive visitor bug.
29+
+ Fixed Docker build failure in the `installModels` step. The `downloadModelsGit` Gradle task was using `org.ajoberstar.grgit:5.3.0` (embedded jgit 6.10.x), whose Smart HTTP v2 protocol parser is incompatible with HuggingFace's git server and fails with `TransportException: Short read of block` during the initial `lsRefs` handshake. Even a working `git clone` would have left LFS/Xet pointer stubs instead of real model weights for files >10MB, requiring a follow-up `git lfs pull` / `git xet checkout` with their own failure modes. Replaced `Grgit.clone(...)` with the official HuggingFace CLI: `hf download sciencialab/grobid-quantities-models --local-dir <path>` invoked via a Gradle `Exec` task. Added Python 3.11 to the Docker builder image via the `ppa:deadsnakes/ppa` repository (matching the parent grobid runtime image's Python version) and installed the `hf` CLI via `https://hf.co/cli/install.sh`. The builder cleans up the HuggingFace cache, pip cache, venv, and `hf` wrapper after `installModels` finishes. Removed the `org.ajoberstar.grgit` plugin and the `git-lfs` apt package from the builder.
30+
31+
### Notes
32+
33+
+ PowerMock 2.0.9 is intentionally retained for now: 5 test classes still depend on it. Java 21 compatibility is achieved via additional `--add-opens` JVM flags in the `test` and `integration` Gradle tasks. The Mockito migration of these tests is tracked as deferred work.
34+
735
## [0.8.2]
836

937
### Changed

Dockerfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,23 @@
1616
# build builder image
1717
# -------------------
1818

19-
FROM openjdk:17-jdk-slim as builder
19+
FROM eclipse-temurin:21-jdk-jammy as builder
2020

2121
USER root
2222

2323
RUN apt-get update && \
24-
apt-get -y --no-install-recommends install apt-utils libxml2 git-lfs unzip
24+
apt-get -y --no-install-recommends install \
25+
apt-utils libxml2 unzip \
26+
ca-certificates curl git git-lfs && \
27+
rm -rf /var/lib/apt/lists/*
28+
29+
# Install git-xet so `git clone` can fetch large model files stored via Xet on
30+
# the HuggingFace Hub (https://hf.co/docs/hub/git-xet). The install script drops
31+
# the `git-xet` binary under /usr/local/bin and `git xet install` registers the
32+
# required git filter/smudge config globally.
33+
RUN curl --proto '=https' --tlsv1.2 -sSf \
34+
https://raw.githubusercontent.com/huggingface/xet-core/refs/heads/main/git_xet/install.sh | sh \
35+
&& git xet install
2536

2637
WORKDIR /opt/grobid
2738

@@ -42,7 +53,6 @@ COPY localLibs grobid-quantities-source/localLibs
4253
WORKDIR /opt/grobid/grobid-quantities-source
4354
RUN rm -rf /opt/grobid/grobid-home/models/*
4455
RUN ./gradlew clean assemble -x shadowJar --no-daemon --stacktrace --info
45-
RUN git lfs install
4656
RUN ./gradlew installModels --no-daemon --info --stacktrace \
4757
&& rm -f /opt/grobid/grobid-home/models/*.zip \
4858
&& rm -rf /opt/grobid/grobid-home/models/quantities_models
@@ -63,7 +73,7 @@ WORKDIR /opt
6373
# build runtime image
6474
# -------------------
6575

66-
FROM lfoppiano/grobid:0.8.2-full as runtime
76+
FROM lfoppiano/grobid:0.9.0-full as runtime
6777

6878
# setting locale is likely useless but to be sure
6979
ENV LANG C.UTF-8

0 commit comments

Comments
 (0)