Skip to content

Commit 94dd7dc

Browse files
committed
Updated CD
1 parent 2e04fee commit 94dd7dc

2 files changed

Lines changed: 45 additions & 10 deletions

File tree

.github/workflows/main.yml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ on:
88
- "*.*.*"
99
pull_request:
1010
workflow_dispatch:
11+
inputs:
12+
release_version:
13+
description: "Optional tag/version to release after successful builds, for example 1.0.0. Leave empty for build-only."
14+
required: false
15+
type: string
16+
prerelease:
17+
description: "Mark a manual release as prerelease."
18+
required: false
19+
default: false
20+
type: boolean
1121

1222
concurrency:
1323
group: sqlite-columnar-${{ github.workflow }}-${{ github.ref }}
@@ -192,7 +202,7 @@ jobs:
192202
run: 'sqlite3 :memory: ".load ./dist/columnar" "SELECT columnar_version();"'
193203

194204
- name: validate macOS signing secrets
195-
if: startsWith(github.ref, 'refs/tags/') && matrix.notarize
205+
if: (startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '')) && matrix.notarize
196206
env:
197207
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
198208
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
@@ -212,7 +222,7 @@ jobs:
212222
exit "$missing"
213223
214224
- name: create keychain for macOS codesign
215-
if: startsWith(github.ref, 'refs/tags/') && matrix.notarize
225+
if: (startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '')) && matrix.notarize
216226
env:
217227
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
218228
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
@@ -231,7 +241,7 @@ jobs:
231241
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
232242
233243
- name: codesign macOS dylib
234-
if: startsWith(github.ref, 'refs/tags/') && matrix.notarize
244+
if: (startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '')) && matrix.notarize
235245
env:
236246
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
237247
run: |
@@ -247,14 +257,18 @@ jobs:
247257
printf "%s\n" "${{ github.sha }}" > package/GIT_COMMIT
248258
249259
- name: notarize macOS release archive
250-
if: startsWith(github.ref, 'refs/tags/') && matrix.notarize
260+
if: (startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '')) && matrix.notarize
251261
env:
252262
APPLE_ID: ${{ secrets.APPLE_ID }}
253263
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
254264
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
255265
run: |
256266
set -euo pipefail
257-
VERSION="${GITHUB_REF_NAME}"
267+
if [ "${GITHUB_REF#refs/tags/}" != "$GITHUB_REF" ]; then
268+
VERSION="$GITHUB_REF_NAME"
269+
else
270+
VERSION="${{ github.event.inputs.release_version }}"
271+
fi
258272
RELEASE_DIR="release/${{ matrix.artifact }}-${VERSION}"
259273
RELEASE_ZIP="release/${{ matrix.artifact }}-${VERSION}.zip"
260274
mkdir -p "$RELEASE_DIR"
@@ -263,42 +277,53 @@ jobs:
263277
xcrun notarytool submit "$RELEASE_ZIP" --apple-id "$APPLE_ID" --password "$APPLE_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
264278
265279
- name: cleanup macOS signing keychain
266-
if: always() && startsWith(github.ref, 'refs/tags/') && matrix.notarize
280+
if: always() && (startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '')) && matrix.notarize
267281
run: |
268282
rm -f "$RUNNER_TEMP/developer_id_application.p12"
269283
security delete-keychain "$RUNNER_TEMP/columnar-signing.keychain-db" || true
270284
271285
- uses: actions/upload-artifact@v4.6.2
272-
if: startsWith(github.ref, 'refs/tags/') && matrix.notarize
286+
if: (startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '')) && matrix.notarize
273287
with:
274288
name: ${{ matrix.artifact }}
275289
path: release/*.zip
276290
if-no-files-found: error
277291
retention-days: 14
278292

279293
- uses: actions/upload-artifact@v4.6.2
280-
if: ${{ !startsWith(github.ref, 'refs/tags/') || !matrix.notarize }}
294+
if: ${{ !(startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '')) || !matrix.notarize }}
281295
with:
282296
name: ${{ matrix.artifact }}
283297
path: package/
284298
if-no-files-found: error
285299
retention-days: 14
286300

287301
release:
288-
if: startsWith(github.ref, 'refs/tags/')
302+
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release_version != '')
289303
needs: build
290304
runs-on: ubuntu-22.04
291305
permissions:
292306
contents: write
293307
steps:
308+
- name: resolve release version
309+
id: release
310+
run: |
311+
set -euo pipefail
312+
if [ "${GITHUB_REF#refs/tags/}" != "$GITHUB_REF" ]; then
313+
VERSION="$GITHUB_REF_NAME"
314+
else
315+
VERSION="${{ github.event.inputs.release_version }}"
316+
fi
317+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
318+
294319
- uses: actions/download-artifact@v4.2.1
295320
with:
296321
path: artifacts
297322

298323
- name: package release archives
299324
run: |
300325
set -e
301-
VERSION="${GITHUB_REF_NAME}"
326+
VERSION="${{ steps.release.outputs.version }}"
302327
mkdir -p release
303328
for dir in artifacts/columnar-*; do
304329
name="$(basename "$dir")"
@@ -312,6 +337,10 @@ jobs:
312337
313338
- uses: softprops/action-gh-release@v2
314339
with:
340+
tag_name: ${{ steps.release.outputs.version }}
341+
target_commitish: ${{ github.sha }}
342+
generate_release_notes: true
343+
prerelease: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'true' }}
315344
files: |
316345
release/*.zip
317346
release/*.tar.gz

test/columnar-robustness-test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
#include <stdarg.h>
1313
#include <stdlib.h>
1414
#include <string.h>
15+
#ifndef _WIN32
1516
#include <sys/wait.h>
1617
#include <unistd.h>
18+
#endif
1719

1820
static void fatal(sqlite3 *db, const char *zMsg, int rc){
1921
fprintf(stderr, "%s: %s (%d)\n", zMsg, db ? sqlite3_errmsg(db) : "", rc);
@@ -320,6 +322,7 @@ static void test_api_fuzz(sqlite3 *db){
320322
expect_error(db, "wrong table type", "SELECT columnar_count(123,'v')");
321323
}
322324

325+
#ifndef _WIN32
323326
static void create_crash_db(const char *zDb, const char *zExt){
324327
sqlite3 *db = 0;
325328
unlink(zDb);
@@ -375,6 +378,7 @@ static void test_crash_recovery(const char *zExt){
375378
close_db(db);
376379
unlink(zDb);
377380
}
381+
#endif
378382

379383
int main(int argc, char **argv){
380384
const char *zExt = argc>1 ? argv[1] : "./columnar";
@@ -387,7 +391,9 @@ int main(int argc, char **argv){
387391
test_rollback(db);
388392
test_fuzz_names(db);
389393
close_db(db);
394+
#ifndef _WIN32
390395
test_crash_recovery(zExt);
396+
#endif
391397
printf("columnar robustness tests passed\n");
392398
return 0;
393399
}

0 commit comments

Comments
 (0)