Skip to content

Build - macOS

Build - macOS #1

Workflow file for this run

name: Build - macOS
on:
schedule:
- cron: '0 0 * * *' # Every day at midnight (UTC)
workflow_call:
workflow_dispatch:
inputs:
assume-triggerd-by-schedule:
description: 'Assume this workflow was triggered by the schedule'
required: false
type: boolean
permissions:
contents: write
jobs:
build:
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-13-runner]
sqlcipher: ["0", "1"]
env:
DAILY: false
steps:
- name: Set 'DAILY' environment variable
run: |
if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event.inputs.assume-triggerd-by-schedule }}" == "true" ]; then
echo "DAILY=true" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v4
- if: env.DAILY == 'false'
name: Configure build (Continuous)
run: |
export MACOSX_DEPLOYMENT_TARGET=10.12
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLCipher-dev-'$(git rev-parse --short --verify HEAD)'"/' CMakeLists.txt
else
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLite-dev-'$(git rev-parse --short --verify HEAD)'"/' CMakeLists.txt
fi
mkdir build && cd build
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DcustomTap=1 -Dsqlcipher=${{ matrix.sqlcipher }} ..
- if: env.DAILY == 'true'
name: Configure build (Daily)
run: |
export MACOSX_DEPLOYMENT_TARGET=10.12
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLCipher Nightly"/' CMakeLists.txt
else
sed -i "" 's/"DB Browser for SQLite"/"DB Browser for SQLite Nightly"/' CMakeLists.txt
fi
mkdir build && cd build
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DcustomTap=1 -Dsqlcipher=${{ matrix.sqlcipher }} ..
- name: Build
working-directory: ./build
run: ninja
- name: Build Extension
run: |
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/extension-formats.c
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/extension-functions.c
curl -L -o src/extensions/fileio.c 'https://sqlite.org/src/raw?filename=ext/misc/fileio.c&ci=trunk'
curl -L -o src/extensions/test_windirect.c 'https://sqlite.org/src/raw?filename=src/test_windirent.c&ci=trunk'
curl -L -o src/extensions/test_windirect.h 'https://sqlite.org/src/raw?filename=src/test_windirent.h&ci=trunk'
clang -I /opt/homebrew/opt/db4subsqlitefts@5/include -L /opt/homebrew/opt/db4subsqlitefts@5/lib -fno-common -dynamiclib src/extensions/fileio.c src/extensions/test_windirect.c
- if: github.event_name != 'pull_request'
name: Notarize the app
uses: ./.github/actions/notarize-macos
with:
APPLE_ID: ${{ secrets.MACOS_CODESIGN_APPLE_ID }}
APPLE_PW: ${{ secrets.MACOS_CODESIGN_APPLE_PW }}
DAILY: ${{ env.DAILY }}
DEV_ID: ${{ secrets.MACOS_CODESIGN_DEV_ID }}
KEYCHAIN_PATH: ${{ secrets.MACOS_CODESIGN_KEYCHAIN_PATH }}
KEYCHAIN_PW: ${{ secrets.MACOS_CODESIGN_KEYCHAIN_PW }}
SQLCIPHER: ${{ matrix.sqlcipher }}
TEAM_ID: ${{ secrets.MACOS_CODESIGN_TEAM_ID }}
- if: github.event_name != 'pull_request' && env.DAILY == 'false'
name: Release (Continuous)
uses: softprops/action-gh-release@v1
with:
files: DB.Browser.for.*.dmg
prerelease: true
tag_name: continuous
- if: env.DAILY == 'true'
name: Release (Daily)
run: |
export DATE=$(date +%Y%m%d)
rsync -aP *.dmg ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }}:/nightlies/macos-universal/
if [ "${{ matrix.sqlcipher }}" = "1" ]; then
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "cd /nightlies/latest && rm -f *SQLC*-universal*dmg*"
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "ln -s /nightlies/macos-universal/DB.Browser.for.SQLCipher-universal_$DATE.dmg /nightlies/latest/DB.Browser.for.SQLCipher-universal.dmg"
else
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "cd /nightlies/latest && rm -f *SQLi*-universal*dmg*"
ssh -q ${{ secrets.MACOS_BUILD_ARTIFACTS_UPLOAD_TARGET }} "ln -s /nightlies/macos-universal/DB.Browser.for.SQLite-universal_$DATE.dmg /nightlies/latest/DB.Browser.for.SQLite-universal.dmg"
fi