Skip to content

Commit 1380455

Browse files
committed
ci: cache Firebird server downloads between runs
- Modify Prepare() to skip download/extract when Firebird is already cached - Remove directory deletion from Cleanup() (CI runners are ephemeral) - Add actions/cache step keyed by Firebird version - Saves download and extraction time on cache hits
1 parent 88fb92b commit 1380455

2 files changed

Lines changed: 32 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ jobs:
7474
name: test-binaries
7575
path: '.\\src\\'
7676

77+
- name: Firebird Cache
78+
uses: actions/cache@v4
79+
with:
80+
path: 'C:\firebird'
81+
key: firebird-${{ matrix.FIREBIRD_SELECTION }}
82+
7783
- name: Tests
7884
run: |
7985
try {

tests.ps1

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,36 @@ function Prepare() {
4747
$selectedConfiguration = $FirebirdConfiguration[$FirebirdSelection]
4848
$fbDownload = $selectedConfiguration.Download
4949
$fbDownloadName = $fbDownload -Replace '.+/(.+)$','$1'
50-
if (Test-Path $firebirdDir) {
51-
rm -Force -Recurse $firebirdDir
50+
51+
if (Test-Path "$firebirdDir\firebird.exe") {
52+
echo "Using cached Firebird from $firebirdDir"
53+
}
54+
else {
55+
if (Test-Path $firebirdDir) {
56+
rm -Force -Recurse $firebirdDir
57+
}
58+
mkdir $firebirdDir | Out-Null
59+
60+
pushd $firebirdDir
61+
try {
62+
echo "Downloading $fbDownload"
63+
Invoke-RestMethod -Uri $fbDownload -OutFile $fbDownloadName
64+
echo "Extracting $fbDownloadName"
65+
7z x -bsp0 -bso0 $fbDownloadName
66+
rm $fbDownloadName
67+
}
68+
finally {
69+
popd
70+
}
5271
}
53-
mkdir $firebirdDir | Out-Null
72+
73+
cp -Recurse -Force $firebirdDir\* $testsProviderDir
5474

5575
pushd $firebirdDir
5676
try {
57-
echo "Downloading $fbDownload"
58-
Invoke-RestMethod -Uri $fbDownload -OutFile $fbDownloadName
59-
echo "Extracting $fbDownloadName"
60-
7z x -bsp0 -bso0 $fbDownloadName
61-
rm $fbDownloadName
62-
cp -Recurse -Force .\* $testsProviderDir
63-
64-
ni firebird.log -ItemType File | Out-Null
77+
if (-not (Test-Path firebird.log)) {
78+
ni firebird.log -ItemType File | Out-Null
79+
}
6580

6681
echo "Starting Firebird"
6782
$process = Start-Process -FilePath $selectedConfiguration.Executable -ArgumentList $selectedConfiguration.Args -PassThru
@@ -88,7 +103,6 @@ function Cleanup() {
88103
# give OS time to release all files
89104
sleep -Milliseconds 100
90105
}
91-
rm -Force -Recurse $firebirdDir
92106

93107
Write-Host "=== END ==="
94108
}

0 commit comments

Comments
 (0)