Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
108 changes: 71 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,27 @@ jobs:
laz-url: ${{ matrix.laz-url }}
fpc-url: ${{ matrix.fpc-url }}

- name: Verify script executable bits (Git tree)
shell: bash
run: |
# Check that CI and other scripts are executable. Git on Windows can break the exec flag if you edit the file there and commit.
FAIL=0
for FILE in Scripts/*.sh; do
MODE="$(git ls-files -s "$FILE" | awk '{print $1}')"
if [ "$MODE" != "100755" ]; then
echo "::error file=$FILE::Missing executable bit in Git tree (mode $MODE)"
FAIL=1
fi
done
exit $FAIL

- name: Setup Windows
if: runner.os == 'Windows'
shell: bash
run: |
# Add FPC to PATH
LAZ_DIR="$RUNNER_TEMP/lazarus"
FPC_BIN=$(find "$LAZ_DIR/" -name "fpc.exe" | head -1)
FPC_BIN=$(find "$LAZ_DIR/" -type f -executable -name "fpc.exe" | head -1)
FPC_DIR=$(dirname "$FPC_BIN")
echo "Found FPC: $FPC_BIN"
echo "$FPC_DIR" >> $GITHUB_PATH
Expand All @@ -83,30 +97,7 @@ jobs:
- name: Setup Linux
if: runner.os == 'Linux'
shell: bash
run: |
# Needed for SDL and GL demos
sudo apt install libsdl1.2-dev -y

# To build LCL demos with GTK3 backend.
sudo apt install libgtk-3-dev

# To build LCL demos with Qt5 backend. If you see any linking problems, rather
# install the latest libqt5pas release from https://github.com/davidbannon/libqt5pas/releases
sudo apt install libqt5pas-dev -y

# With current Lazarus + Ubuntu versions we need to get newer libqt6pas release
BASE_URL=https://github.com/davidbannon/libqt6pas/releases/download/v6.2.10
if [[ "$RUNNER_ARCH" == "X64" ]]; then
wget $BASE_URL/libqt6pas6_6.2.10-1_amd64.deb
sudo apt install ./libqt6pas6_6.2.10-1_amd64.deb -y
wget $BASE_URL/libqt6pas6-dev_6.2.10-1_amd64.deb
sudo apt install ./libqt6pas6-dev_6.2.10-1_amd64.deb -y
else
wget $BASE_URL/libqt6pas6_6.2.10-1_arm64.deb
sudo apt install ./libqt6pas6_6.2.10-1_arm64.deb -y
wget $BASE_URL/libqt6pas6-dev_6.2.10-1_arm64.deb
sudo apt install ./libqt6pas6-dev_6.2.10-1_arm64.deb -y
fi
run: ./Scripts/CI.SetupLinux.sh

- name: Setup macOS
if: runner.os == 'macOS'
Expand All @@ -118,21 +109,15 @@ jobs:

- name: Print info
shell: bash
run: |
echo "Lazarus:" $(lazbuild --version)
echo "FPC:" $(fpc -iWTPTO)
echo "OS: "$RUNNER_OS", ARCH:" $RUNNER_ARCH
if [ "$RUNNER_OS" == "Linux" ]; then
echo " "$(lsb_release -d)
fi
run: ./Scripts/CI.PrintInfo.sh

- name: Build demos with FPC
shell: bash
run: bash -e ./Scripts/CI.BuildDemosFPC.sh
run: ./Scripts/CI.BuildDemosFPC.sh

- name: Build demos with Lazarus
shell: bash
run: bash -e ./Scripts/CI.BuildDemosLazarus.sh
run: ./Scripts/CI.BuildDemosLazarus.sh

- name: Build Lazarus packages
shell: bash
Expand All @@ -142,7 +127,7 @@ jobs:

- name: Run demos
shell: bash
run: bash -e ./Scripts/CI.RunDemos.sh
run: ./Scripts/CI.RunDemos.sh

- name: List Demos Bin directory
shell: bash
Expand All @@ -152,8 +137,57 @@ jobs:
with:
name: ci-artifacts-${{ runner.os }}-${{ runner.arch }}
path: |
Demos/Bin
Demos/Data
Demos
!Demos/ObjectPascal
!Demos/Bin/Dcu
if-no-files-found: error

# Extra non-critical job: test FPC trunk compiler via fpclazup on Ubuntu
build-fpc-trunk:
runs-on: ubuntu-latest
continue-on-error: true
timeout-minutes: 30
steps:
- uses: actions/checkout@v7

- name: Install Lazarus + FPC trunk (fpclazup)
uses: ollydev/setup-lazarus@v4.1
with:
fpclazup-url: https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.4.0i/fpclazup-x86_64-linux
fpclazup-lazcommit: a3e4c43c3d # Lazarus 4.99-5622 2026-07-16
fpclazup-fpccommit: ad4da509ba # FPC trunk 3.3.1-20578 2026-07-16

- name: Setup Linux
if: runner.os == 'Linux'
shell: bash
run: ./Scripts/CI.SetupLinux.sh

- name: Print info
shell: bash
run: ./Scripts/CI.PrintInfo.sh

- name: Build demos with Lazarus
shell: bash
run: ./Scripts/CI.BuildDemosLazarus.sh

- name: Run demos
shell: bash
run: ./Scripts/CI.RunDemos.sh

- name: Report trunk build outcome
if: always()
run: |
if [ "${{ job.status }}" = "failure" ]; then
echo "::warning::Build with FPC + Lazarus trunk failed."
fi

- uses: actions/upload-artifact@v7
with:
name: ci-artifacts-trunk-build-${{ runner.os }}-${{ runner.arch }}
path: |
Demos
!Demos/ObjectPascal
!Demos/Bin/Dcu
if-no-files-found: error


1 change: 1 addition & 0 deletions Scripts/BuildDemosFPC.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -eo pipefail

echo "Building Demos using Free Pascal"
echo
Expand Down
1 change: 1 addition & 0 deletions Scripts/BuildExtDemosFPC.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -eo pipefail

# Ext. demos have some build and/or runtime dependencies like SDL or GL.
# libsdl1.2-dev package should take care of both.
Expand Down
2 changes: 1 addition & 1 deletion Scripts/CI.BuildDemosFPC.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -eo pipefail

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
source "$SCRIPT_DIR/CI.Common.sh"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/CI.BuildDemosLazarus.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -eo pipefail

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
source "$SCRIPT_DIR/CI.Common.sh"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/CI.Common.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -eo pipefail

# Directory containing CI.Common.sh, normally <repo>/Scripts
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
Expand Down
12 changes: 12 additions & 0 deletions Scripts/CI.PrintInfo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
source "$SCRIPT_DIR/CI.Common.sh"

echo "Lazarus:" $(lazbuild --version)
echo "FPC:" $(fpc -iWTPTO)
echo "OS: "$RUNNER_OS", ARCH:" $RUNNER_ARCH
if [ "$RUNNER_OS" == "Linux" ]; then
echo " "$(lsb_release -d)
fi
2 changes: 1 addition & 1 deletion Scripts/CI.RunDemos.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -eo pipefail

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
source "$SCRIPT_DIR/CI.Common.sh"
Expand Down
30 changes: 30 additions & 0 deletions Scripts/CI.SetupLinux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -eo pipefail

# Setup for GitHub Actions Ubuntu runners.
# 2026-08-04: ubuntu-latest is Ubuntu 24.04

# Needed for SDL and GL demos
sudo apt install libsdl1.2-dev -y

# To build LCL demos with GTK3 backend.
sudo apt install libgtk-3-dev

# To build LCL demos with Qt5 backend. If you see any linking problems, rather
# install the latest libqt5pas release from https://github.com/davidbannon/libqt5pas/releases
sudo apt install libqt5pas-dev -y

# With current Lazarus + Ubuntu versions we need to get newer libqt6pas release
BASE_URL=https://github.com/davidbannon/libqt6pas/releases/download/v6.2.10

if [[ "$RUNNER_ARCH" == "X64" ]]; then
wget $BASE_URL/libqt6pas6_6.2.10-1_amd64.deb
sudo apt install ./libqt6pas6_6.2.10-1_amd64.deb -y
wget $BASE_URL/libqt6pas6-dev_6.2.10-1_amd64.deb
sudo apt install ./libqt6pas6-dev_6.2.10-1_amd64.deb -y
else
wget $BASE_URL/libqt6pas6_6.2.10-1_arm64.deb
sudo apt install ./libqt6pas6_6.2.10-1_arm64.deb -y
wget $BASE_URL/libqt6pas6-dev_6.2.10-1_arm64.deb
sudo apt install ./libqt6pas6-dev_6.2.10-1_arm64.deb -y
fi
2 changes: 1 addition & 1 deletion Scripts/Clean.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Mark with /usr/bin/env so new bash version (Homebrew etc.) is picked up for this script in macOS
set -e
set -eo pipefail

# enable /** globbing, needs Bash 4.0 or later (macOS has Bash 3.2 by default)
shopt -s globstar
Expand Down
10 changes: 5 additions & 5 deletions Scripts/DemosCommonFPC.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FPCOS=$($FPC -iTO | tr -d '\r')
FPCTARGET=$FPCCPU-$FPCOS

ROOTDIR=".."
DEMOPATH="$ROOTDIR/Demos/ObjectPascal"
DEMOPATH="$ROOTDIR/Demos/ObjectPascal"
BINPATH="$ROOTDIR/Demos/Bin"
UNITPATH="$ROOTDIR/Demos/Bin/Dcu/$FPCTARGET"
# FPC does not like creating any new directories passed by -FE -FU
Expand All @@ -28,18 +28,18 @@ OUTPUT="-FE$BINPATH -FU$UNITPATH"
# This is how you suppress -vn set in fpc.cfg
OPTIONS="-B -O3 -Xs -vn-"
INCLUDE="-Fi$ROOTDIR/Source"
LIBS="-Fl$ROOTDIR/Extensions/J2KObjects -Fl$ROOTDIR/Extensions/LibTiff/Compiled"
LIBS="-Fl$ROOTDIR/Extensions/J2KObjects -Fl$ROOTDIR/Extensions/LibTiff/Compiled"

DEMOSBUILD=0
DEMOCOUNT=0

function buildDemo {
$FPC $OPTIONS $OUTPUT $TARGET $DEFINES $UNITS $INCLUDE $LIBS $DEMOPATH/$1
if [ $? = 0 ]; then
if [ $? = 0 ]; then
((DEMOSBUILD++))
fi
fi
echo
}
}

function printResult {
SWITCH="\033["
Expand Down
4 changes: 2 additions & 2 deletions Source/ImagingGif.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1106,8 +1106,8 @@ function TGIFFileFormat.SaveData(Handle: TImagingHandle;

for I := FFirstIdx + 1 to FLastIdx do
begin
MaxWidth := Iff(Images[I].Width > MaxWidth, Images[I].Width, MaxWidth);
MaxHeight := Iff(Images[I].Height > MaxWidth, Images[I].Height, MaxHeight);
MaxWidth := Max(MaxWidth, Images[I].Width);
MaxHeight := Max(MaxHeight, Images[I].Height);
end;
end;

Expand Down