diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 41769db..f11bb58 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -1,10 +1,8 @@ -# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. -# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml -name: CMake on Ubuntu +name: CMake on Ubuntu and Windows on: push: - branches: [ "master", "develop", "prod" ] + branches: [ "master", "prod" ] pull_request: branches: [ "master" ] @@ -13,28 +11,15 @@ jobs: runs-on: ${{ matrix.os }} strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. fail-fast: false - - # Set up a matrix to run the following 3 configurations: - # 1. - # 2. - # - # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, windows-latest] build_type: [Release] - c_compiler: [gcc] - include: - - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ steps: - name: Install Qt uses: jurplel/install-qt-action@v4 with: - # We use 6.4.2 here since that seems to be what Kubuntu 24.04 has to offer when it comes to QT 6 version: '6.4.2' target: 'desktop' set-env: 'true' @@ -42,47 +27,48 @@ jobs: - uses: actions/checkout@v4 - name: Set reusable strings - # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings shell: bash run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S ${{ github.workspace }} + -G "Visual Studio 16 2019" # Required for Windows with Visual Studio (for multi-config build) - name: Build - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + run: | + if [[ $RUNNER_OS == "Windows" ]]; then + cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + else + cmake --build ${{ steps.strings.outputs.build-output-dir }} + fi + + - name: Package Windows Build + if: runner.os == 'Windows' + run: | + mkdir -p ${{ steps.strings.outputs.build-output-dir }}/installer + windeployqt ${{ steps.strings.outputs.build-output-dir }}/my_app.exe --dir ${{ steps.strings.outputs.build-output-dir }}/installer + zip -r Tail-Tray.zip ${{ steps.strings.outputs.build-output-dir }}/installer + shell: bash - name: Package DEB file + if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/prod') run: | chmod +x ./build-deb.sh ./build-deb.sh ${{ steps.strings.outputs.build-output-dir }} shell: bash - if: - contains(' - refs/heads/master - refs/heads/prod - ', github.ref) - uses: "marvinpinto/action-automatic-releases@latest" with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: true - title: "Dev build debs" - files: | - ${{ steps.strings.outputs.build-output-dir }}/*.deb - if: - contains(' - refs/heads/master - refs/heads/prod - ', github.ref) + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + title: "Dev build artifacts" + files: | + ${{ steps.strings.outputs.build-output-dir }}/*.deb + ${{ steps.strings.outputs.build-output-dir }}/my_app_windows.zip + if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/prod')