Skip to content

Fix building the translations #744

Fix building the translations

Fix building the translations #744

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]
arch: [x86, x64]
qt_version: [5.9.9, 5.15.2]
include:
- os: windows-latest
arch: x86
qt_compile_suite: win32_msvc2019
- os: windows-latest
arch: x64
qt_compile_suite: win64_msvc2019_64
exclude:
# We only want to test for the latest version of Qt on Windows
- os: windows-latest
qt_version: 5.9.9
# We only compile for the current architecture of the runner for Linux
- os: ubuntu-latest
arch: x86
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Qt ${{ matrix.qt_version }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
arch: ${{ matrix.qt_compile_suite }}
cache: true
dir: ${{ runner.temp }}/Qt
- name: Install additional dependencies
shell: bash
env:
ARCH: ${{ matrix.arch }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update -qq;
sudo apt install -qq libx11-dev libqt5svg5-dev libx11-xcb-dev desktop-file-utils
elif [ "$RUNNER_OS" == "Windows" ]; then
if [ "$ARCH" == "x86" ]; then
echo "CMAKE_PLATFORM_ARG=-A Win32" >> $GITHUB_ENV
export archParam="--forcex86"
else
echo "CMAKE_PLATFORM_ARG=-A x64" >> $GITHUB_ENV
fi
choco install -y --force $archParam 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 $CMAKE_PLATFORM_ARG -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@v3
if: steps.check-deploy.outputs.is_deploy == 'true'
with:
name: installer-${{ runner.os }}-${{ matrix.arch }}-${{ 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@v3
- 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 (x86)
uses: actions/[email protected]
with:
name: installer-Windows-x86-${{ github.sha }}
path: installer-x86
- name: Download installer (x64)
uses: actions/[email protected]
with:
name: installer-Windows-x64-${{ github.sha }}
path: installer-x64
- 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