Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
911b9b0
wip: prepare github workflows
Feb 1, 2026
d1c4e92
wip: add scripts
Feb 1, 2026
7130d7f
ci: run on dev too
Feb 1, 2026
1a1dd83
wip: fix .phpt file
Feb 1, 2026
2c35610
ci: trying to fix 8.5 build
Feb 1, 2026
54885d9
ci: trying to fix 8.x builds
Feb 1, 2026
fe0bf46
ci: trying to fix 8.x builds
Feb 1, 2026
3e29b00
ci: trying to fix 8.x builds
Feb 1, 2026
fd4c295
wip: fix tesseract.cpp
Feb 1, 2026
5fc2501
Fix segfault in 8.5 and add debug logs for 8.4
Feb 1, 2026
7d87db8
Fix segfault in 8.5 and add debug logs for 8.4
Feb 1, 2026
b00e7bd
Add try-catch to test to reveal initialization errors
Feb 1, 2026
9c45e35
wip: fixing ci.yml
Feb 1, 2026
daf08bc
wip: fixing ci.yml
Feb 1, 2026
9233602
wip: fixing ci.yml
Feb 1, 2026
b0e2bb0
wip: fixing ci.yml
Feb 1, 2026
45d989f
wip: fixing ci.yml
Feb 1, 2026
d6fbc46
wip: fixing ci.yml
Feb 1, 2026
50259fe
wip: fixing ci.yml
Feb 1, 2026
4779c72
wip: fixing ci.yml
Feb 1, 2026
1c35627
wip: fixing ci.yml
Feb 1, 2026
7a78500
wip: fixing ci.yml
Feb 1, 2026
1480509
wip: fixing ci.yml
Feb 1, 2026
723fe89
wip: fixing ci.yml
Feb 1, 2026
b4aeac3
wip: fixing ci.yml
Feb 1, 2026
56d0fd5
wip: fixing ci.yml
Feb 1, 2026
fe69909
wip: fixing ci.yml
Feb 1, 2026
b0c21b0
wip: fixing ci.yml
Feb 1, 2026
64af58e
wip: fixing ci.yml
Feb 1, 2026
a4761fb
wip: fixing ci.yml
Feb 1, 2026
6831116
wip: fixing ci.yml
Feb 1, 2026
cd877f7
wip: fixing ci.yml
Feb 1, 2026
2bc5197
wip: fixing ci.yml
Feb 1, 2026
ac74b2b
wip: fixing ci.yml
Feb 1, 2026
363c5bb
wip: fixing ci.yml
Feb 2, 2026
4936bc6
wip: fixing ci.yml
Feb 2, 2026
b9298ee
wip: fix tesseract.cpp
Feb 2, 2026
f970a95
wip: fix tesseract.cpp
Feb 2, 2026
7811b4d
wip: fix tesseract.cpp
Feb 2, 2026
2963437
wip: fix tesseract.cpp
Feb 2, 2026
7ea367f
wip: fix tesseract.cpp
Feb 2, 2026
d8d9e62
wip: fix tesseract.cpp
Feb 2, 2026
a63d963
wip: fix tesseract.cpp
Feb 2, 2026
81b1915
wip: fix tesseract.cpp
Feb 2, 2026
f7cbfdc
wip: fix tesseract.cpp
Feb 2, 2026
4402d91
wip: fix tesseract.cpp
Feb 2, 2026
d3841b8
wip: fix tesseract.cpp
Feb 2, 2026
f3e0a5f
wip: fix tesseract.cpp
Feb 2, 2026
2415aa1
wip: fix tesseract.cpp
Feb 2, 2026
54767f4
wip: fix tesseract.cpp
Feb 2, 2026
045a5f8
wip: fix self-hosted runner
Feb 2, 2026
d848a65
wip: fix self-hosted runner
Feb 2, 2026
23d94da
wip: fix self-hosted runner
Feb 2, 2026
38742e0
wip: fix self-hosted runner
Feb 2, 2026
08ab920
wip: fix self-hosted runner
Feb 2, 2026
e58cde3
wip: fix self-hosted runner
Feb 2, 2026
3b9b120
wip: fix self-hosted runner
Feb 2, 2026
3ade085
wip: fix self-hosted runner
Feb 2, 2026
17a9848
wip: fix self-hosted runner
Feb 2, 2026
2acbe84
wip: fix self-hosted runner
Feb 2, 2026
43477dc
wip: fix self-hosted runner
Feb 2, 2026
5e5daf0
wip: fix self-hosted runner
Feb 2, 2026
c91198a
wip: fix self-hosted runner
Feb 2, 2026
284097d
wip: fix self-hosted runner
Feb 2, 2026
6db099a
wip: fix self-hosted runner
Feb 2, 2026
d00a528
wip: fix self-hosted runner
Feb 2, 2026
11d88db
wip: fix self-hosted runner
Feb 2, 2026
8155433
wip: fix self-hosted runner
Feb 2, 2026
43b4f94
wip: fix self-hosted runner
Feb 2, 2026
d9a5e2d
wip: add release.yml action
Feb 2, 2026
ebabab5
Add release and deploy_debian workflows
Feb 2, 2026
5518f73
wip: ci.yml update
Feb 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Test (Matrix 8.x)

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
runs-on: [ self-hosted, opit-runner ]
container:
image: operativeit/bookworm-phpext-ci:latest
strategy:
fail-fast: false
max-parallel: 3
matrix:
php: [ '8.5']
steps:
- uses: actions/checkout@v4

- name: Build Tesseract extension
run: |
cd tesseract-1.0.0
phpize --clean || true
make clean || true
phpize
./configure --with-tesseract
make -j"$(nproc)"

- name: Run tests
env:
USE_ZEND_ALLOC: 0
OMP_THREAD_LIMIT: 1
run: |
cd tesseract-1.0.0
if ls tests/*.phpt >/dev/null 2>&1; then
TEST_PHP_EXECUTABLE=$(which php) make test TESTS="tests" REPORT_EXIT_STATUS=1 NO_INTERACTION=1 \
TEST_PHP_ARGS="-d opcache.enable=0 -d opcache.enable_cli=0 -d opcache.jit=0 -d opcache.protect_memory=0 -vv" || (
echo "=== TEST FAILED. SHOWING OUTPUTS ==="
for f in tests/*.out; do [ -e "$f" ] && echo ">>>> $f" && cat "$f"; done
for f in tests/*.diff; do [ -e "$f" ] && echo ">>>> $f" && cat "$f"; done
exit 1
)
else
echo "No PHPT tests found"
fi
50 changes: 50 additions & 0 deletions .github/workflows/deploy_debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Publish Debian Packages

on:
push:
tags:
- 'v*'

jobs:
build-debian:
runs-on: [ self-hosted, opit-runner ]
container:
image: operativeit/bookworm-phpext-ci:latest

steps:
- uses: actions/checkout@v4

- name: Install Packaging Dependencies
run: |
apt-get update
apt-get install -y debhelper dh-php devscripts fakeroot
# Install dependencies listed in control file
apt-get install -y libtesseract-dev libleptonica-dev tesseract-ocr pkg-config libxml2-utils
# Ensure php-all-dev is present.
# Note: In specialized PHPExt-CI containers, this might be pre-installed or custom managed.
apt-get install -y php-all-dev || true

- name: Build Debian Package
run: |
# Clean previous builds
fakeroot debian/rules clean

# Build package (binary only, unsigned source/changes) -us -uc
dpkg-buildpackage -us -uc -b

# Prepare artifacts
mkdir -p dist
mv ../*.deb dist/
mv ../*.buildinfo dist/ || true
mv ../*.changes dist/ || true

- name: Upload Artifacts to Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Wait a moment to ensure release exists if triggered simultaneously (though usually fast)
# Use the tag name from ref
TAG_NAME=${GITHUB_REF#refs/tags/}

# Upload assets
gh release upload "$TAG_NAME" dist/*.deb --clobber
90 changes: 90 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release

on:
workflow_dispatch:
inputs:
bump:
description: "major | minor | patch | X.Y.Z"
required: true
default: "patch"

permissions:
contents: write

jobs:
preflight-build:
runs-on: [ self-hosted, opit-runner ]
container:
image: operativeit/bookworm-phpext-ci:latest
strategy:
fail-fast: false
matrix:
php: ["8.4", "8.5"]
steps:
- uses: actions/checkout@v4

- name: Detect extension dir
id: extdir
run: |
if ls -d tesseract-* >/dev/null 2>&1; then
DIR="$(ls -d tesseract-* | sort -V | tail -n 1)"
else
DIR="."
fi
echo "dir=$DIR" >> $GITHUB_OUTPUT

- name: Build
run: |
cd "${{ steps.extdir.outputs.dir }}"
phpize --clean || true
phpize
./configure --with-tesseract
make -j"$(nproc)"

release:
needs: preflight-build
runs-on: [ self-hosted, opit-runner ]
container:
image: operativeit/bookworm-phpext-ci:latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure git
run: |
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
git fetch --tags --force

- name: Bump version
run: |
chmod +x scripts/bump_version.sh
scripts/bump_version.sh "${{ github.event.inputs.bump }}"

- name: Read new version
id: v
run: |
VER="$(cat .version)"
echo "ver=$VER" >> $GITHUB_OUTPUT
echo "tag=v$VER" >> $GITHUB_OUTPUT

- name: Commit bump
run: |
git add package.xml README.md .version || true
git add tesseract-* || true
git commit -m "chore(release): v${{ steps.v.outputs.ver }}"

- name: Tag & push
run: |
git tag "${{ steps.v.outputs.tag }}"
git push origin master
git push origin "${{ steps.v.outputs.tag }}"

- name: Create GitHub Release (auto notes)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.v.outputs.tag }}" \
--title "${{ steps.v.outputs.tag }}" \
--generate-notes
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ Makefile.objects
.DS_Store
*~


# Test Artifacts
php_test_results_*
tesseract-1.0.0/php_test_results_*
tests/*.diff
tests/*.out
tesseract-1.0.0/tests/*.diff
tesseract-1.0.0/tests/*.out
fpm_test.php
43 changes: 43 additions & 0 deletions scripts/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail

BUMP="${1:-}"
if [[ -z "$BUMP" ]]; then
echo "Uso: $0 {major|minor|patch|X.Y.Z}"
exit 1
fi

# Carpeta actual tipo tesseract-1.0.0 (si existe)
CUR_DIR="$(ls -d tesseract-* 2>/dev/null | sort -V | tail -n 1 || true)"
CUR_VER="0.0.0"
if [[ -n "$CUR_DIR" ]]; then
CUR_VER="${CUR_DIR#tesseract-}"
fi

# Calcula NEXT_VER
if [[ "$BUMP" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
NEXT_VER="$BUMP"
else
IFS='.' read -r MA MI PA <<< "$CUR_VER"
case "$BUMP" in
major) MA=$((MA+1)); MI=0; PA=0;;
minor) MI=$((MI+1)); PA=0;;
patch) PA=$((PA+1));;
*) echo "BUMP inválido: $BUMP"; exit 1;;
esac
NEXT_VER="$MA.$MI.$PA"
fi

echo "Versión: $CUR_VER -> $NEXT_VER"

# Actualiza SOLO <version><release>…</release>
perl -0777 -i -pe "s|(<version>\\s*<release>)[^<]+(</release>\\s*</version>)|\\1$NEXT_VER\\2|s" package.xml

# Si hay carpeta versionada, renómbrala
if [[ -n "${CUR_DIR:-}" && -d "$CUR_DIR" ]]; then
git mv "tesseract-$CUR_VER" "tesseract-$NEXT_VER"
# Actualiza README por si menciona la carpeta
sed -i "s/tesseract-$CUR_VER/tesseract-$NEXT_VER/g" README.md 2>/dev/null || true
fi

echo "$NEXT_VER" > .version
Loading