Skip to content

Commit 16035be

Browse files
committed
ci: Improve Github Actions workflow
This improves the existing workflow file for Github Actions by adding SQLCipher support, fixing the unit tests, and making some other minor adjustments. Also a new workfile is added which build and uploads an AppImage. This workfile skips some of the other build steps like running the tests.
1 parent eb41e21 commit 16035be

File tree

2 files changed

+81
-20
lines changed

2 files changed

+81
-20
lines changed

.github/workflows/appimage.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: AppImage
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags:
7+
release:
8+
types: ['created']
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
build:
16+
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: true
20+
matrix:
21+
os: [ubuntu-18.04]
22+
sqlcipher: ["0", "1"]
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
- name: Install dependencies
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install qttools5-dev libqt5scintilla2-dev libqcustomplot-dev libsqlite3-dev libqt5svg5 libsqlcipher-dev qt5-default
30+
- name: Configure CMake
31+
run: |
32+
mkdir appbuild
33+
mkdir appdir
34+
cd appbuild
35+
cmake -DCMAKE_INSTALL_PREFIX:PATH=../appdir/usr -Wno-dev -DFORCE_INTERNAL_QSCINTILLA=ON -Dsqlcipher=${{ matrix.sqlcipher }} -DSQLITE_ENABLE_JSON1=1 ..
36+
- name: Run make
37+
run: |
38+
cd appbuild
39+
make install
40+
- name: Build AppImage
41+
run: |
42+
git rev-list master --count
43+
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
44+
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
45+
export VERSION=$(printf "master-`git rev-list HEAD --count`-` git -C . rev-parse --short HEAD`")
46+
./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage
47+
- name: Rename AppImage
48+
if: ${{ matrix.sqlcipher == 1 }}
49+
run: |
50+
export FILE=$(ls DB_Browser_for_SQLite*.AppImage)
51+
export FILE=${FILE/SQLite/SQLCipher}
52+
mv DB_Browser_for_SQLite*.AppImage $FILE
53+
- name: Upload to release page
54+
env:
55+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
56+
run: |
57+
find appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
58+
wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
59+
chmod a+x upload.sh
60+
UPLOADTOOL_ISPRERELEASE=true ./upload.sh DB_Browser_for_*.AppImage

.github/workflows/cppcmake.yml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: C/C++ CI
1+
name: CI
22

33
on:
44
push:
55
branches: ['*']
66
tags:
77
paths_ignore: ['docs/**', '.travis.yml']
88
pull_request:
9+
branches: ['*']
910
release:
1011
types: ['created']
1112

@@ -15,57 +16,57 @@ defaults:
1516

1617
jobs:
1718
build:
18-
name: ${{ matrix.config.name }}
19-
runs-on: ${{ matrix.config.os }}
19+
name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }}
20+
runs-on: ${{ matrix.os }}
2021
strategy:
21-
fail-fast: false
22+
fail-fast: true
2223
matrix:
23-
config:
24-
- {name: "ubuntu-20.04", os: "ubuntu-20.04"}
25-
24+
os: [ubuntu-20.04]
25+
sqlcipher: ["0", "1"]
2626
steps:
27-
- uses: actions/checkout@v2
27+
- name: Checkout
28+
uses: actions/checkout@v2
2829
- name: Install dependencies
2930
run: |
3031
sudo apt-get update
31-
sudo apt-get install qttools5-dev libqt5scintilla2-dev libqcustomplot-dev libsqlite3-dev
32+
sudo apt-get install qttools5-dev libqt5scintilla2-dev libqcustomplot-dev libsqlite3-dev libqt5svg5 libsqlcipher-dev
3233
- name: Configure CMake
3334
run: |
3435
cmake --version
3536
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
3637
-DCMAKE_INSTALL_PREFIX=${PWD}/install \
3738
-DCPACK_PACKAGE_DIRECTORY=${PWD}/package \
38-
-DENABLE_TESTING=ON
39-
- name: make
39+
-DENABLE_TESTING=ON \
40+
-Dsqlcipher=${{ matrix.sqlcipher }}
41+
- name: Run make
4042
run: cmake --build build --config Release -j --target install
4143
- name: run tests
42-
run: ctest -C Release
43-
- name: package
44+
run: ctest -V -C Release --test-dir build
45+
- name: Package
4446
run: |
4547
cmake --build build --config Release -j --target package
4648
cmake -E remove_directory package/_CPack_Packages
47-
- name: upload package
49+
- name: Upload package
4850
uses: actions/upload-artifact@master
4951
with:
50-
name: pkg-${{ matrix.config.name }}
52+
name: pkg-${{ matrix.os }}-sqlcipher${{ matrix.sqlcipher }}
5153
path: package
52-
- name: upload to release page
54+
- name: Upload to release page
5355
if: github.event_name == 'release'
5456
env:
55-
TOKEN: "token ${{ secrets.GITHUB_TOKEN }}"
57+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
5658
TAG: ${{ github.event.release.tag_name }}
5759
UPLOAD_URL: ${{ github.event.release.upload_url }}
5860
run: |
5961
# Do try this at home! The REST API is documented at
6062
# https://docs.github.com/en/free-pro-team@latest/rest and you can get a personal
6163
# access token at https://github.com/settings/tokens
62-
# (set TOKEN to "bearer abcdef1234")
64+
# (set GITHUB_TOKEN to "bearer abcdef1234")
6365
# you can get the UPLOAD_URL with a short bash snippet; make sure to set the env var TAG:
6466
# UPLOAD_URL=$(curl -H 'Accept: application/vnd.github.v3+json' $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/$TAG | jq -r .upload_url)
6567
UPLOAD_URL=${UPLOAD_URL%\{*} # remove "{name,label}" suffix
6668
for pkg in package/*.*; do
6769
NAME=$(basename $pkg)
6870
MIME=$(file --mime-type $pkg|cut -d ' ' -f2)
69-
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: $TOKEN" -H "Content-Type: $MIME" --data-binary @$pkg $UPLOAD_URL?name=$NAME
71+
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $MIME" --data-binary @$pkg $UPLOAD_URL?name=$NAME
7072
done
71-

0 commit comments

Comments
 (0)