|
| 1 | +name: Windows build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: '*' |
| 6 | + tags: '*' |
| 7 | + pull_request: |
| 8 | + branches: [ "master" ] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: windows-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + qt-version: ['6.6'] |
| 16 | + qt-target: ['desktop'] |
| 17 | + qt-modules: [''] |
| 18 | + mingw-version: ['11.2.0'] |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + submodules: 'recursive' |
| 24 | + - name: Setup environment |
| 25 | + run: | |
| 26 | + sed -i -e '/^#/d' .github/config.env |
| 27 | + sed -i -e '/^$/d' .github/config.env |
| 28 | + cat .github/config.env >> "${GITHUB_ENV}" |
| 29 | + shell: bash |
| 30 | + - name: Get version |
| 31 | + run: | |
| 32 | + version=$(LC_ALL=en_US.utf8 grep -oP 'project\([^)]*\s+VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt) |
| 33 | + echo "Project version: $version" |
| 34 | + echo previous_tag=$version >> "${GITHUB_ENV}" |
| 35 | + shell: bash |
| 36 | + ## Install Qt |
| 37 | + - name: Install Qt |
| 38 | + uses: jurplel/install-qt-action@v3 |
| 39 | + with: |
| 40 | + version: ${{ matrix.qt-version }} |
| 41 | + host: 'windows' |
| 42 | + arch: 'win64_mingw' |
| 43 | + target: ${{ matrix.qt-target }} |
| 44 | + modules: ${{ matrix.qt-modules }} |
| 45 | + - name: Install Qt IFW |
| 46 | + run: | |
| 47 | + curl -o aqt.exe -L https://github.com/miurahr/aqtinstall/releases/download/v2.2.1/aqt.exe |
| 48 | + ./aqt.exe install-tool windows desktop tools_ifw |
| 49 | + mv Tools .. |
| 50 | + echo ${pwd}/../Tools/QtInstallerFramework/*/bin >> "${GITHUB_PATH}" |
| 51 | + shell: bash |
| 52 | + - name: Install MinGW |
| 53 | + uses: egor-tensin/setup-mingw@v2 |
| 54 | + with: |
| 55 | + platform: x64 |
| 56 | + static: 0 |
| 57 | + version: ${{ matrix.mingw-version }} |
| 58 | + ## Build |
| 59 | + - name: Windows build |
| 60 | + run: .ci/common/build.sh win_build win64 |
| 61 | + shell: bash |
| 62 | + - name: Deploy |
| 63 | + run: | |
| 64 | + mkdir win_release |
| 65 | + for /r win_build %%f in (${{ env.executable_name }}.exe) do @move "%%f" win_release |
| 66 | + for /r win_build %%f in (*.dll) do @move "%%f" win_release |
| 67 | + cd win_release |
| 68 | + windeployqt ${{ env.executable_name }}.exe --qmldir ..\win_build\src || exit 5 |
| 69 | + shell: cmd |
| 70 | + ## Upload |
| 71 | + - name: Upload artifacts |
| 72 | + uses: actions/upload-artifact@v3 |
| 73 | + with: |
| 74 | + name: build-Qt-${{ matrix.qt-version }} |
| 75 | + path: win_release/ |
| 76 | + ## Build installer |
| 77 | + - if: env.create_windows_installer == 1 |
| 78 | + name: Disable repository update |
| 79 | + run: echo "update_windows_repository=0" >> "${GITHUB_ENV}" |
| 80 | + shell: bash |
| 81 | + - if: env.create_windows_installer == 1 |
| 82 | + name: Get installer repository |
| 83 | + uses: actions/checkout@v4 |
| 84 | + with: |
| 85 | + repository: ${{ env.installer_repo_github }}/${{ env.installer_repo_name }} |
| 86 | + fetch-depth: 0 |
| 87 | + path: win_repo |
| 88 | + token: ${{ secrets.PUSH_TOKEN }} |
| 89 | + - if: env.create_windows_installer == 1 |
| 90 | + name: Build installer |
| 91 | + run: .ci/windows_installer.sh "${GITHUB_WORKSPACE}/win_repo" |
| 92 | + shell: bash |
| 93 | + # Upload installer |
| 94 | + - name: Upload installer |
| 95 | + uses: actions/upload-artifact@v3 |
| 96 | + with: |
| 97 | + name: installer-Qt-${{ matrix.qt-version }} |
| 98 | + path: '*installer.exe' |
0 commit comments