From ddf4308144d0e03cd7252cd28dffdf416878e959 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Fri, 20 Oct 2023 13:05:52 +0200 Subject: [PATCH] Split and update Pr check and release jobs --- .github/workflows/ccpp.yml | 492 +++++++++--------- .github/workflows/pr-check.yml | 177 +++++++ .../org.fedoraproject.MediaWriter.json | 10 +- dist/win/make-vs2019-env-attribution | 2 + dist/win/make-vs2019-env.bat | 15 + src/app/CMakeLists.txt | 25 +- 6 files changed, 450 insertions(+), 271 deletions(-) create mode 100644 .github/workflows/pr-check.yml create mode 100644 dist/win/make-vs2019-env-attribution create mode 100644 dist/win/make-vs2019-env.bat diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 94cfcc89..72e0fcc4 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -1,246 +1,246 @@ -name: Automatic build - -on: - push: - branches: - - 'main' - pull_request: - branches: - - '**' - release: - types: [ created ] - -env: - QT_VERSION: '6.5.2' - -jobs: - Linux: - if: github.event_name == 'push' || github.event_name == 'pull_request' - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - name: Install dependencies - run: | - sudo apt update - sudo apt install libxss1 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 binutils cmake pkg-config libx11-dev xcb libx11-xcb-dev libxkbcommon-x11-dev libssl-dev libxss-dev libxmu-dev - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - version: ${{env.QT_VERSION}} - - - name: Build - run: | - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=/usr - make -j2 - - - Flatpak-test-build: - if: github.event_name == 'push' || github.event_name == 'pull_request' - runs-on: ubuntu-latest - container: - image: docker.io/bilelmoussaoui/flatpak-github-actions:kde-6.5 - options: --privileged - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 - with: - bundle: "org.fedoraproject.MediaWriter.flatpak" - manifest-path: "dist/flatpak/org.fedoraproject.MediaWriter.json" - cache-key: flatpak-builder-${{ github.sha }} - - uses: marvinpinto/action-automatic-releases@latest - if: github.event_name == 'push' - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest-flatpak" - prerelease: true - title: "Development Build (Flatpak)" - files: org.fedoraproject.MediaWriter.flatpak - - macOS: - runs-on: macos-latest - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - version: ${{env.QT_VERSION}} - modules: qtimageformats - - name: Set env (push) - if: github.event_name == 'push' || github.event_name == 'pull_request' - run: echo "TAG_NAME=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV - - name: Set env (release) - if: github.event_name == 'release' - run: echo "TAG_NAME=$(bash ./dist/get-tag-name.sh)" >> $GITHUB_ENV - - name: Build - env: - TAG_NAME: ${{ env.TAG_NAME }} - run: | - bash dist/mac/build.sh build - - name: Insert dependencies - run: | - bash dist/mac/build.sh deps - - name: Sign (TBD) - if: github.event_name == 'release' - run: | - true # bash dist/mac/build.sh sign - - name: Package - env: - TAG_NAME: ${{ env.TAG_NAME }} - run: | - bash dist/mac/build.sh dmg - - name: Notarize (TBD) - if: github.event_name == 'release' - run: | - true # bash dist/mac/build.sh notarize - - name: Upload to GitHub (release) - if: github.event_name == 'release' - env: - TAG_NAME: ${{ env.TAG_NAME }} - run: | - bash dist/upload-to-github.sh github_api_token=${{ secrets.GITHUB_TOKEN }} tag="$TAG_NAME" filename="FedoraMediaWriter-osx-$TAG_NAME.unnotarized.dmg" - - name: Upload to GitHub (Development build) - if: github.event_name == 'push' - uses: marvinpinto/action-automatic-releases@latest - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest-macos" - prerelease: true - title: "Development Build (MacOS)" - files: FedoraMediaWriter-osx-${{ env.TAG_NAME }}.unnotarized.dmg - - Windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - name: Set env (push) - if: github.event_name == 'push' || github.event_name == 'release' - run: echo "TAG_NAME=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV - - name: Install dependencies - shell: bash - run: | - choco install nsis - choco install dos2unix - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - cached: ${{ steps.cache-qt.outputs.cache-hit }} - arch: win64_mingw - version: ${{env.QT_VERSION}} - - name: Build xz-utils - shell: bash - if: ${{ !steps.cache-qt.outputs.cache-hit }} - run: | - git clone https://git.tukaani.org/xz.git - cd xz - git checkout v5.2 - cd .. - sed -i 's/#include "config.h"//' xz/src/common/common_w32res.rc - sed -i 's/PACKAGE_NAME/"liblzma"/' xz/src/common/common_w32res.rc - sed -i 's/PACKAGE_URL/"https:\/\/tukaani.org\/xz\/"/' xz/src/common/common_w32res.rc - mkdir xz/build - cd xz/build - cmake -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="$Qt6_DIR" -DBUILD_SHARED_LIBS=ON .. - mingw32-make -j2 VERBOSE=1 - mingw32-make install - - name: Build MediaWriter - shell: bash - run: | - find /d -name libstdc++-6.dll - mkdir build - cd build - cmake -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$Qt6_DIR" .. - mingw32-make -j2 VERBOSE=1 - - name: Windeployqt - if: github.event_name == 'push' || github.event_name == 'release' - shell: bash - run: | - mkdir -p build/app/release - cd build/app/release - mv ../../src/app/helper.exe . - mv ../../src/app/mediawriter.exe . - $Qt6_DIR/bin/windeployqt.exe --qmldir ../../.. mediawriter.exe - cp $Qt6_DIR/bin/libstdc++-6.dll . - cp $Qt6_DIR/bin/libwinpthread-1.dll . - cp $Qt6_DIR/bin/libgcc_s_seh-1.dll . - cp $Qt6_DIR/bin/liblzma.dll . - cp /c/Program\ Files/OpenSSL/bin/*.dll . - find . -type d -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | grep -v "^.$" > uninstall.log - find . -type f -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | sort >> uninstall.log - - name: Installer - if: github.event_name == 'push' || github.event_name == 'release' - env: - TAG_NAME: ${{ env.TAG_NAME }} - shell: bash - run: | - VERSION_STRIPPED=$(sed "s/-.*//" <<< "${TAG_NAME}") - if [[ "$VERSION_STRIPPED" == "" ]]; then - VERSION_STRIPPED=0.0.0 - fi - VERSION_MAJOR=$(cut -d. -f1 <<< "${VERSION_STRIPPED}") - VERSION_MINOR=$(cut -d. -f2 <<< "${VERSION_STRIPPED}") - VERSION_BUILD=$(cut -d. -f3 <<< "${VERSION_STRIPPED}") - INSTALLED_SIZE=$(du -k -d0 "build/app/release" | cut -f1) - - cp "dist/win/mediawriter_native.nsi" "dist/win/mediawriter_native.tmp.nsi" - - sed -i "s/#!define VERSIONMAJOR/!define VERSIONMAJOR ${VERSION_MAJOR}/" "dist/win/mediawriter_native.tmp.nsi" - sed -i "s/#!define VERSIONMINOR/!define VERSIONMINOR ${VERSION_MINOR}/" "dist/win/mediawriter_native.tmp.nsi" - sed -i "s/#!define VERSIONBUILD/!define VERSIONBUILD ${VERSION_BUILD}/" "dist/win/mediawriter_native.tmp.nsi" - sed -i "s/#!define INSTALLSIZE/!define INSTALLSIZE ${INSTALLED_SIZE}/" "dist/win/mediawriter_native.tmp.nsi" - - unix2dos < "LICENSE.GPL-2" > "build/app/release/LICENSE.GPL-2.txt" - unix2dos < "LICENSE.LGPL-2" > "build/app/release/LICENSE.LGPL-2.txt" - - echo "LICENSE.GPL-2.txt" >> build/app/release/uninstall.log - echo "LICENSE.LGPL-2.txt" >> build/app/release/uninstall.log - - makensis -DCERTPATH="" -DCERTPASS="" dist/win/mediawriter_native.tmp.nsi - if [[ "$TAG_NAME" != "" ]]; then - mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64-$TAG_NAME.exe" - else - mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64.exe" - fi - - - name: Upload to GitHub (release) - if: github.event_name == 'release' - env: - TAG_NAME: ${{ env.TAG_NAME }} - shell: bash - run: | - bash ./dist/upload-to-github.sh github_api_token=${{ secrets.GITHUB_TOKEN }} tag="$TAG_NAME" filename="FedoraMediaWriter-win64-$TAG_NAME.exe" - - - name: Get version for WinGet publish (release) - id: get-version - if: github.event_name == 'release' - run: | - $WINGET_VER=$(bash ./dist/get-tag-name.sh) - echo "::set-output name=version::$WINGET_VER" - shell: bash - - - name: Publish to WinGet (release) - if: github.event_name == 'release' - uses: vedantmgoyal2009/winget-releaser@v2 - with: - identifier: Fedora.FedoraMediaWriter - version: ${{ steps.get-version.outputs.version }} - token: ${{ secrets.WINGET_TOKEN }} - - - name: Upload to GitHub (Development build) - if: github.event_name == 'push' - uses: marvinpinto/action-automatic-releases@latest - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest-windows" - prerelease: true - title: "Development Build (Windows)" - files: FedoraMediaWriter-win64.exe +# name: Automatic build +# +# on: +# push: +# branches: +# - 'main' +# pull_request: +# branches: +# - '**' +# release: +# types: [ created ] +# +# env: +# QT_VERSION: '6.5.2' +# +# jobs: +# Linux: +# if: github.event_name == 'push' || github.event_name == 'pull_request' +# runs-on: ubuntu-20.04 +# steps: +# - uses: actions/checkout@v1 +# with: +# fetch-depth: 1 +# - name: Install dependencies +# run: | +# sudo apt update +# sudo apt install libxss1 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 binutils cmake pkg-config libx11-dev xcb libx11-xcb-dev libxkbcommon-x11-dev libssl-dev libxss-dev libxmu-dev +# - name: Install Qt +# uses: jurplel/install-qt-action@v3 +# with: +# version: ${{env.QT_VERSION}} +# +# - name: Build +# run: | +# mkdir build +# cd build +# cmake .. -DCMAKE_INSTALL_PREFIX=/usr +# make -j2 +# +# +# Flatpak-test-build: +# if: github.event_name == 'push' || github.event_name == 'pull_request' +# runs-on: ubuntu-latest +# container: +# image: docker.io/bilelmoussaoui/flatpak-github-actions:kde-6.5 +# options: --privileged +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 1 +# - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 +# with: +# bundle: "org.fedoraproject.MediaWriter.flatpak" +# manifest-path: "dist/flatpak/org.fedoraproject.MediaWriter.json" +# cache-key: flatpak-builder-${{ github.sha }} +# - uses: marvinpinto/action-automatic-releases@latest +# if: github.event_name == 'push' +# with: +# repo_token: "${{ secrets.GITHUB_TOKEN }}" +# automatic_release_tag: "latest-flatpak" +# prerelease: true +# title: "Development Build (Flatpak)" +# files: org.fedoraproject.MediaWriter.flatpak +# +# macOS: +# runs-on: macos-latest +# steps: +# - uses: actions/checkout@v1 +# with: +# fetch-depth: 1 +# - name: Install Qt +# uses: jurplel/install-qt-action@v3 +# with: +# version: ${{env.QT_VERSION}} +# modules: qtimageformats +# - name: Set env (push) +# if: github.event_name == 'push' || github.event_name == 'pull_request' +# run: echo "TAG_NAME=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV +# - name: Set env (release) +# if: github.event_name == 'release' +# run: echo "TAG_NAME=$(bash ./dist/get-tag-name.sh)" >> $GITHUB_ENV +# - name: Build +# env: +# TAG_NAME: ${{ env.TAG_NAME }} +# run: | +# bash dist/mac/build.sh build +# - name: Insert dependencies +# run: | +# bash dist/mac/build.sh deps +# - name: Sign (TBD) +# if: github.event_name == 'release' +# run: | +# true # bash dist/mac/build.sh sign +# - name: Package +# env: +# TAG_NAME: ${{ env.TAG_NAME }} +# run: | +# bash dist/mac/build.sh dmg +# - name: Notarize (TBD) +# if: github.event_name == 'release' +# run: | +# true # bash dist/mac/build.sh notarize +# - name: Upload to GitHub (release) +# if: github.event_name == 'release' +# env: +# TAG_NAME: ${{ env.TAG_NAME }} +# run: | +# bash dist/upload-to-github.sh github_api_token=${{ secrets.GITHUB_TOKEN }} tag="$TAG_NAME" filename="FedoraMediaWriter-osx-$TAG_NAME.unnotarized.dmg" +# - name: Upload to GitHub (Development build) +# if: github.event_name == 'push' +# uses: marvinpinto/action-automatic-releases@latest +# with: +# repo_token: "${{ secrets.GITHUB_TOKEN }}" +# automatic_release_tag: "latest-macos" +# prerelease: true +# title: "Development Build (MacOS)" +# files: FedoraMediaWriter-osx-${{ env.TAG_NAME }}.unnotarized.dmg +# +# Windows: +# runs-on: windows-latest +# steps: +# - uses: actions/checkout@v1 +# with: +# fetch-depth: 1 +# - name: Set env (push) +# if: github.event_name == 'push' || github.event_name == 'release' +# run: echo "TAG_NAME=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV +# - name: Install dependencies +# shell: bash +# run: | +# choco install nsis +# choco install dos2unix +# - name: Install Qt +# uses: jurplel/install-qt-action@v3 +# with: +# cached: ${{ steps.cache-qt.outputs.cache-hit }} +# arch: win64_mingw +# version: ${{env.QT_VERSION}} +# - name: Build xz-utils +# shell: bash +# if: ${{ !steps.cache-qt.outputs.cache-hit }} +# run: | +# git clone https://git.tukaani.org/xz.git +# cd xz +# git checkout v5.2 +# cd .. +# sed -i 's/#include "config.h"//' xz/src/common/common_w32res.rc +# sed -i 's/PACKAGE_NAME/"liblzma"/' xz/src/common/common_w32res.rc +# sed -i 's/PACKAGE_URL/"https:\/\/tukaani.org\/xz\/"/' xz/src/common/common_w32res.rc +# mkdir xz/build +# cd xz/build +# cmake -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="$Qt6_DIR" -DBUILD_SHARED_LIBS=ON .. +# mingw32-make -j2 VERBOSE=1 +# mingw32-make install +# - name: Build MediaWriter +# shell: bash +# run: | +# find /d -name libstdc++-6.dll +# mkdir build +# cd build +# cmake -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$Qt6_DIR" .. +# mingw32-make -j2 VERBOSE=1 +# - name: Windeployqt +# if: github.event_name == 'push' || github.event_name == 'release' +# shell: bash +# run: | +# mkdir -p build/app/release +# cd build/app/release +# mv ../../src/app/helper.exe . +# mv ../../src/app/mediawriter.exe . +# $Qt6_DIR/bin/windeployqt.exe --qmldir ../../.. mediawriter.exe +# cp $Qt6_DIR/bin/libstdc++-6.dll . +# cp $Qt6_DIR/bin/libwinpthread-1.dll . +# cp $Qt6_DIR/bin/libgcc_s_seh-1.dll . +# cp $Qt6_DIR/bin/liblzma.dll . +# cp /c/Program\ Files/OpenSSL/bin/*.dll . +# find . -type d -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | grep -v "^.$" > uninstall.log +# find . -type f -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | sort >> uninstall.log +# - name: Installer +# if: github.event_name == 'push' || github.event_name == 'release' +# env: +# TAG_NAME: ${{ env.TAG_NAME }} +# shell: bash +# run: | +# VERSION_STRIPPED=$(sed "s/-.*//" <<< "${TAG_NAME}") +# if [[ "$VERSION_STRIPPED" == "" ]]; then +# VERSION_STRIPPED=0.0.0 +# fi +# VERSION_MAJOR=$(cut -d. -f1 <<< "${VERSION_STRIPPED}") +# VERSION_MINOR=$(cut -d. -f2 <<< "${VERSION_STRIPPED}") +# VERSION_BUILD=$(cut -d. -f3 <<< "${VERSION_STRIPPED}") +# INSTALLED_SIZE=$(du -k -d0 "build/app/release" | cut -f1) +# +# cp "dist/win/mediawriter_native.nsi" "dist/win/mediawriter_native.tmp.nsi" +# +# sed -i "s/#!define VERSIONMAJOR/!define VERSIONMAJOR ${VERSION_MAJOR}/" "dist/win/mediawriter_native.tmp.nsi" +# sed -i "s/#!define VERSIONMINOR/!define VERSIONMINOR ${VERSION_MINOR}/" "dist/win/mediawriter_native.tmp.nsi" +# sed -i "s/#!define VERSIONBUILD/!define VERSIONBUILD ${VERSION_BUILD}/" "dist/win/mediawriter_native.tmp.nsi" +# sed -i "s/#!define INSTALLSIZE/!define INSTALLSIZE ${INSTALLED_SIZE}/" "dist/win/mediawriter_native.tmp.nsi" +# +# unix2dos < "LICENSE.GPL-2" > "build/app/release/LICENSE.GPL-2.txt" +# unix2dos < "LICENSE.LGPL-2" > "build/app/release/LICENSE.LGPL-2.txt" +# +# echo "LICENSE.GPL-2.txt" >> build/app/release/uninstall.log +# echo "LICENSE.LGPL-2.txt" >> build/app/release/uninstall.log +# +# makensis -DCERTPATH="" -DCERTPASS="" dist/win/mediawriter_native.tmp.nsi +# if [[ "$TAG_NAME" != "" ]]; then +# mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64-$TAG_NAME.exe" +# else +# mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64.exe" +# fi +# +# - name: Upload to GitHub (release) +# if: github.event_name == 'release' +# env: +# TAG_NAME: ${{ env.TAG_NAME }} +# shell: bash +# run: | +# bash ./dist/upload-to-github.sh github_api_token=${{ secrets.GITHUB_TOKEN }} tag="$TAG_NAME" filename="FedoraMediaWriter-win64-$TAG_NAME.exe" +# +# - name: Get version for WinGet publish (release) +# id: get-version +# if: github.event_name == 'release' +# run: | +# $WINGET_VER=$(bash ./dist/get-tag-name.sh) +# echo "::set-output name=version::$WINGET_VER" +# shell: bash +# +# - name: Publish to WinGet (release) +# if: github.event_name == 'release' +# uses: vedantmgoyal2009/winget-releaser@v2 +# with: +# identifier: Fedora.FedoraMediaWriter +# version: ${{ steps.get-version.outputs.version }} +# token: ${{ secrets.WINGET_TOKEN }} +# +# - name: Upload to GitHub (Development build) +# if: github.event_name == 'push' +# uses: marvinpinto/action-automatic-releases@latest +# with: +# repo_token: "${{ secrets.GITHUB_TOKEN }}" +# automatic_release_tag: "latest-windows" +# prerelease: true +# title: "Development Build (Windows)" +# files: FedoraMediaWriter-win64.exe diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 00000000..45df47bd --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,177 @@ +name: pr-check + +on: [pull_request] + +env: + QT_VERSION: '6.5.3' + +jobs: + Linux: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: ${{env.QT_VERSION}} + cache: true + cache-key-prefix: ${{ github.job }}-qt + + - name: Build + run: | + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=/usr + make -j2 + + Flatpak: + runs-on: ubuntu-22.04 + container: + image: docker.io/bilelmoussaoui/flatpak-github-actions:kde-6.5 + options: --privileged + steps: + - uses: actions/checkout@v4 + + - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 + with: + bundle: "org.fedoraproject.MediaWriter.flatpak" + manifest-path: "dist/flatpak/org.fedoraproject.MediaWriter.json" + cache-key: flatpak-builder-${{ github.sha }} + + - uses: actions/upload-artifact@v3 + with: + name: org.fedoraproject.MediaWriter.flatpak + path: org.fedoraproject.MediaWriter.flatpak + + + macOS: + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + + - name: Set env + run: echo "TAG_NAME=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: ${{env.QT_VERSION}} + modules: qtimageformats + cache: true + cache-key-prefix: ${{ github.job }}-qt + + - name: Build + run: | + cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_BUILD_TYPE=Release + cmake --build . --parallel + + - name: Bundle + run: | + # A workaround mentioned here https://github.com/actions/runner-images/issues/7522 + echo killing...; sudo pkill -9 XProtect >/dev/null || true; + echo waiting...; while pgrep XProtect; do sleep 3; done; + "$Qt6_DIR"/bin/macdeployqt build/app/FedoraMediaWriter.app -qmldir=src/app/qml -appstore-compliant + # No idea why but macdeployqt deploys debug libs too, just remove them, maybe fix this sometimes + for i in `find build/app/FedoraMediaWriter.app/ -name '*.dSYM'`; do rm -fr "$i"; done + "$Qt6_DIR"/bin/macdeployqt build/app/FedoraMediaWriter.app -dmg -always-overwrite -appstore-compliant + + - uses: actions/upload-artifact@v3 + with: + name: FedoraMediaWriter.dmg + path: build/app/FedoraMediaWriter.dmg + + Windows-MSVC: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + shell: bash + run: | + choco install nsis + choco install dos2unix + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: ${{env.QT_VERSION}} + arch: win64_msvc2019_64 + cache: true + cache-key-prefix: ${{ github.job }}-qt + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.1 + + - name: Build xz-utils + shell: bash + if: ${{ !steps.cache-qt.outputs.cache-hit }} + run: | + eval "$(./dist/win/make-vs2019-env.bat)" + git clone https://git.tukaani.org/xz.git + cd xz + git checkout v5.2 + sed -i 's/#include "config.h"//' src/common/common_w32res.rc + sed -i 's/PACKAGE_NAME/"liblzma"/' src/common/common_w32res.rc + sed -i 's/PACKAGE_URL/"https:\/\/tukaani.org\/xz\/"/' src/common/common_w32res.rc + mkdir build + cd build + cmake .. -GNinja -DCMAKE_INSTALL_PREFIX="$Qt6_DIR" -DBUILD_SHARED_LIBS=ON .. + cmake --build . + cmake --install . + + - name: Build MediaWriter + shell: bash + run: | + eval "$(./dist/win/make-vs2019-env.bat)" + mkdir build + cd build + cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$Qt6_DIR" .. + cmake --build . + cmake --install . + + - name: Windeployqt + shell: bash + run: | + mkdir -p build/app/release + cd build/app/release + mv ../../src/app/helper.exe . + mv ../../src/app/mediawriter.exe . + $Qt6_DIR/bin/windeployqt.exe mediawriter.exe --verbose 2 --qmldir ../../.. --compiler-runtime --release + find . -type d -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | grep -v "^.$" > uninstall.log + find . -type f -not -path '*/\.*' | sed 's/^\.\///g' | sed 's@\/@\\@g' | sort >> uninstall.log + + - name: Installer + env: + TAG_NAME: ${{ env.TAG_NAME }} + shell: bash + run: | + VERSION_STRIPPED=$(sed "s/-.*//" <<< "${TAG_NAME}") + if [[ "$VERSION_STRIPPED" == "" ]]; then + VERSION_STRIPPED=0.0.0 + fi + VERSION_MAJOR=$(cut -d. -f1 <<< "${VERSION_STRIPPED}") + VERSION_MINOR=$(cut -d. -f2 <<< "${VERSION_STRIPPED}") + VERSION_BUILD=$(cut -d. -f3 <<< "${VERSION_STRIPPED}") + INSTALLED_SIZE=$(du -k -d0 "build/app/release" | cut -f1) + + cp "dist/win/mediawriter_native.nsi" "dist/win/mediawriter_native.tmp.nsi" + + sed -i "s/#!define VERSIONMAJOR/!define VERSIONMAJOR ${VERSION_MAJOR}/" "dist/win/mediawriter_native.tmp.nsi" + sed -i "s/#!define VERSIONMINOR/!define VERSIONMINOR ${VERSION_MINOR}/" "dist/win/mediawriter_native.tmp.nsi" + sed -i "s/#!define VERSIONBUILD/!define VERSIONBUILD ${VERSION_BUILD}/" "dist/win/mediawriter_native.tmp.nsi" + sed -i "s/#!define INSTALLSIZE/!define INSTALLSIZE ${INSTALLED_SIZE}/" "dist/win/mediawriter_native.tmp.nsi" + + unix2dos < "LICENSE.GPL-2" > "build/app/release/LICENSE.GPL-2.txt" + unix2dos < "LICENSE.LGPL-2" > "build/app/release/LICENSE.LGPL-2.txt" + + echo "LICENSE.GPL-2.txt" >> build/app/release/uninstall.log + echo "LICENSE.LGPL-2.txt" >> build/app/release/uninstall.log + + makensis -DCERTPATH="" -DCERTPASS="" dist/win/mediawriter_native.tmp.nsi + mv dist/win/FMW-setup.exe ./"FedoraMediaWriter-win64-$TAG_NAME.exe" + + - uses: actions/upload-artifact@v3 + with: + name: FedoraMediaWriter-win64-${{ env.TAG_NAME }}.exe + path: FedoraMediaWriter-win64-${{ env.TAG_NAME }}.exe diff --git a/dist/flatpak/org.fedoraproject.MediaWriter.json b/dist/flatpak/org.fedoraproject.MediaWriter.json index 1146bfce..c1404b81 100644 --- a/dist/flatpak/org.fedoraproject.MediaWriter.json +++ b/dist/flatpak/org.fedoraproject.MediaWriter.json @@ -12,18 +12,12 @@ "--share=network", "--share=ipc", "--talk-name=org.freedesktop.Notifications", - "--system-talk-name=org.freedesktop.UDisks2", - "--env=QML2_IMPORT_PATH=/app/lib/qt6/qml" - ], - "cleanup": [ - "/include", - "/lib/cmake", - "/lib/pkgconfig" + "--system-talk-name=org.freedesktop.UDisks2" ], "modules": [ { "name": "MediaWriter", - "buildsystem": "cmake", + "buildsystem": "cmake-ninja", "sources": [ { "type": "git", diff --git a/dist/win/make-vs2019-env-attribution b/dist/win/make-vs2019-env-attribution new file mode 100644 index 00000000..4d524dd9 --- /dev/null +++ b/dist/win/make-vs2019-env-attribution @@ -0,0 +1,2 @@ +Source: https://gist.github.com/vvuk/01dc8a12678d1beffaa1e26549d03b02 +Author: Vladimir Vukicevic (vvuk) diff --git a/dist/win/make-vs2019-env.bat b/dist/win/make-vs2019-env.bat new file mode 100644 index 00000000..204c871d --- /dev/null +++ b/dist/win/make-vs2019-env.bat @@ -0,0 +1,15 @@ +@ECHO OFF + +set OLDPATH=%PATH% + +call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 > NUL: + +echo export INCLUDE='%INCLUDE%' +echo export LIB='%LIB%' +echo export LIBPATH='%LIBPATH%' + +call set NEWPATH=%%PATH:%OLDPATH%=%% +set NEWPATH=%NEWPATH:C:=/c% +set NEWPATH=%NEWPATH:\=/% +set NEWPATH=%NEWPATH:;=:% +echo export PATH="%NEWPATH%:$PATH" diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 2442b343..ac516834 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -54,12 +54,13 @@ endif() if (APPLE) set(ICON mediawriter.icns) set(ICON_PATH ${CMAKE_CURRENT_SOURCE_DIR}/data/icons/mediawriter.icns) - add_executable(mediawriter MACOSX_BUNDLE ${MEDIAWRITER_SRCS} ${ICON_PATH}) + add_executable(mediawriter MACOSX_BUNDLE MANUAL_FINALIZATION ${MEDIAWRITER_SRCS} ${ICON_PATH}) set_target_properties(mediawriter PROPERTIES - OUTPUT_NAME "Fedora Media Writer" + OUTPUT_NAME "FedoraMediaWriter" MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_BUNDLE_VERSION ${MEDIAWRITER_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${MEDIAWRITER_VERSION} MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/data/Info.plist - MACOSX_DEPLOYMENT_TARGET 10.14 MACOSX_PACKAGE_LOCATION "Resources" ) set_source_files_properties(${ICON_PATH} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") @@ -88,23 +89,13 @@ if (APPLE) target_link_libraries(mediawriter "-framework Foundation" "-framework DiskArbitration") endif() -install(TARGETS mediawriter DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) +install(TARGETS mediawriter + BUNDLE DESTINATION . + DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} +) if (UNIX AND NOT APPLE) install(DIRECTORY data/icons/hicolor/ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor) install(FILES data/org.fedoraproject.MediaWriter.desktop DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications) install(FILES data/org.fedoraproject.MediaWriter.appdata.xml DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/metainfo) endif() - -if (APPLE AND CREATE_STANDALONE_MAC_BUNDLE) - get_target_property(QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION) - get_filename_component(QT_BIN_DIR "${QMAKE_EXECUTABLE}" DIRECTORY) - find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}") - add_custom_command(TARGET mediawriter POST_BUILD - COMMAND "${MACDEPLOYQT_EXECUTABLE}" - "${CMAKE_BINARY_DIR}/src/app/Fedora Media Writer.app" - -qmldir="${CMAKE_SOURCE_DIR}/src/app/qml" - -executable=\"${CMAKE_BINARY_DIR}/src/app/Fedora Media Writer.app/Contents/MacOS/helper\" - -appstore-compliant - COMMENT "Deploying Qt...") -endif()