forked from gyunaev/birdtray
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (138 loc) · 5.41 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Build
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
qt_version: [6.0.4, 6.8.0]
include:
- os: windows-latest
qt_compile_suite: msvc2022
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 qt6-qtsvg 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