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+ Copy-Item $(Get-ChildItem -Filter '*win64.exe').Name "Composer-latest-msvc.exe"
71+ Rename-Item $(Get-ChildItem -Filter '*win64.exe').Name -NewName "Composer-${{ inputs.package_complete_version }}-msvc.exe"
72+ chcp 65001 #set code page to utf-8
73+ echo ("ARTIFACT_PATH=${{ github.workspace }}/composer/build/x64-debinfo/Composer-${{ inputs.package_complete_version }}-msvc.exe") >> $env:GITHUB_ENV
74+ echo ("ARTIFACT_FILENAME=Composer-${{ inputs.package_complete_version }}-msvc.exe") >> $env:GITHUB_ENV
75+ echo ("MASTER_ARTIFACT_PATH=${{ github.workspace }}/composer/build/x64-debinfo/Composer-latest-msvc.exe") >> $env:GITHUB_ENV
76+ echo ("MASTER_ARTIFACT_FILENAME=Composer-latest-msvc.exe") >> $env:GITHUB_ENV
77+ # Upload artifacts during pull-requests
78+ - name : Upload artifact
79+ uses : actions/upload-artifact@v4
80+ if : ${{ github.event_name == 'pull_request' }}
81+ with :
82+ name : ${{ env.ARTIFACT_FILENAME }}
83+ path : ${{ env.ARTIFACT_PATH }}
84+
85+ # Upload artifacts on master
86+ - name : Upload artifact with unified name
87+ if : ${{ github.ref == 'refs/heads/master' }}
88+ uses : actions/upload-artifact@v4
89+ with :
90+ name : ${{ env.MASTER_ARTIFACT_FILENAME }}
91+ path : ${{ env.MASTER_ARTIFACT_PATH }}
92+
93+ # Upload artifacts to releases only during Release events
94+ - name : Upload artifacts to tagged release
95+ id : upload_assets
96+ if : ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
97+ uses : actions/upload-release-asset@v1
98+ env :
99+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
100+ with :
101+ upload_url : ${{ inputs.release_upload_url }}
102+ asset_path : ${{ env.ARTIFACT_PATH }}
103+ asset_name : ${{ env.ARTIFACT_FILENAME }}
104+ asset_content_type : application/octet-stream
105+
106+ Windows_MinGW-w64_Packages :
107+ name : Create Windows installer with MinGW-w64
108+ runs-on : windows-latest
109+ defaults :
110+ run :
111+ shell : msys2 {0}
112+ steps :
113+ - name : Checkout Git
114+ id : checkout_git
115+ uses : actions/checkout@v4
116+ with :
117+ path : composer
118+ - name : Setup action env and echoing
119+ shell : bash
120+ run : |
121+ echo '::echo::on'
122+ echo 'action_echo=enabled' >> $GITHUB_OUTPUT
123+ echo workpath=$(echo '${{ github.workspace }}' | sed 's|\\|/|g') >> $GITHUB_ENV
124+ - name : Install MSYS2.
125+ uses : msys2/setup-msys2@v2
126+ with :
127+ msystem : MINGW64
128+ update : false
129+ location : " ${{ env.workpath }}"
130+ install : >-
131+ git
132+ mingw-w64-x86_64-cc
133+ mingw-w64-x86_64-cmake
134+ mingw-w64-x86_64-ffmpeg
135+ mingw-w64-x86_64-gettext
136+ mingw-w64-x86_64-make
137+ mingw-w64-x86_64-nsis
138+ mingw-w64-x86_64-qt5-base
139+ mingw-w64-x86_64-qt5-multimedia
140+ mingw-w64-x86_64-winpthreads-git
141+ - name : Run cmake to configure the project and build it
142+ env :
143+ COMPOSER_VERSION : ${{ inputs.package_complete_version }}
144+ shell : msys2 {0}
145+ run : |
146+ cd "${{ env.workpath }}/composer"
147+ mkdir build
148+ #for f in $(ls -Q ./lang/*.po); do mkdir -pv "./build/lang/$(basename $f | cut -d. -f1)/LC_MESSAGES";done
149+ cd build
150+ "${{ env.workpath }}/msys64/mingw64/bin/cmake.exe" -G "MinGW Makefiles" .. -DCMAKE_BUILD_TYPE="RelWithDebInfo" \
151+ -DCOMPOSER_VERSION=${{ env.COMPOSER_VERSION }} -DBUILD_TESTS=ON \
152+ -DCMAKE_VERBOSE_MAKEFILE=ON -DCPACK_MINGW_SYSTEM_PREFIX="${{ env.workpath }}/msys64/mingw64"
153+ "${{ env.workpath }}/msys64/mingw64/bin/cmake.exe" --build ./ --verbose --parallel 3
154+ # - name: Run unittests directly called.
155+ # shell: msys2 {0}
156+ # run: |
157+ # cd "${{ env.workpath }}/composer/build/testing"
158+ # ./composer_test.exe --gtest_filter=UnitTest*
159+ # - name: Run unittests by ctest.
160+ # shell: msys2 {0}
161+ # run: |
162+ # cd "${{ env.workpath }}/composer/build"
163+ # "${{ env.workpath }}/msys64/mingw64/bin/mingw32-make.exe" test
164+ - name : Create Installer
165+ id : package_composer_x64
166+ shell : msys2 {0}
167+ run : |
168+ cd "${{ env.workpath }}/composer/build"
169+ "${{ 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
170+ powershell -command "Copy-Item \$(Get-ChildItem -Filter '*win64.exe').Name 'Composer-latest-mingw-w64.exe'"
171+ powershell -command "Rename-Item \$(Get-ChildItem -Filter '*win64.exe').Name -NewName 'Composer-${{ inputs.package_complete_version }}-mingw-w64.exe'"
172+ powershell -command "echo ('ARTIFACT_PATH=${{ env.workpath }}/composer/build/Composer-${{ inputs.package_complete_version }}-mingw-w64.exe') >> \$env:GITHUB_ENV"
173+ powershell -command "echo ('ARTIFACT_FILENAME=Composer-${{ inputs.package_complete_version }}-mingw-w64.exe') >> \$env:GITHUB_ENV"
174+ powershell -command "echo ('MASTER_ARTIFACT_PATH=${{ env.workpath }}/composer/build/Composer-latest-mingw-w64.exe') >> \$env:GITHUB_ENV"
175+ powershell -command "echo ('MASTER_ARTIFACT_FILENAME=Composer-latest-mingw-w64.exe') >> \$env:GITHUB_ENV"
176+
177+ # Upload artifacts during pull-requests
178+ - name : Upload artifact
179+ uses : actions/upload-artifact@v4
180+ if : ${{ github.event_name == 'pull_request' }}
181+ with :
182+ name : ${{ env.ARTIFACT_FILENAME }}
183+ path : ${{ env.ARTIFACT_PATH }}
184+
185+ # Upload artifacts on master
186+ - name : Upload artifact with unified name
187+ if : ${{ github.ref == 'refs/heads/master' }}
188+ uses : actions/upload-artifact@v4
189+ with :
190+ name : ${{ env.MASTER_ARTIFACT_FILENAME }}
191+ path : ${{ env.MASTER_ARTIFACT_PATH }}
192+
193+ # Upload artifacts to releases only during Release events
194+ - name : Upload artifacts to tagged release
195+ id : upload_assets
196+ if : ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
197+ uses : actions/upload-release-asset@v1
198+ env :
199+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
200+ with :
201+ upload_url : ${{ inputs.release_upload_url }}
202+ asset_path : ${{ env.ARTIFACT_PATH }}
203+ asset_name : ${{ env.ARTIFACT_FILENAME }}
204+ asset_content_type : application/octet-stream
0 commit comments