Skip to content

Fix the CI

Fix the CI #751

Workflow file for this run

name: Build
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
qt_version: [6.1.3, 6.8.0]
include:
- os: windows-latest
qt_compile_suite: win64_msvc2022_64
exclude:
# We only want to test for the latest version of Qt on Windows
- os: windows-latest
qt_version: 6.8.0
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Qt ${{ matrix.qt_version }}
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt_version }}
arch: ${{ matrix.qt_compile_suite }}
cache: true
dir: ${{ runner.temp }}/Qt
- name: Install additional dependencies
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update -qq;
sudo apt install -qq libx11-dev libx11-xcb-dev desktop-file-utils
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install -y --force openssl.light --version=1.1.1
echo "C:\\Program Files\\OpenSSL" >> $GITHUB_PATH
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Create build environment
run: cmake -E make_directory ${{ runner.workspace }}/build
- name: Configure CMake
shell: bash
working-directory: ${{ runner.workspace }}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCOMPILER_WARNINGS_AS_ERRORS=ON -DBUILD_WITH_TESTS=ON -DDONT_EXECUTE_INSTALLER=ON
- name: Register build problem matchers
run: |
echo "::add-matcher::.github/problem-matchers/linguist.json"
echo "::add-matcher::.github/problem-matchers/compiler.json"
- name: Build
working-directory: ${{ runner.workspace }}/build
run: cmake --build . --config Release --target birdtray
- name: Remove build problem matchers
run: |
echo "::remove-matcher owner=linguist::"
echo "::remove-matcher owner=linguist-old::"
echo "::remove-matcher owner=compiler-gcc::"
echo "::remove-matcher owner=compiler-msvc::"
- name: Tests
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config Release --target tests && cmake --build . --config Release --target run_tests
- name: Validate desktop file
working-directory: ${{ github.workspace }}
if: runner.os == 'Linux'
shell: bash
run: |
output=$(desktop-file-validate src/res/com.ulduzsoft.Birdtray.desktop)
if [ ! -z "$output" ]; then
echo "$output";
exit 1;
fi
- name: Check if this is a deployment build
id: check-deploy
shell: bash
run: |
if [[ '${{ github.event.ref }}' =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ && "$RUNNER_OS" == "Windows" ]]; then
echo "is_deploy=true" >> $GITHUB_OUTPUT
echo "Deployment build detected"
else
echo "Not a deployment build, skipping deploy steps"
fi
- name: Install installer dependencies
if: steps.check-deploy.outputs.is_deploy == 'true'
run: choco install -y nsis --version=3.6.1;
- name: Create installer
if: steps.check-deploy.outputs.is_deploy == 'true'
working-directory: ${{ runner.workspace }}/build
run: cmake --build . --config Release --target install
- name: Find installer
if: steps.check-deploy.outputs.is_deploy == 'true'
id: find_installer_file
shell: bash
run: |
installerFile=`find . -name "Birdtray-*.exe" -exec basename {} \;`
echo "installer_file=$installerFile" >> $GITHUB_OUTPUT
echo "Found installer: $installerFile"
mkdir installer/cache
mv installer/$installerFile installer/cache
- name: Cache installer
uses: actions/upload-artifact@v4
if: steps.check-deploy.outputs.is_deploy == 'true'
with:
name: installer-${{ runner.os }}-${{ github.sha }}
path: installer/cache/${{ steps.find_installer_file.outputs.installer_file }}
release:
name: Create Release
needs: build
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && contains(github.ref, '.')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if this is a deployment build
id: deploy_check
shell: bash
run: |
if [[ '${{ github.event.ref }}' =~ ^refs/tags/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "Creating release ${BASH_REMATCH[1]}..."
echo "version=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
else
echo "Tag does not match: ${{ github.event.ref }}"
exit 1
fi
- name: Download installer (x64)
uses: actions/download-artifact@v4
with:
name: installer-Windows-x64-${{ github.sha }}
path: installer
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: Release ${{ steps.deploy_check.outputs.version }}
draft: true
artifacts: installer*/Birdtray-*.exe
artifactContentType: application/x-msdownload
artifactErrorsFailBuild: true
generateReleaseNotes: true