Skip to content

fix: robustness for media and contacts cache #2067

fix: robustness for media and contacts cache

fix: robustness for media and contacts cache #2067

Workflow file for this run

name: GOnnect Build
on:
workflow_dispatch: # can be manually dispatched under GitHub's "Actions" tab
inputs:
run_build:
description: Run build job
type: boolean
run_build_windows:
description: Run build-windows job
type: boolean
run_build_macos:
description: Run build-macos job
type: boolean
run_format:
description: Run format job
type: boolean
run_clang:
description: Run clang job
type: boolean
run_clazy:
description: Run clazy job
type: boolean
run_flatpak:
description: Run flatpak job
type: boolean
run_tests:
description: Run tests job
type: boolean
# Run the build only, if the branch is release or main or a PR with release or main as target is used
push:
branches:
- release
- main
tags:
- 'v*'
# Use the release/main branch workflow/actions definitions rather the definitions in the pull_request
pull_request:
branches:
- release
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
EXT_BASE: ${{github.workspace}}
permissions:
contents: read
pull-requests: read
id-token: write
jobs:
# Detect changes to allow selecting the jobs to run.
# If the workflow is triggered manually, the selection comes from the inputs there.
changes:
runs-on: ubuntu-24.04
outputs:
# Job selection comes from inputs, if started manually. No need to use detected changes.
src: ${{ github.event_name != 'workflow_dispatch' && steps.filter.outputs.src }}
build: ${{ github.event_name != 'workflow_dispatch' && steps.filter.outputs.build }}
flatpak: ${{ github.event_name != 'workflow_dispatch' && steps.filter.outputs.flatpak }}
tests: ${{ github.event_name != 'workflow_dispatch' && steps.filter.outputs.tests }}
resources: ${{ github.event_name != 'workflow_dispatch' && steps.filter.outputs.resources }}
resources-windows: ${{ github.event_name != 'workflow_dispatch' && steps.filter.outputs.resources-windows }}
resources-macos: ${{ github.event_name != 'workflow_dispatch' && steps.filter.outputs.resources-macos }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Get changes
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d
id: filter
with:
filters: |
src:
- 'src/**'
- 'external/**'
build:
- '**/CMakeLists.txt'
- '**/conanfile.py'
- '**/conanfile.txt'
- '**/CMakePresets.json'
flatpak:
- 'resources/flatpak/**'
- 'CMakeLists.txt'
tests:
- 'tests/**'
resources:
- 'resources/artwork/**'
- 'resources/emojis/**'
- 'resources/font/**'
- 'resources/sounds/**'
- 'resources/templates/**'
- 'migrate/**'
- 'i18n/**/*.ts'
resources-windows:
- 'resources/windows/**'
resources-macos:
- 'resources/macos/**'
build:
runs-on: ubuntu-24.04
name: "Build GOnnect (Linux)"
needs: changes
if: ${{ inputs.run_build || needs.changes.outputs.src == 'true' || needs.changes.outputs.tests == 'true' || needs.changes.outputs.build == 'true' }}
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
lfs: 'true'
submodules: 'recursive'
- name: Prepare
uses: ./.github/actions/prepare-linux
- name: Configure CMake
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
run: cmake --preset conan-release . -DBUILD_TESTING=ON
- name: Build
run: cmake --build --preset conan-release --parallel $(nproc --all)
- name: Upload Test artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: gonnect-tests
path: build/Release/tests/contactsTest
retention-days: 1
build-windows:
runs-on: windows-2025
name: "Build GOnnect (Windows)"
needs: changes
if: ${{ inputs.run_build_windows || needs.changes.outputs.src == 'true' || needs.changes.outputs.build == 'true' || needs.changes.outputs.resources == 'true' || needs.changes.outputs.resources-windows == 'true' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
lfs: 'true'
submodules: 'recursive'
- name: Prepare
uses: ./.github/actions/prepare-windows
- name: Configure CMake
shell: cmd
run: cmake --preset conan-default -DENABLE_MSGRAPH=ON -DMS_APPLICATION_IDENTIFIER=${{ secrets.AZURE_CLIENT_ID }}
env:
NSIS_USE_FAST_COMPRESSION: "1"
- name: Build application
run: cmake --build --preset conan-release
- name: Azure Login via OIDC
if: |
startsWith(github.ref, 'refs/tags/v') ||
github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/release'
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Sign application
if: |
startsWith(github.ref, 'refs/tags/v') ||
github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/release'
uses: azure/artifact-signing-action@c7ab2a863ab5f9a846ddb8265964877ef296ee82 # v2
with:
endpoint: https://weu.codesigning.azure.net/
signing-account-name: GONICUS-signing
certificate-profile-name: gonicus-profile
files-folder: build/Release
files-folder-filter: exe
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
- name: Build installer
run: cd build && cpack ${{github.workspace}}
- name: Sign installer
if: |
startsWith(github.ref, 'refs/tags/v') ||
github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/release'
uses: azure/artifact-signing-action@c7ab2a863ab5f9a846ddb8265964877ef296ee82 # v2
with:
endpoint: https://weu.codesigning.azure.net/
signing-account-name: GONICUS-signing
certificate-profile-name: gonicus-profile
files-folder: build
files-folder-filter: exe
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
- name: Save installer
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: windows-installer.zip
compression-level: 0
path: build/GOnnect*.exe
build-macos:
runs-on: macos-26
name: "Build GOnnect (MacOS)"
needs: changes
if: ${{ inputs.run_build_macos || needs.changes.outputs.src == 'true' || needs.changes.outputs.build == 'true' || needs.changes.outputs.resources == 'true' || needs.changes.outputs.resources-macos == 'true' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
lfs: 'true'
submodules: 'recursive'
- name: Prepare
uses: ./.github/actions/prepare-macos
- name: Configure CMake
run: cmake --preset conan-release
- name: Build
run: cmake --build --preset conan-release
- name: Package
run: cd build/Release && cpack ${{github.workspace}}
- name: Save installer
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: mac-installer.dmg
compression-level: 0
path: build/Release/GOnnect*.dmg
format:
runs-on: ubuntu-24.04
name: "Code Formatting"
needs: changes
if: ${{ inputs.run_format || needs.changes.outputs.src == 'true' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@654a770daa28443dd111d133e4083e21c1075674 # v4.18.0
with:
clang-format-version: '21'
check-path: 'src'
exclude-regex: '^src/platform/windows/EventLog.h$' # generated file
clang:
runs-on: ubuntu-24.04
name: "Static Code Analyzer"
needs: changes
if: ${{ inputs.run_clang || needs.changes.outputs.src == 'true' }}
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
lfs: 'true'
submodules: 'recursive'
- name: Prepare
uses: ./.github/actions/prepare-linux
- name: Run static analyzer
shell: bash
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
run: |
pip install scan-build
export ANALYZE_ARGS="--exclude ${QT_ROOT_DIR} --exclude ${{github.workspace}}/external"
scripts/static-clang-analyzer.sh
- name: Save Report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: clang-report
path: /tmp/build.log
clazy:
runs-on: ubuntu-24.04
container: fedora:43
name: "Qt Semantics"
needs: changes
if: ${{ inputs.run_clazy || needs.changes.outputs.src == 'true' || needs.changes.outputs.build == 'true' }}
steps:
- name: Install dependencies
run: |
dnf -y install git git-lfs clang clazy conan libnotify-devel libxkbfile libxcb-devel libXv-devel ninja-build alsa-lib-devel glew-devel \
libxcb-devel xcb-util-xrm-devel xcb-util-devel xcb-util-wm-devel xcb-util-image-devel xcb-util-cursor \
xcb-util-cursor-devel xcb-util-keysyms-devel xcb-util-renderutil-devel libusb1-devel hidapi-devel \
xorg-x11-drv-libinput xorg-x11-server-Xorg libxkbcommon-x11 libX11-devel mesa-libGL-devel libXinerama-devel \
libxslt-devel libxslt pulseaudio-libs-devel libuuid-devel openldap-devel libolm-devel libsecret-devel evolution-data-server-devel folks-devel glib2-devel \
libical-devel perl-lib perl-FindBin perl-Time-Piece perl-IPC-Cmd perl-Digest-SHA \
pip python3-devel nodejs
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
lfs: 'true'
submodules: 'recursive'
- name: Install action dependencies
shell: bash
run: npm install
working-directory: ./.github/actions/get-qt-version
- name: Get QT-Version
id: get-qt
uses: ./.github/actions/get-qt-version
- name: Install qt
run: |
pip install aqtinstall
aqt install-qt --outputdir ${{ github.workspace }}/Qt linux desktop ${{ steps.get-qt.outputs.qt-version }} linux_gcc_64 -m qt5compat qtgrpc qtimageformats qtmultimedia qtnetworkauth qtwebchannel qtwebengine qtpositioning
echo "PATH=$PATH:${{ github.workspace }}/Qt/${{ steps.get-qt.outputs.qt-version }}/gcc_64/bin" >> $GITHUB_ENV
- name: Prepare conan
shell: bash
id: conan-info
run: |
echo "conan-version=$(conan --version | cut -d' ' -f3)" >> $GITHUB_OUTPUT
echo "conan-home=$(conan config home)" >> $GITHUB_OUTPUT
conan profile detect || true
- name: Restore cached Conan packages
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
id: cache-conan-packages
with:
path: ${{ steps.conan-info.outputs.conan-home }}/p
key: conan-${{ steps.conan-info.outputs.conan-version }}-${{ runner.os }}-${{ hashFiles('./conanfile.py') }}
restore-keys: |
conan-${{ steps.conan-info.outputs.conan-version }}-${{ runner.os }}-
- name: Install Conan dependencies
run: |
conan config install resources/conan
conan export-dependencies .
conan install . --build=missing -ctools.cmake.cmaketoolchain:generator=Ninja
- name: Cached Conan packages
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
if: always() && steps.cache-conan-packages.outputs.cache-hit != 'true'
with:
path: ${{ steps.conan-info.outputs.conan-home }}/p
key: conan-${{ steps.conan-info.outputs.conan-version }}-${{ runner.os }}-clazy
- name: Run clazy
shell: bash
env:
PKG_CONFIG_PATH: /usr/lib64/pkgconfig
CC: clang
CXX: clang++
run: |
scripts/static-clazy-analyzer.sh
flatpak:
name: "Flatpak"
runs-on: ubuntu-24.04
needs: changes
if: ${{ inputs.run_flatpak || needs.changes.outputs.flatpak == 'true' || needs.changes.outputs.src == 'true' || needs.changes.outputs.build == 'true' || needs.changes.outputs.resources == 'true' }}
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.10
options: --privileged
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
lfs: 'true'
submodules: 'recursive'
- name: Reading GOnnect version
shell: bash
id: var
run: |
echo "gonnect_version=$(grep -oP 'GOnnect VERSION ([0-9.]+)' CMakeLists.txt | awk '{ print $3 }')" >> $GITHUB_OUTPUT
- uses: flatpak/flatpak-github-actions/flatpak-builder@401fe28a8384095fc1531b9d320b292f0ee45adb # v6.7
with:
bundle: gonnect
build-bundle: 'true'
upload-artifact: 'true'
manifest-path: resources/flatpak/de.gonicus.gonnect.yml
cache-key: flatpak-builder-${{ steps.var.outputs.gonnect_version }}
tests:
runs-on: ubuntu-24.04
name: "Unit Tests"
needs: [changes, build]
if: ${{ (inputs.run_tests || needs.changes.outputs.src == 'true' || needs.changes.outputs.build == 'true' || needs.changes.outputs.tests == 'true') && needs.build.result == 'success' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Prepare
uses: ./.github/actions/prepare-linux
with:
deps: false
conan: false
- name: Download Test artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: gonnect-tests
- name: Run Unit Tests
shell: bash
run: |
chmod +x contactsTest
LD_LIBRARY_PATH=${QT_ROOT_DIR}/lib ./contactsTest
- name: Cleanup
uses: geekyeggo/delete-artifact@176a747ab7e287e3ff4787bf8a148716375ca118 # v6
with:
name: gonnect-tests
ci-status:
needs: [changes, build, build-windows, build-macos, format, clang, clazy, flatpak, tests]
if: always() # Ensure this runs even if upstream jobs were skipped
runs-on: ubuntu-24.04
steps:
- name: Verify pipeline status
run: |
# Contains evaluates to true if any job failed or was cancelled
if ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}; then
echo "Pipeline failed."
exit 1
fi
echo "Pipeline passed!"