diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml index 8c06775..843d5d8 100644 --- a/.github/workflows/build_and_release.yml +++ b/.github/workflows/build_and_release.yml @@ -110,12 +110,12 @@ jobs: # - create_release # Pull in the Windows build workflow - #Windows_Packages: - # name: Build the Windows packages - # uses: ./.github/workflows/windows.yml - # with: - # package_complete_version: ${{ needs.determine_version.outputs.complete_version }} - # release_upload_url: ${{ needs.create_release.outputs.upload_url }} - # needs: - # - determine_version - # - create_release + Windows_Packages: + name: Build the Windows packages + uses: ./.github/workflows/windows.yml + with: + package_complete_version: ${{ needs.determine_version.outputs.complete_version }} + release_upload_url: ${{ needs.create_release.outputs.upload_url }} + needs: + - determine_version + - create_release diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..6620e19 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,204 @@ +name: Build Windows Packages + +on: + # Run when called from other workflows + workflow_call: + inputs: + package_complete_version: + description: 'The output of the complete_version of the "determine_version" job from the build_and_release.yml workflow' + required: true + type: string + release_upload_url: + description: 'The output of the "create_release" job from the build_and_release.yml workflow' + required: true + type: string + +jobs: + # Create the Windows installer + Windows_MSVC_Packages: + name: Create Windows installer with MSVC + runs-on: windows-latest + defaults: + run: + shell: powershell + steps: + - name: Checkout Git + id: checkout_git + uses: actions/checkout@v4 + with: + path: composer + + + - name: Setup our dev environment + uses: ilammy/msvc-dev-cmd@v1 + + - name: Setup ninja cmake generator + uses: abdes/gha-setup-ninja@master + + - name: Download and build our dependencies using vcpkg + uses: Lord-Kamina/vcpkg-action@update_cache + with: + pkgs: "\"qt5-base\" \"qt5-multimedia\" \"ffmpeg[avcodec,avformat,core,swresample,swscale]\" \"gettext[core]\" \"gperf[core]\" \"gtest[core]\"" + triplet: x64-windows-release + extra-args: '--clean-after-build --overlay-triplets="${{ github.workspace }}\composer\cmake\triplets"' + cache-key: win64-vcpkg + revision: ea2a964f9303270322cf3f2d51c265ba146c422d + api-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run cmake to configure the project and build it + env: + COMPOSER_VERSION: ${{ inputs.package_complete_version }} + run: | + set VCPKG_BINARY_SOURCES="files,${{ github.workspace }}\vcpkg_cache,read" + cd ${{ github.workspace }}/composer + echo $COMPOSER_VERSION + 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" + cmake --build --preset "x64-debinfo" + #- name: Run unittests directly called. + # run: | + # cd "composer/build/x64-debinfo/testing" + # ./composer_test.exe --gtest_filter=UnitTest* + #- name: Run unittests by ctest. + # run: | + # cd "composer/build/x64-debinfo" + # ninja testing/test + - name: Create Installer + id: package_composer_x64 + run: | + cd composer/build/x64-debinfo + cpack -G NSIS64 x64-debinfo + Copy-Item $(Get-ChildItem -Filter '*win64.exe').Name "Composer-latest-msvc.exe" + Rename-Item $(Get-ChildItem -Filter '*win64.exe').Name -NewName "Composer-${{ inputs.package_complete_version }}-msvc.exe" + chcp 65001 #set code page to utf-8 + echo ("ARTIFACT_PATH=${{ github.workspace }}/composer/build/x64-debinfo/Composer-${{ inputs.package_complete_version }}-msvc.exe") >> $env:GITHUB_ENV + echo ("ARTIFACT_FILENAME=Composer-${{ inputs.package_complete_version }}-msvc.exe") >> $env:GITHUB_ENV + echo ("MASTER_ARTIFACT_PATH=${{ github.workspace }}/composer/build/x64-debinfo/Composer-latest-msvc.exe") >> $env:GITHUB_ENV + echo ("MASTER_ARTIFACT_FILENAME=Composer-latest-msvc.exe") >> $env:GITHUB_ENV + # Upload artifacts during pull-requests + - name: Upload artifact + uses: actions/upload-artifact@v4 + if: ${{ github.event_name == 'pull_request' }} + with: + name: ${{ env.ARTIFACT_FILENAME }} + path: ${{ env.ARTIFACT_PATH }} + + # Upload artifacts on master + - name: Upload artifact with unified name + if: ${{ github.ref == 'refs/heads/master' }} + uses: actions/upload-artifact@v4 + with: + name: ${{ env.MASTER_ARTIFACT_FILENAME }} + path: ${{ env.MASTER_ARTIFACT_PATH }} + + # Upload artifacts to releases only during Release events + - name: Upload artifacts to tagged release + id: upload_assets + if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }} + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ inputs.release_upload_url }} + asset_path: ${{ env.ARTIFACT_PATH }} + asset_name: ${{ env.ARTIFACT_FILENAME }} + asset_content_type: application/octet-stream + + Windows_MinGW-w64_Packages: + name: Create Windows installer with MinGW-w64 + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - name: Checkout Git + id: checkout_git + uses: actions/checkout@v4 + with: + path: composer + - name: Setup action env and echoing + shell: bash + run: | + echo '::echo::on' + echo 'action_echo=enabled' >> $GITHUB_OUTPUT + echo workpath=$(echo '${{ github.workspace }}' | sed 's|\\|/|g') >> $GITHUB_ENV + - name: Install MSYS2. + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + location: "${{ env.workpath }}" + install: >- + git + mingw-w64-x86_64-cc + mingw-w64-x86_64-cmake + mingw-w64-x86_64-ffmpeg + mingw-w64-x86_64-gettext + mingw-w64-x86_64-make + mingw-w64-x86_64-nsis + mingw-w64-x86_64-qt5-base + mingw-w64-x86_64-qt5-multimedia + mingw-w64-x86_64-winpthreads-git + - name: Run cmake to configure the project and build it + env: + COMPOSER_VERSION: ${{ inputs.package_complete_version }} + shell: msys2 {0} + run: | + cd "${{ env.workpath }}/composer" + mkdir build + #for f in $(ls -Q ./lang/*.po); do mkdir -pv "./build/lang/$(basename $f | cut -d. -f1)/LC_MESSAGES";done + cd build + "${{ env.workpath }}/msys64/mingw64/bin/cmake.exe" -G "MinGW Makefiles" .. -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ + -DCOMPOSER_VERSION=${{ env.COMPOSER_VERSION }} -DBUILD_TESTS=ON \ + -DCMAKE_VERBOSE_MAKEFILE=ON -DCPACK_MINGW_SYSTEM_PREFIX="${{ env.workpath }}/msys64/mingw64" + "${{ env.workpath }}/msys64/mingw64/bin/cmake.exe" --build ./ --verbose --parallel 3 + #- name: Run unittests directly called. + # shell: msys2 {0} + # run: | + # cd "${{ env.workpath }}/composer/build/testing" + # ./composer_test.exe --gtest_filter=UnitTest* + #- name: Run unittests by ctest. + # shell: msys2 {0} + # run: | + # cd "${{ env.workpath }}/composer/build" + # "${{ env.workpath }}/msys64/mingw64/bin/mingw32-make.exe" test + - name: Create Installer + id: package_composer_x64 + shell: msys2 {0} + run: | + cd "${{ env.workpath }}/composer/build" + "${{ 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 + powershell -command "Copy-Item \$(Get-ChildItem -Filter '*win64.exe').Name 'Composer-latest-mingw-w64.exe'" + powershell -command "Rename-Item \$(Get-ChildItem -Filter '*win64.exe').Name -NewName 'Composer-${{ inputs.package_complete_version }}-mingw-w64.exe'" + powershell -command "echo ('ARTIFACT_PATH=${{ env.workpath }}/composer/build/Composer-${{ inputs.package_complete_version }}-mingw-w64.exe') >> \$env:GITHUB_ENV" + powershell -command "echo ('ARTIFACT_FILENAME=Composer-${{ inputs.package_complete_version }}-mingw-w64.exe') >> \$env:GITHUB_ENV" + powershell -command "echo ('MASTER_ARTIFACT_PATH=${{ env.workpath }}/composer/build/Composer-latest-mingw-w64.exe') >> \$env:GITHUB_ENV" + powershell -command "echo ('MASTER_ARTIFACT_FILENAME=Composer-latest-mingw-w64.exe') >> \$env:GITHUB_ENV" + + # Upload artifacts during pull-requests + - name: Upload artifact + uses: actions/upload-artifact@v4 + if: ${{ github.event_name == 'pull_request' }} + with: + name: ${{ env.ARTIFACT_FILENAME }} + path: ${{ env.ARTIFACT_PATH }} + + # Upload artifacts on master + - name: Upload artifact with unified name + if: ${{ github.ref == 'refs/heads/master' }} + uses: actions/upload-artifact@v4 + with: + name: ${{ env.MASTER_ARTIFACT_FILENAME }} + path: ${{ env.MASTER_ARTIFACT_PATH }} + + # Upload artifacts to releases only during Release events + - name: Upload artifacts to tagged release + id: upload_assets + if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }} + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ inputs.release_upload_url }} + asset_path: ${{ env.ARTIFACT_PATH }} + asset_name: ${{ env.ARTIFACT_FILENAME }} + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/README.md b/README.md index d271061..7026a40 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Features Latest builds ========== +- [Windows (MSVC)](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-msvc.exe.zip) +- [Windows (MinGW-w64)](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-mingw-w64.exe.zip) - [Linux - Ubuntu 20.04](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-ubuntu_20.04.deb.zip) - [Linux - Ubuntu 22.04](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-ubuntu_22.04.deb.zip) - [Linux - Ubuntu 24.04](https://nightly.link/performous/composer/workflows/build_and_release/master/Composer-latest-ubuntu_24.04.deb.zip) diff --git a/cmake/triplets/x64-windows-release.cmake b/cmake/triplets/x64-windows-release.cmake new file mode 100644 index 0000000..9dca34c --- /dev/null +++ b/cmake/triplets/x64-windows-release.cmake @@ -0,0 +1,5 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_DISABLE_COMPILER_TRACKING on) +set(VCPKG_BUILD_TYPE release) \ No newline at end of file diff --git a/platform/packaging.cmake b/platform/packaging.cmake index 877f245..1767bd3 100644 --- a/platform/packaging.cmake +++ b/platform/packaging.cmake @@ -10,7 +10,12 @@ set(CPACK_SOURCE_IGNORE_FILES "/.svn/" "/.git/" ) -set(CPACK_PACKAGE_EXECUTABLES composer) +if(WIN32) + set(CPACK_PACKAGE_EXECUTABLES "Composer" "${CMAKE_CURRENT_SOURCE_DIR}/icons\\\\composer.png") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "Performous\\\\Composer") +else() + set(CPACK_PACKAGE_EXECUTABLES "composer") +endif() set(CPACK_SOURCE_GENERATOR "TBZ2") set(CPACK_GENERATOR "TBZ2")