Skip to content

Commit a2415ef

Browse files
committed
ci: replace Docker with PSFirebird for unified Windows/Linux testing
1 parent cb2fe66 commit a2415ef

File tree

1 file changed

+65
-79
lines changed

1 file changed

+65
-79
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -7,111 +7,97 @@ on:
77

88
jobs:
99
test:
10-
runs-on: ubuntu-latest
10+
runs-on: ${{ matrix.os }}
1111
strategy:
1212
fail-fast: false
1313
matrix:
1414
firebird-version: [3, 4, 5]
15+
os: [ubuntu-22.04, windows-latest]
1516
include:
1617
- firebird-version: 3
1718
db-file: fbtest30.fdb
18-
docker-image: firebirdsql/firebird:3
19+
fb-semver: '3.0.13'
1920
- firebird-version: 4
2021
db-file: fbtest40.fdb
21-
docker-image: firebirdsql/firebird:4
22+
fb-semver: '4.0.6'
2223
- firebird-version: 5
2324
db-file: fbtest50.fdb
24-
docker-image: firebirdsql/firebird:5
25-
25+
fb-semver: '5.0.3'
26+
27+
defaults:
28+
run:
29+
shell: pwsh
30+
31+
env:
32+
GITHUB_TOKEN: ${{ github.token }}
33+
2634
steps:
2735
- uses: actions/checkout@v4
28-
36+
2937
- name: Set up Python
3038
uses: actions/setup-python@v5
3139
with:
3240
python-version: '3.11'
33-
41+
3442
- name: Install Hatch
3543
run: pip install hatch
36-
37-
- name: Start Firebird Docker container
44+
45+
- name: Install PSFirebird
3846
run: |
39-
# Create a tmp directory that will be bind-mounted to the container
40-
# This ensures test files are accessible at the same paths inside and outside the container
41-
mkdir -p /tmp/firebird-test
42-
43-
# Start Firebird container with /tmp bind-mounted
44-
# Configure RemoteAuxPort for Firebird events support
45-
docker run -d \
46-
--name firebird \
47-
-e FIREBIRD_ROOT_PASSWORD=masterkey \
48-
-e ISC_PASSWORD=masterkey \
49-
-e FIREBIRD_CONF_RemoteAuxPort=3051 \
50-
-p 3050:3050 \
51-
-p 3051:3051 \
52-
-v /tmp:/tmp:rw \
53-
${{ matrix.docker-image }}
54-
55-
- name: Wait for Firebird to be ready
47+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
48+
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser -ForceBootstrap -ErrorAction Continue
49+
Install-Module -Name PSFirebird -Force -AllowClobber -Scope CurrentUser -Repository PSGallery
50+
51+
- name: Create Firebird environment
5652
run: |
57-
echo "Waiting for Firebird to be fully ready..."
58-
for i in {1..30}; do
59-
if docker exec firebird /bin/bash -c "echo 'SELECT 1 FROM RDB\$DATABASE;' | /opt/firebird/bin/isql -u SYSDBA -p masterkey employee" &>/dev/null 2>&1; then
60-
echo "Firebird is ready!"
61-
exit 0
62-
fi
63-
echo "Waiting... ($i/30)"
64-
sleep 2
65-
done
66-
echo "Firebird failed to start"
67-
docker logs firebird
68-
exit 1
69-
70-
- name: Extract and install Firebird client library from container
53+
$tempPath = if ($IsWindows) { $env:TEMP } else { '/tmp' }
54+
$fbPath = Join-Path $tempPath 'firebird-${{ matrix.firebird-version }}'
55+
New-FirebirdEnvironment -Version '${{ matrix.fb-semver }}' -Path $fbPath | Out-Null
56+
Write-Output "FB_PATH=$fbPath" >> $env:GITHUB_ENV
57+
58+
- name: Configure and start Firebird
7159
run: |
72-
# List available libraries in container for debugging
73-
echo "Available libraries in container:"
74-
docker exec firebird ls -la /opt/firebird/lib/ || docker exec firebird ls -la /usr/lib/
75-
76-
# Find and extract client library from the running container
77-
# Different versions may have different file names or locations
78-
LIB_PATH=""
79-
if docker exec firebird test -f /opt/firebird/lib/libfbclient.so.2; then
80-
# Get the actual file path by resolving the symlink
81-
LIB_PATH=$(docker exec firebird readlink -f /opt/firebird/lib/libfbclient.so.2)
82-
elif docker exec firebird test -f /opt/firebird/lib/libfbclient.so; then
83-
LIB_PATH=$(docker exec firebird readlink -f /opt/firebird/lib/libfbclient.so)
84-
elif docker exec firebird test -f /usr/lib/libfbclient.so; then
85-
LIB_PATH=$(docker exec firebird readlink -f /usr/lib/libfbclient.so)
86-
elif docker exec firebird test -f /usr/lib/x86_64-linux-gnu/libfbclient.so.2; then
87-
LIB_PATH=$(docker exec firebird readlink -f /usr/lib/x86_64-linux-gnu/libfbclient.so.2)
88-
else
89-
echo "Could not find libfbclient.so in container"
90-
exit 1
91-
fi
92-
93-
echo "Copying library from: $LIB_PATH"
94-
# Copy the actual library file (not the symlink)
95-
docker cp firebird:$LIB_PATH ${{ github.workspace }}/libfbclient.so
96-
97-
# Install to system
98-
sudo cp ${{ github.workspace }}/libfbclient.so /usr/lib/x86_64-linux-gnu/
99-
sudo ldconfig
100-
101-
# Verify installation
102-
ldconfig -p | grep libfbclient
103-
60+
# Configure RemoteAuxPort for Firebird events support
61+
$confPath = Join-Path $env:FB_PATH 'firebird.conf'
62+
Write-FirebirdConfiguration -Path $confPath -Configuration @{ RemoteAuxPort = 3051 }
63+
# Start Firebird server
64+
Start-FirebirdInstance -Environment $env:FB_PATH | Out-Null
65+
# Wait for the server to be ready
66+
Write-Output "Waiting for Firebird to be ready..."
67+
for ($i = 1; $i -le 30; $i++) {
68+
try {
69+
$tcp = [System.Net.Sockets.TcpClient]::new('localhost', 3050)
70+
$tcp.Close()
71+
Write-Output "Firebird is ready!"
72+
break
73+
} catch {
74+
if ($i -eq 30) { Write-Error "Firebird failed to start"; exit 1 }
75+
Write-Output "Waiting... ($i/30)"
76+
Start-Sleep -Seconds 2
77+
}
78+
}
79+
80+
- name: Find Firebird client library
81+
run: |
82+
if ($IsWindows) {
83+
$clientLib = Join-Path $env:FB_PATH 'fbclient.dll'
84+
} else {
85+
foreach ($name in @('lib/libfbclient.so.2', 'lib/libfbclient.so')) {
86+
$p = Join-Path $env:FB_PATH $name
87+
if (Test-Path $p) { $clientLib = $p; break }
88+
}
89+
}
90+
Write-Output "Found client library: $clientLib"
91+
Write-Output "FB_CLIENT_LIB=$clientLib" >> $env:GITHUB_ENV
92+
10493
- name: Run tests
105-
run: hatch test -- --host=localhost --port=3050 -v
94+
run: hatch test -- --host=localhost --port=3050 "--client-lib=$env:FB_CLIENT_LIB" -v
10695
env:
10796
FIREBIRD_VERSION: ${{ matrix.firebird-version }}
108-
109-
- name: Stop Firebird container
97+
98+
- name: Stop Firebird instance
11099
if: always()
111-
run: |
112-
docker logs firebird
113-
docker stop firebird
114-
docker rm firebird
100+
run: Get-FirebirdInstance | Stop-FirebirdInstance
115101

116102
build:
117103
needs: test

0 commit comments

Comments
 (0)