Skip to content

Commit 4fc875e

Browse files
committed
Added windows build pipeline
1 parent cd0d8ce commit 4fc875e

File tree

5 files changed

+230
-10
lines changed

5 files changed

+230
-10
lines changed

.github/workflows/build_and_release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ jobs:
110110
# - create_release
111111

112112
# Pull in the Windows build workflow
113-
#Windows_Packages:
114-
# name: Build the Windows packages
115-
# uses: ./.github/workflows/windows.yml
116-
# with:
117-
# package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
118-
# release_upload_url: ${{ needs.create_release.outputs.upload_url }}
119-
# needs:
120-
# - determine_version
121-
# - create_release
113+
Windows_Packages:
114+
name: Build the Windows packages
115+
uses: ./.github/workflows/windows.yml
116+
with:
117+
package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
118+
release_upload_url: ${{ needs.create_release.outputs.upload_url }}
119+
needs:
120+
- determine_version
121+
- create_release

.github/workflows/windows.yml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
name: Build Windows Packages
2+
3+
on:
4+
# Run when called from other workflows
5+
workflow_call:
6+
inputs:
7+
package_complete_version:
8+
description: 'The output of the complete_version of the "determine_version" job from the build_and_release.yml workflow'
9+
required: true
10+
type: string
11+
release_upload_url:
12+
description: 'The output of the "create_release" job from the build_and_release.yml workflow'
13+
required: true
14+
type: string
15+
16+
jobs:
17+
# Create the Windows installer
18+
Windows_MSVC_Packages:
19+
name: Create Windows installer with MSVC
20+
runs-on: windows-latest
21+
defaults:
22+
run:
23+
shell: powershell
24+
steps:
25+
- name: Checkout Git
26+
id: checkout_git
27+
uses: actions/checkout@v4
28+
with:
29+
path: composer
30+
31+
32+
- name: Setup our dev environment
33+
uses: ilammy/msvc-dev-cmd@v1
34+
35+
- name: Setup ninja cmake generator
36+
uses: abdes/gha-setup-ninja@master
37+
38+
- name: Download and build our dependencies using vcpkg
39+
uses: Lord-Kamina/vcpkg-action@update_cache
40+
with:
41+
pkgs: "\"qt5-base\" \"qt5-multimedia\" \"ffmpeg[avcodec,avformat,core,swresample,swscale]\" \"gettext[core]\" \"gperf[core]\" \"gtest[core]\""
42+
triplet: x64-windows-release
43+
extra-args: '--clean-after-build --overlay-triplets="${{ github.workspace }}\composer\cmake\triplets"'
44+
cache-key: win64-vcpkg
45+
revision: ea2a964f9303270322cf3f2d51c265ba146c422d
46+
api-token: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Run cmake to configure the project and build it
49+
env:
50+
COMPOSER_VERSION: ${{ inputs.package_complete_version }}
51+
run: |
52+
set VCPKG_BINARY_SOURCES="files,${{ github.workspace }}\vcpkg_cache,read"
53+
cd ${{ github.workspace }}/composer
54+
echo $COMPOSER_VERSION
55+
cmake --preset "x64-debinfo" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-release -DVCPKG_OVERLAY_TRIPLETS="${{ github.workspace }}\composer\cmake\triplets"
56+
cmake --build --preset "x64-debinfo"
57+
#- name: Run unittests directly called.
58+
# run: |
59+
# cd "composer/build/x64-debinfo/testing"
60+
# ./composer_test.exe --gtest_filter=UnitTest*
61+
#- name: Run unittests by ctest.
62+
# run: |
63+
# cd "composer/build/x64-debinfo"
64+
# ninja testing/test
65+
- name: Create Installer
66+
id: package_composer_x64
67+
run: |
68+
cd composer/build/x64-debinfo
69+
cpack -G NSIS64 x64-debinfo
70+
$MASTER_ARTIFACT_FILENAME = "Composer-master[${{ inputs.package_complete_version }}]-msvc.exe"
71+
$ARTIFACT_FILENAME = "Composer-${{ inputs.package_complete_version }}-msvc.exe"
72+
Copy-Item $(Get-ChildItem -Filter '*win64.exe').Name $MASTER_ARTIFACT_FILENAME
73+
Rename-Item $(Get-ChildItem -Filter '*win64.exe').Name -NewName $ARTIFACT_FILENAME
74+
chcp 65001 #set code page to utf-8
75+
echo ("ARTIFACT_PATH=${{ github.workspace }}/composer/build/x64-debinfo/$ARTIFACT_FILENAME") >> $env:GITHUB_ENV
76+
echo ("ARTIFACT_FILENAME=$ARTIFACT_FILENAME") >> $env:GITHUB_ENV
77+
echo ("MASTER_ARTIFACT_PATH=${{ github.workspace }}/composer/build/x64-debinfo/$MASTER_ARTIFACT_FILENAME") >> $env:GITHUB_ENV
78+
echo ("MASTER_ARTIFACT_FILENAME=$MASTER_ARTIFACT_FILENAME") >> $env:GITHUB_ENV
79+
# Upload artifacts during pull-requests
80+
- name: Upload artifact
81+
uses: actions/upload-artifact@v4
82+
if: ${{ github.event_name == 'pull_request' }}
83+
with:
84+
name: ${{ env.ARTIFACT_FILENAME }}
85+
path: ${{ env.ARTIFACT_PATH }}
86+
87+
# Upload artifacts on master
88+
- name: Upload artifact with unified name
89+
if: ${{ github.ref == 'refs/heads/master' }}
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: ${{ env.MASTER_ARTIFACT_FILENAME }}
93+
path: ${{ env.MASTER_ARTIFACT_PATH }}
94+
95+
# Upload artifacts to releases only during Release events
96+
- name: Upload artifacts to tagged release
97+
id: upload_assets
98+
if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
99+
uses: actions/upload-release-asset@v1
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
with:
103+
upload_url: ${{ inputs.release_upload_url }}
104+
asset_path: ${{ env.ARTIFACT_PATH }}
105+
asset_name: ${{ env.ARTIFACT_FILENAME }}
106+
asset_content_type: application/octet-stream
107+
108+
Windows_MinGW-w64_Packages:
109+
name: Create Windows installer with MinGW-w64
110+
runs-on: windows-latest
111+
defaults:
112+
run:
113+
shell: msys2 {0}
114+
steps:
115+
- name: Checkout Git
116+
id: checkout_git
117+
uses: actions/checkout@v4
118+
with:
119+
path: composer
120+
- name: Setup action env and echoing
121+
shell: bash
122+
run: |
123+
echo '::echo::on'
124+
echo 'action_echo=enabled' >> $GITHUB_OUTPUT
125+
echo workpath=$(echo '${{ github.workspace }}' | sed 's|\\|/|g') >> $GITHUB_ENV
126+
- name: Install MSYS2.
127+
uses: msys2/setup-msys2@v2
128+
with:
129+
msystem: MINGW64
130+
update: false
131+
location: "${{ env.workpath }}"
132+
install: >-
133+
git
134+
mingw-w64-x86_64-cc
135+
mingw-w64-x86_64-cmake
136+
mingw-w64-x86_64-ffmpeg
137+
mingw-w64-x86_64-gettext
138+
mingw-w64-x86_64-make
139+
mingw-w64-x86_64-nsis
140+
mingw-w64-x86_64-qt5-base
141+
mingw-w64-x86_64-qt5-multimedia
142+
mingw-w64-x86_64-winpthreads-git
143+
- name: Run cmake to configure the project and build it
144+
env:
145+
COMPOSER_VERSION: ${{ inputs.package_complete_version }}
146+
shell: msys2 {0}
147+
run: |
148+
cd "${{ env.workpath }}/composer"
149+
mkdir build
150+
#for f in $(ls -Q ./lang/*.po); do mkdir -pv "./build/lang/$(basename $f | cut -d. -f1)/LC_MESSAGES";done
151+
cd build
152+
"${{ env.workpath }}/msys64/mingw64/bin/cmake.exe" -G "MinGW Makefiles" .. -DCMAKE_BUILD_TYPE="RelWithDebInfo" \
153+
-DCOMPOSER_VERSION=${{ env.COMPOSER_VERSION }} -DBUILD_TESTS=ON \
154+
-DCMAKE_VERBOSE_MAKEFILE=ON -DCPACK_MINGW_SYSTEM_PREFIX="${{ env.workpath }}/msys64/mingw64"
155+
"${{ env.workpath }}/msys64/mingw64/bin/cmake.exe" --build ./ --verbose --parallel 3
156+
#- name: Run unittests directly called.
157+
# shell: msys2 {0}
158+
# run: |
159+
# cd "${{ env.workpath }}/composer/build/testing"
160+
# ./composer_test.exe --gtest_filter=UnitTest*
161+
#- name: Run unittests by ctest.
162+
# shell: msys2 {0}
163+
# run: |
164+
# cd "${{ env.workpath }}/composer/build"
165+
# "${{ env.workpath }}/msys64/mingw64/bin/mingw32-make.exe" test
166+
- name: Create Installer
167+
id: package_composer_x64
168+
shell: msys2 {0}
169+
run: |
170+
cd "${{ env.workpath }}/composer/build"
171+
"${{ env.workpath }}/msys64/mingw64/bin/cpack.exe" -G NSIS64 -DCPACK_MINGW_SYSTEM_PREFIX="${{ env.workpath }}/msys64/mingw64" -DCPACK_NSIS_EXECUTABLE="${{ env.workpath }}/msys64/mingw64/bin/makensis.exe" -DCMAKE_BUILD_TYPE="RelWithDebInfo" --verbose
172+
MASTER_ARTIFACT_FILENAME="Composer-master[${{ inputs.package_complete_version }}]-mingw-w64.exe"
173+
ARTIFACT_FILENAME="Composer-${{ inputs.package_complete_version }}-mingw-w64.exe"
174+
powershell -command "Copy-Item \$(Get-ChildItem -Filter '*win64.exe').Name '${MASTER_ARTIFACT_FILENAME}'"
175+
powershell -command "Rename-Item \$(Get-ChildItem -Filter '*win64.exe').Name -NewName '${ARTIFACT_FILENAME}'"
176+
powershell -command "echo ('ARTIFACT_PATH=${{ env.workpath }}/composer/build/${ARTIFACT_FILENAME}') >> \$env:GITHUB_ENV"
177+
powershell -command "echo ('ARTIFACT_FILENAME=${ARTIFACT_FILENAME}') >> \$env:GITHUB_ENV"
178+
powershell -command "echo ('MASTER_ARTIFACT_PATH=${{ env.workpath }}/composer/build/${MASTER_ARTIFACT_FILENAME}') >> \$env:GITHUB_ENV"
179+
powershell -command "echo ('MASTER_ARTIFACT_FILENAME=${MASTER_ARTIFACT_FILENAME}') >> \$env:GITHUB_ENV"
180+
181+
# Upload artifacts during pull-requests
182+
- name: Upload artifact
183+
uses: actions/upload-artifact@v4
184+
if: ${{ github.event_name == 'pull_request' }}
185+
with:
186+
name: ${{ env.ARTIFACT_FILENAME }}
187+
path: ${{ env.ARTIFACT_PATH }}
188+
189+
# Upload artifacts on master
190+
- name: Upload artifact with unified name
191+
if: ${{ github.ref == 'refs/heads/master' }}
192+
uses: actions/upload-artifact@v4
193+
with:
194+
name: ${{ env.MASTER_ARTIFACT_FILENAME }}
195+
path: ${{ env.MASTER_ARTIFACT_PATH }}
196+
197+
# Upload artifacts to releases only during Release events
198+
- name: Upload artifacts to tagged release
199+
id: upload_assets
200+
if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
201+
uses: actions/upload-release-asset@v1
202+
env:
203+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
204+
with:
205+
upload_url: ${{ inputs.release_upload_url }}
206+
asset_path: ${{ env.ARTIFACT_PATH }}
207+
asset_name: ${{ env.ARTIFACT_FILENAME }}
208+
asset_content_type: application/octet-stream

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Features
1919

2020
Latest builds
2121
==========
22+
- [Windows (MSVC)](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-msvc.exe.zip)
23+
- [Windows (MinGW-w64)](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-mingw-w64.exe.zip)
2224
- [Linux - Ubuntu 20.04](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-ubuntu_20.04.deb.zip)
2325
- [Linux - Ubuntu 22.04](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-ubuntu_22.04.deb.zip)
2426
- [Linux - Ubuntu 24.04](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-ubuntu_24.04.deb.zip)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set(VCPKG_TARGET_ARCHITECTURE x64)
2+
set(VCPKG_CRT_LINKAGE dynamic)
3+
set(VCPKG_LIBRARY_LINKAGE dynamic)
4+
set(VCPKG_DISABLE_COMPILER_TRACKING on)
5+
set(VCPKG_BUILD_TYPE release)

platform/packaging.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ set(CPACK_SOURCE_IGNORE_FILES
1010
"/.svn/"
1111
"/.git/"
1212
)
13-
set(CPACK_PACKAGE_EXECUTABLES composer)
13+
if(WIN32)
14+
set(CPACK_PACKAGE_EXECUTABLES "Composer" "${CMAKE_CURRENT_SOURCE_DIR}/icons\\\\composer.png")
15+
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Performous\\\\Composer")
16+
else()
17+
set(CPACK_PACKAGE_EXECUTABLES "composer")
18+
endif()
1419
set(CPACK_SOURCE_GENERATOR "TBZ2")
1520
set(CPACK_GENERATOR "TBZ2")
1621

0 commit comments

Comments
 (0)