forked from sqlitebrowser/sqlitebrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
70 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,68 @@ | ||
name: Build - macOS | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * *' # Every day at midnight (UTC) | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [macos-12] | ||
sqlcipher: ["0", "1"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
build: | ||
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [macos-13-runner] | ||
sqlcipher: ["0", "1"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Cache Homebrew and NPM | ||
id: cache-homebrew-npm | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.npm | ||
/usr/local/bin | ||
/usr/local/Cellar | ||
/usr/local/Frameworks | ||
/usr/local/Homebrew | ||
/usr/local/opt | ||
key: ${{ runner.os }}-homebrew | ||
- name: Configure build | ||
run: | | ||
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: steps.cache-homebrew-npm.outputs.cache-hit == 'true' | ||
name: Link appdmg, SQLCipher and SQLite | ||
run: | | ||
brew link --force sqlcipherdb4s | ||
brew link --force sqlitefts5 | ||
npm install -g appdmg | ||
- name: Build | ||
working-directory: ./build | ||
run: ninja | ||
|
||
- if: steps.cache-homebrew-npm.outputs.cache-hit != 'true' | ||
name: Install dependencies | ||
run: | | ||
# Avoid Homebrew return non-zero exit code | ||
unset HOMEBREW_NO_INSTALL_FROM_API; brew untap homebrew/core; brew untap homebrew/cask; brew update | ||
brew tap sqlitebrowser/sqlite3; brew install node qt@5 sqlcipherdb4s sqlitefts5 | ||
npm install -g appdmg | ||
- 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 | ||
- name: Configure build | ||
run: | | ||
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 -DCMAKE_PREFIX_PATH=/usr/local/opt/qt@5 -Dsqlcipher=${{ matrix.sqlcipher }} .. | ||
- 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 }} | ||
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 }} | ||
|
||
- name: Build | ||
working-directory: ./build | ||
run: make -j3 | ||
- if: github.event_name != 'pull_request' && github.event_name != 'schedule' | ||
name: Release (Continuous) | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: DB\ Browser\ for\ *.dmg | ||
prerelease: true | ||
tag_name: continuous | ||
|
||
- name: Build extensions | ||
run: | | ||
clang -I /usr/local/opt/sqlitefts5/include -L /usr/local/opt/sqlitefts5/lib -fno-common -dynamiclib src/extensions/extension-formats.c | ||
clang -I /usr/local/opt/sqlitefts5/include -L /usr/local/opt/sqlitefts5/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 /usr/local/opt/sqlitfts5/include -L /usr/local/opt/sqlitefts5/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 }} | ||
DEV_ID: ${{ secrets.MACOS_CODESIGN_DEV_ID }} | ||
P12: ${{ secrets.MACOS_CODESIGN_P12 }} | ||
P12_PW: ${{ secrets.MACOS_CODESIGN_P12_PW }} | ||
KEYCHAIN_PW: ${{ secrets.MACOS_CODESIGN_KEYCHAIN_PW }} | ||
SQLCIPHER: ${{ matrix.sqlcipher }} | ||
TEAM_ID: ${{ secrets.MACOS_CODESIGN_TEAM_ID }} | ||
|
||
- if: github.event_name != 'pull_request' | ||
name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: DB\ Browser\ for\ *.dmg | ||
prerelease: true | ||
tag_name: continuous | ||
# TODO: - if: github.event_name == 'schedule' |