Skip to content

Commit

Permalink
fix: setup gitea develop regularly build and test process
Browse files Browse the repository at this point in the history
  • Loading branch information
saturneric committed Nov 16, 2024
1 parent d26401e commit a4e6258
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 18 deletions.
25 changes: 18 additions & 7 deletions .gitea/workflows/develop-qt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
sudo apt-get update
sudo apt-get -y install build-essential binutils git gettext cmake
sudo apt-get -y install gcc g++ ninja-build gnupg qtbase5-dev qttools5-dev
sudo apt-get -y install libarchive-dev libssl-dev libgpgme-dev
sudo apt-get -y install libarchive-dev libssl-dev libgpgme-dev libfuse2
- name: Build googletest
run: |
Expand All @@ -50,14 +50,25 @@ jobs:
run: |
mkdir ${{github.workspace}}/build/final-artifact
cd ${{github.workspace}}/build/final-artifact
wget -c -nv https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-855-x86_64.AppImage -O appimagetool.AppImage
chmod u+x appimagetool.AppImage
./appimagetool.AppImage -s deploy ${{github.workspace}}/build/artifacts/AppDir/usr/share/applications/*.desktop
wget -c -nv https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod u+x linuxdeployqt-continuous-x86_64.AppImage
mkdir -p ${{github.workspace}}/build/artifacts/AppDir/usr/share/doc/libc6
touch ${{github.workspace}}/build/artifacts/AppDir/usr/share/doc/libc6/copyright
./linuxdeployqt-continuous-x86_64.AppImage ${{github.workspace}}/build/artifacts/AppDir/usr/share/applications/*.desktop -no-translations -extra-plugins=iconengines,platforms/libqoffscreen.so -appimage -unsupported-allow-new-glibc
echo "BUILD_TYPE_LOWER=${BUILD_TYPE,,}" >> ${GITHUB_ENV}
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> ${GITHUB_ENV}
- name: Run Unit Tests
run: |
cd ${{github.workspace}}/build/final-artifact
export QT_QPA_PLATFORM=offscreen
export GTEST_OUTPUT=json:/workspace/GpgFrontend/GpgFrontend/build/final-artifact/unit_tests.json
./Gpg_Frontend-*-x86_64.AppImage -t || true
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE_LOWER}}-${{ env.SHORT_SHA }}
path: ${{github.workspace}}/build/final-artifact/Gpg_Frontend*.AppImage*
name: gpgfrontend-${{env.BUILD_TYPE_LOWER}}-${{env.SHORT_SHA}}
path: |
${{github.workspace}}/build/final-artifact/Gpg_Frontend*.AppImage*
${{github.workspace}}/build/final-artifact/unit_tests.json
34 changes: 25 additions & 9 deletions .gitea/workflows/develop-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get -y install build-essential binutils git gettext cmake
sudo apt-get -y install gcc g++ ninja-build gnupg qt6-base-dev qt6-base-dev-tools qt6-l10n-tools qt6-tools-dev qt6-tools-dev-tools
sudo apt-get -y install libarchive-dev libssl-dev libgpgme-dev libgl1-mesa-dev
sudo apt-get -y install gcc g++ ninja-build gnupg qt6-base-dev qt6-base-dev-tools qt6-l10n-tools qt6-tools-dev qt6-tools-dev-tools libqt6svg6
sudo apt-get -y install libarchive-dev libssl-dev libgpgme-dev libgl1-mesa-dev libfuse2
- name: Build googletest
run: |
Expand Down Expand Up @@ -62,20 +62,36 @@ jobs:
cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDGPGFRONTEND_BUILD_TYPE_ONLY_APPLICATION=ON
cmake --build ${{github.workspace}}/build --config {{$env.BUILD_TYPE}} -- -v
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

- name: Copy Modules & Package App Image
run: |
cmake -E copy_directory ${{github.workspace}}/modules/build/artifacts/modules ${{github.workspace}}/build/artifacts/AppDir/usr/modules
mkdir ${{github.workspace}}/build/final-artifact
cd ${{github.workspace}}/build/final-artifact
wget -c -nv https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-855-x86_64.AppImage -O appimagetool.AppImage
chmod u+x appimagetool.AppImage
wget -c -nv https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod u+x linuxdeployqt-continuous-x86_64.AppImage
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
./appimagetool.AppImage -s deploy ${{github.workspace}}/build/artifacts/AppDir/usr/share/applications/*.desktop -executable-dir=${{github.workspace}}/build/artifacts/AppDir/usr/modules/
qtchooser -install qt6 $(which qmake6)
export QT_SELECT=qt6
mkdir -p ${{github.workspace}}/build/artifacts/AppDir/usr/share/doc/libc6
touch ${{github.workspace}}/build/artifacts/AppDir/usr/share/doc/libc6/copyright
./linuxdeployqt-continuous-x86_64.AppImage ${{github.workspace}}/build/artifacts/AppDir/usr/share/applications/*.desktop -no-translations -extra-plugins=iconengines,platforms/libqoffscreen.so -appimage -executable-dir=${{github.workspace}}/build/artifacts/AppDir/usr/modules/ -unsupported-allow-new-glibc
echo "BUILD_TYPE_LOWER=${BUILD_TYPE,,}" >> ${GITHUB_ENV}
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> ${GITHUB_ENV}
- name: Run Unit Tests
run: |
cd ${{github.workspace}}/build/final-artifact
export QT_QPA_PLATFORM=offscreen
export GTEST_OUTPUT=json:${{github.workspace}}/build/final-artifact/unit_tests.json
./Gpg_Frontend-*-x86_64.AppImage -t || true
- name: Upload Artifact
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE_LOWER}}-${{env.SHORT_SHA}}
path: ${{github.workspace}}/build/final-artifact/Gpg_Frontend*.AppImage*
name: gpgfrontend-${{env.BUILD_TYPE_LOWER}}-${{env.SHORT_SHA}}
path: |
${{github.workspace}}/build/final-artifact/Gpg_Frontend*.AppImage*
${{github.workspace}}/build/final-artifact/unit_tests.json
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
url = https://github.com/qt/qttranslations.git
[submodule "modules"]
path = modules
url = https://github.com/saturneric/GpgFrontend-Modules.git
url = https://git.bktus.com/GpgFrontend/GpgFrontend-Modules.git
2 changes: 1 addition & 1 deletion modules
Submodule modules updated from 8d7546 to e694c0
6 changes: 6 additions & 0 deletions src/core/function/gpg/GpgKeyOpera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,15 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key,
<< "text:" << revocation_reason_text;

// dealing with reason text
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 4)
auto reason_text_lines =
GpgFrontend::SecureCreateSharedObject<QList<QString>>(
revocation_reason_text.split('\n', Qt::SkipEmptyParts).toVector());
#else
auto reason_text_lines =
GpgFrontend::SecureCreateSharedObject<QVector<QString>>(
revocation_reason_text.split('\n', Qt::SkipEmptyParts).toVector());
#endif

const auto app_path = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.ctx.app_path", QString{});
Expand Down
12 changes: 12 additions & 0 deletions src/core/struct/cache_object/AllFavoriteKeyPairsCO.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct AllFavoriteKeyPairsCO {
[[nodiscard]] auto ToJson() const -> QJsonObject {
QJsonObject j;
auto j_key_dbs = QJsonArray();
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
for (const auto& k : key_dbs.asKeyValueRange()) {
QJsonObject o;
o["key_db_name"] = k.first;
Expand All @@ -69,6 +70,17 @@ struct AllFavoriteKeyPairsCO {
j["key_dbs"] = j_key_dbs;
return j;
}
#else
for (auto it = key_dbs.keyValueBegin(); it != key_dbs.keyValueEnd(); ++it) {
QJsonObject o;
o["key_db_name"] = it->first;
o["key_db"] = it->second.ToJson();
j_key_dbs.append(o);
}
j["key_dbs"] = j_key_dbs;
return j;
}
#endif
};

} // namespace GpgFrontend

0 comments on commit a4e6258

Please sign in to comment.