-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
178 lines (158 loc) · 7.79 KB
/
Copy pathcppcmake-ubuntu.yml
File metadata and controls
178 lines (158 loc) · 7.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# KEEP THE RUNNER OS AS LOW AS POSSIBLE.
# If built on the latest OS, it may not run on previous OS versions.
# Related: https://docs.appimage.org/reference/best-practices.html#binaries-compiled-on-old-enough-base-system
name: Build (Ubuntu)
on:
workflow_call:
inputs:
NIGHTLY:
default: false
type: boolean
CONSOLIDATE_DEPENDENCY_SUMMARY:
default: false
type: boolean
workflow_dispatch:
jobs:
build:
name: ${{ matrix.os }} (${{ matrix.bundle }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
bundle: [SQLCipher, SQLite]
os: [ubuntu-22.04, ubuntu-22.04-arm]
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install and cache dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.6.0
with:
packages: libfuse2 libqcustomplot-dev libqscintilla2-qt5-dev libqt5svg5 ninja-build qttools5-dev
version: ${{ matrix.os }}
- if: matrix.bundle == 'SQLCipher'
name: Build SQLCipher
working-directory: ${{ runner.temp }}
run: |
git clone https://github.com/sqlcipher/sqlcipher && cd sqlcipher && git checkout $(git describe --tags --abbrev=0)
LDFLAGS="-lcrypto -Wl,-soname,libsqlcipher.so.0" ./configure --prefix=./prefix --with-tempstore=yes --enable-load-extension --disable-tcl CFLAGS="-DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STAT4 -DSQLITE_HAS_CODEC -DSQLITE_SOUNDEX"
make -j2 && sudo make install -j2
cp ${GITHUB_WORKSPACE}/tools/linux/sqlcipher_rename.sh .
chmod +x sqlcipher_rename.sh && sudo ./sqlcipher_rename.sh
- if: matrix.bundle == 'SQLite'
name: Build SQLite
run: |
TARBALL=$(curl -s https://sqlite.org/download.html | awk '/<!--/,/-->/ {print}' | grep 'sqlite-autoconf' | cut -d ',' -f 3)
SHA3=$(curl -s https://sqlite.org/download.html | awk '/<!--/,/-->/ {print}' | grep 'sqlite-autoconf' | cut -d ',' -f 5)
curl -LsS -o sqlite.tar.gz https://sqlite.org/${TARBALL}
VERIFY=$(openssl dgst -sha3-256 sqlite.tar.gz | cut -d ' ' -f 2)
if [ "$SHA3" != "$VERIFY" ]; then
echo "::error::SQLite tarball checksum mismatch."
exit 1
fi
tar -xzf sqlite.tar.gz && cd sqlite-autoconf-*
CPPFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_MAX_ATTACHED=125 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_SNAPSHOT=1" ./configure --disable-shared
make -j2 && sudo make install -j2
- name: Configure build
run: |
mkdir -v appbuild appdir && cd appbuild
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=$RUNNER_TEMP/sqlcipher/prefix \
-DCMAKE_INSTALL_PREFIX:PATH=../appdir/usr \
-DENABLE_TESTING=ON \
-DFORCE_INTERNAL_QSCINTILLA=ON \
-Dsqlcipher=${{ matrix.bundle == 'SQLCipher' }} ..
- name: Build
working-directory: ./appbuild
run: ninja install
- name: Tests
working-directory: ./appbuild
run: ninja test
- name: Build AppImage
run: |
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20240109-1/linuxdeploy-$(uname -m).AppImage"
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20240109-1/linuxdeploy-plugin-qt-$(uname -m).AppImage"
chmod a+x "linuxdeploy-$(uname -m).AppImage" "linuxdeploy-plugin-qt-$(uname -m).AppImage"
if [ "${{ inputs.NIGHTLY }}" = "true" ]; then
export VERSION=$(date +%Y%m%d)
else
export VERSION=$(printf "dev-`git -C . rev-parse --short HEAD`")
fi
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib:$RUNNER_TEMP/sqlcipher/prefix/lib" "./linuxdeploy-$(uname -m).AppImage" --appdir=appdir --desktop-file=appdir/usr/share/applications/sqlitebrowser.desktop --plugin qt --output appimage
- name: Rename a file
run: |
for i in DB_Browser_for_SQLite*; do mv "$i" "${i//_/.}"; done
if [ "${{ matrix.bundle }}" = "SQLCipher" ]; then
export FILE=$(ls DB.Browser.for.SQLite*.AppImage)
export FILE=${FILE/SQLite/SQLCipher}
mv -v DB.Browser.for.SQLite*.AppImage $FILE
fi
- if: github.event_name != 'pull_request'
name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: build-artifacts-${{ matrix.os }}-${{ matrix.bundle }}
path: DB.Browser.for.*.AppImage
retention-days: 1
- name: Summary
run: |
QT_VERSION=$(qmake --version | awk '/Using Qt version/ {print $4}')
if [ "${{ matrix.bundle }}" = "SQLCipher" ]; then
OPENSSL_VERSION=$(openssl version | awk '{print $2}')
SQLCIPHER_VERSION=$($RUNNER_TEMP/sqlcipher/prefix/bin/sqlcipher ":memory:" "PRAGMA cipher_version;" | awk '{print $1}')
SQLITE_VERSION="Not applicable"
else
OPENSSL_VERSION="Not applicable"
SQLCIPHER_VERSION="Not applicable"
SQLITE_VERSION=$(/usr/local/bin/sqlite3 --version | awk '{print $1}')
fi
mkdir -p dependency-summary
SUMMARY_ROW="| Build (Ubuntu) | ${{ matrix.os }} / ${{ matrix.bundle }} | $OPENSSL_VERSION | $QT_VERSION | $SQLCIPHER_VERSION | $SQLITE_VERSION |"
echo "$SUMMARY_ROW" > "dependency-summary/dependencies-ubuntu-${{ matrix.os }}-${{ matrix.bundle }}.md"
- name: Upload dependency summary
uses: actions/upload-artifact@v7
with:
name: dependency-summary-ubuntu-${{ matrix.os }}-${{ matrix.bundle }}
path: dependency-summary/*.md
retention-days: 1
summarize-dependencies:
if: always() && inputs.CONSOLIDATE_DEPENDENCY_SUMMARY != true && !cancelled()
needs: build
name: Summarize Dependencies
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
steps:
- name: Download dependency summaries
uses: actions/download-artifact@v8
continue-on-error: true
with:
pattern: dependency-summary-*
path: dependency-summary
merge-multiple: true
- name: Summary
run: |
{
echo "## Dependencies used"
echo ""
echo "| Workflow | Target | OpenSSL | Qt | SQLCipher | SQLite |"
echo "| :---: | :---: | :---: | :---: | :---: | :---: |"
} >> "$GITHUB_STEP_SUMMARY"
if [ -d dependency-summary ] && find dependency-summary -type f -name '*.md' | grep -q .; then
find dependency-summary -type f -name '*.md' -print | sort | while IFS= read -r file; do
cat "$file" >> "$GITHUB_STEP_SUMMARY"
done
else
echo "| Not available | No dependency summaries were uploaded. | - | - | - | - |" >> "$GITHUB_STEP_SUMMARY"
fi
release:
if: github.event_name == 'workflow_dispatch' && github.workflow == 'Build (Ubuntu)'
needs: build
name: Release
permissions:
actions: read
contents: write
uses: ./.github/workflows/release.yml