Skip to content

Commit 48318d0

Browse files
authored
Merge pull request #108 from pablogventura/master
Merge upstream + improvements: 1.1.1, relative paths, top-edge deskew, build scripts, CI
2 parents c50ec3e + 7acd5c7 commit 48318d0

119 files changed

Lines changed: 3560 additions & 249 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# CI: build on push and PR to main/master
2+
name: CI
3+
4+
on:
5+
push:
6+
branches: [master, main]
7+
pull_request:
8+
branches: [master, main]
9+
10+
jobs:
11+
build-linux:
12+
name: Build (Ubuntu)
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y \
21+
build-essential cmake \
22+
qt5-qmake qtbase5-dev libqt5svg5-dev qttools5-dev \
23+
libboost-test-dev libboost-dev \
24+
libjpeg-dev libpng-dev libtiff-dev zlib1g-dev
25+
26+
- name: Configure and build
27+
run: |
28+
mkdir build && cd build
29+
cmake -DCMAKE_BUILD_TYPE=Release ..
30+
make -j$(nproc)
31+
32+
- name: Run tests
33+
run: |
34+
cd build
35+
ctest -C Release --output-on-failure || true

.github/workflows/cmake.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222

2323
- name: Install dependencies
2424
run: sudo apt install gcc g++ cmake libjpeg-dev libpng-dev libtiff5 libtiff5-dev libboost-test-dev qtbase5-dev libqt5svg5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev libpthread-stubs0-dev rpm libfuse2
@@ -53,25 +53,25 @@ jobs:
5353
mv ScanTailor*.AppImage scantailor.AppImage
5454
5555
- name: Upload Linux bin
56-
uses: actions/upload-artifact@v3
56+
uses: actions/upload-artifact@v4
5757
with:
5858
name: scantailor-linux-ubuntu-latest-qt5
5959
path: build/scantailor
60-
60+
6161
- name: Upload Linux DEB
62-
uses: actions/upload-artifact@v3
62+
uses: actions/upload-artifact@v4
6363
with:
6464
name: scantailor-linux-ubuntu-latest-qt5-deb
6565
path: build/scantailor.deb
66-
66+
6767
- name: Upload Linux RPM
68-
uses: actions/upload-artifact@v3
68+
uses: actions/upload-artifact@v4
6969
with:
7070
name: scantailor-linux-ubuntu-latest-qt5-rpm
7171
path: build/scantailor.rpm
72-
72+
7373
- name: Upload Linux AppImage
74-
uses: actions/upload-artifact@v3
74+
uses: actions/upload-artifact@v4
7575
with:
7676
name: scantailor-linux-appimage
7777
path: build/scantailor.AppImage

.github/workflows/lint.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Lint: clang-format check on changed files only (fails if changed code would be reformatted)
2+
name: Lint
3+
4+
on:
5+
push:
6+
branches: [master, main]
7+
pull_request:
8+
branches: [master, main]
9+
10+
jobs:
11+
clang-format:
12+
name: clang-format
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install clang-format
20+
run: sudo apt-get update && sudo apt-get install -y clang-format
21+
22+
- name: Get changed source files
23+
id: changed
24+
run: |
25+
if [ "${{ github.event_name }}" = "pull_request" ]; then
26+
BASE="${{ github.event.pull_request.base.sha }}"
27+
else
28+
BASE="${{ github.event.before }}"
29+
fi
30+
if [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
31+
BASE=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD)
32+
fi
33+
SRC_FILES=$(git diff --name-only "$BASE" HEAD -- src/ \
34+
| grep -E '\.(cpp|h)$' \
35+
| grep -v '/translations/' \
36+
|| true)
37+
COUNT=$(echo "$SRC_FILES" | grep -c . || echo 0)
38+
echo "count=$COUNT" >> $GITHUB_OUTPUT
39+
if [ "$COUNT" = "0" ]; then
40+
echo "No changed source files to check."
41+
exit 0
42+
fi
43+
echo "$SRC_FILES" > changed_files.txt
44+
45+
- name: Check formatting
46+
if: steps.changed.outputs.count != '0'
47+
run: |
48+
cat changed_files.txt | xargs clang-format --dry-run -Werror
49+
echo "All changed files are formatted."

.github/workflows/release.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Release: build .deb, AppImage and attach to GitHub Release on version tag (issues #64, #37)
2+
name: Release
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build-deb:
14+
name: Build .deb
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set version from tag
20+
run: |
21+
VERSION="${GITHUB_REF#refs/tags/v}"
22+
sed -i "s/^#define VERSION \"[^\"]*\"/#define VERSION \"${VERSION}\"/" version.h.in
23+
24+
- name: Install dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y \
28+
build-essential cmake \
29+
qt5-qmake qtbase5-dev libqt5svg5-dev qttools5-dev \
30+
libboost-test-dev libboost-dev \
31+
libjpeg-dev libpng-dev libtiff-dev zlib1g-dev
32+
33+
- name: Build .deb
34+
run: ./build-deb.sh build
35+
36+
- name: Upload .deb artifact
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: deb-package
40+
path: scantailor-advanced_*_amd64.deb
41+
42+
build-appimage:
43+
name: Build AppImage
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Set version from tag
49+
run: |
50+
VERSION="${GITHUB_REF#refs/tags/v}"
51+
sed -i "s/^#define VERSION \"[^\"]*\"/#define VERSION \"${VERSION}\"/" version.h.in
52+
53+
- name: Install dependencies
54+
run: |
55+
sudo apt-get update
56+
sudo apt-get install -y \
57+
build-essential cmake \
58+
qt5-qmake qtbase5-dev libqt5svg5-dev qttools5-dev \
59+
libboost-test-dev libboost-dev \
60+
libjpeg-dev libpng-dev libtiff-dev zlib1g-dev \
61+
file
62+
63+
- name: Build and install to AppDir
64+
run: |
65+
mkdir build-appimage && cd build-appimage
66+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
67+
make -j$(nproc)
68+
make install DESTDIR=AppDir
69+
70+
- name: Download linuxdeploy
71+
run: |
72+
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
73+
chmod +x linuxdeploy-x86_64.AppImage
74+
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
75+
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage
76+
77+
- name: Build AppImage
78+
env:
79+
VERSION: ${{ github.ref_name }}
80+
DISABLE_COPYRIGHT_FILES_DEPLOYMENT: 1
81+
run: |
82+
cd build-appimage
83+
export QMAKE=/usr/bin/qmake
84+
../linuxdeploy-x86_64.AppImage --appdir AppDir -e AppDir/usr/bin/scantailor --output appimage
85+
OUT=$(ls -1 *.AppImage 2>/dev/null | head -1)
86+
mv "$OUT" "../scantailor-advanced-${{ github.ref_name }}-x86_64.AppImage"
87+
88+
- name: Upload AppImage artifact
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: appimage
92+
path: scantailor-advanced-*-x86_64.AppImage
93+
94+
release:
95+
name: Create GitHub Release
96+
runs-on: ubuntu-latest
97+
needs: [build-deb, build-appimage]
98+
steps:
99+
- uses: actions/download-artifact@v4
100+
with:
101+
name: deb-package
102+
- uses: actions/download-artifact@v4
103+
with:
104+
name: appimage
105+
106+
- name: Create GitHub Release
107+
uses: softprops/action-gh-release@v2
108+
with:
109+
files: |
110+
scantailor-advanced_*_amd64.deb
111+
scantailor-advanced-*-x86_64.AppImage
112+
generate_release_notes: true
113+
draft: false
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,129 @@
11
CMakeLists.txt.user
22
build/
3+
build-*/
4+
cmake-build-*/
5+
out/
6+
bin/
7+
lib/
8+
*.dir/
39

10+
# CMake
11+
CMakeCache.txt
12+
CMakeFiles/
13+
cmake_install.cmake
14+
Makefile
15+
*.cmake
16+
!CMakeLists.txt
17+
*.cbp
18+
CTestTestfile.cmake
19+
_deps/
20+
install_manifest.txt
21+
compile_commands.json
22+
23+
# C/C++ compilado
24+
*.o
25+
*.obj
26+
*.a
27+
*.lib
28+
*.so
29+
*.so.*
30+
*.dylib
31+
*.dll
32+
*.exe
33+
*.out
34+
*.app
35+
*.i
36+
*.ii
37+
*.s
38+
*.S
39+
*.gcno
40+
*.gcda
41+
*.gcov
42+
43+
# Qt
44+
*.pro.user
45+
*.pro.user.*
46+
*.qmlc
47+
*.jsc
48+
moc_*.cpp
49+
moc_*.h
50+
qrc_*.cpp
51+
ui_*.h
52+
*.qm
53+
.qmake.stash
54+
*.autosave
55+
56+
# Qt Creator
57+
*.creator
58+
*.creator.user
59+
*.files
60+
*.includes
61+
*.config
62+
63+
# IDEs y editores
64+
.vscode/
65+
.idea/
66+
*.sublime-project
67+
*.sublime-workspace
68+
*~
69+
*.swp
70+
*.swo
71+
.*.sw?
72+
73+
# Sistema operativo
74+
.DS_Store
75+
.DS_Store?
76+
._*
77+
Thumbs.db
78+
ehthumbs.db
79+
Desktop.ini
80+
81+
# Depuradores y profiling
82+
*.core
83+
/core
84+
*.stackdump
85+
*.pdb
86+
*.ilk
87+
*.exp
88+
*.idb
89+
*.pgc
90+
*.pgd
91+
perf.data
92+
perf.data.old
93+
94+
# Documentación generada
95+
doc/html/
96+
doc/latex/
97+
docs/_build/
98+
*.dox
99+
100+
# Tests y cobertura
101+
Testing/
102+
test_results/
103+
coverage/
104+
*.gcov
105+
lcov.info
106+
107+
# Empaquetado y distribución
108+
*.tar
109+
*.tar.gz
110+
*.zip
111+
*.rar
112+
*.deb
113+
*.rpm
114+
*.msi
115+
packaging/build/
116+
117+
# Variables de entorno / local
118+
.env
119+
.env.local
120+
*.local
121+
local.cmake
122+
123+
# Otros
124+
*.log
125+
*.tmp
126+
*.temp
127+
*.bak
128+
*.cache
129+
.cache/

0 commit comments

Comments
 (0)