|
| 1 | +name: Windows CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + name: "${{ matrix.config.name }} | ${{ matrix.config.build_type }}" |
| 19 | + runs-on: ${{ matrix.config.os }} |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + config: |
| 24 | + - { |
| 25 | + name: "64-bit", |
| 26 | + os: windows-latest, |
| 27 | + PLATFORM: x64, |
| 28 | + WINXX_ARCH: win64, |
| 29 | + extra_path: "/c/Qt/5.15.10-x64/bin:/c/MinGW-w64/mingw64/bin", |
| 30 | + extra_options: "-DCMAKE_TOOLCHAIN_FILE=`pwd`/_common/ci_windows_mingw_toolchain_x64.cmake", |
| 31 | + build_type: "Release", |
| 32 | + upload_directory: "www/win32/moondust-win64/", |
| 33 | + mingw_download: "https://wohlsoft.ru/docs/Software/MinGW/x86_64-13.1.0-release-posix-seh-msvcrt-rt_v11-rev1.7z", mingw_install_dir: "C:/MinGW-w64/", |
| 34 | + ninja_download: "https://wohlsoft.ru/docs/Software/Ninja-Build/ninja-win.zip", ninja_install_dir: "C:/MinGW-w64/mingw64/bin", |
| 35 | + lftp_download: "https://wohlsoft.ru/docs/Software/lftp-4.4.15.win64-openssl-1.0.1g.7z", lftp_install_dir: "C:/MinGW-w64/mingw64/" |
| 36 | + } |
| 37 | + - { |
| 38 | + name: "32-bit", |
| 39 | + os: windows-latest, |
| 40 | + PLATFORM: Win32, |
| 41 | + WINXX_ARCH: win32, |
| 42 | + extra_path: "/c/Qt/5.6.3-i686/bin:/c/MinGW-w64/mingw32/bin", |
| 43 | + extra_options: "-DCMAKE_TOOLCHAIN_FILE=`pwd`/_common/ci_windows_mingw_toolchain_x32.cmake", |
| 44 | + build_type: "Release", |
| 45 | + upload_directory: "www/win32/moondust-win32/", |
| 46 | + mingw_download: "https://wohlsoft.ru/docs/Software/MinGW/i686-12.2.0-release-posix-dwarf-rt_v10-rev1.7z", mingw_install_dir: "C:/MinGW-w64/", |
| 47 | + ninja_download: "https://wohlsoft.ru/docs/Software/Ninja-Build/ninja-win.zip", ninja_install_dir: "C:/MinGW-w64/mingw32/bin", |
| 48 | + lftp_download: "https://wohlsoft.ru/docs/Software/lftp-4.4.15.win64-openssl-1.0.1g.7z", lftp_install_dir: "C:/MinGW-w64/mingw32/" |
| 49 | + } |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Check for the upload support |
| 53 | + id: upload-check |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + if [[ "${{ secrets.builds_login }}" != '' && \ |
| 57 | + "${{ secrets.builds_password }}" != '' && \ |
| 58 | + "${{ secrets.builds_host }}" != '' ]]; then |
| 59 | + echo "available=true" >> $GITHUB_OUTPUT; |
| 60 | + else |
| 61 | + echo "available=false" >> $GITHUB_OUTPUT; |
| 62 | + fi |
| 63 | +
|
| 64 | + - uses: actions/checkout@v3 |
| 65 | + with: |
| 66 | + fetch-depth: 3 |
| 67 | + submodules: recursive |
| 68 | + |
| 69 | + - uses: Wohlstand/branch-name@v1.0.1-wohl |
| 70 | + |
| 71 | + - name: Check if a pull request |
| 72 | + id: event-check |
| 73 | + shell: bash |
| 74 | + run: | |
| 75 | + if [[ "${BRANCH_NAME}" == *"merge"* ]]; then |
| 76 | + echo "--- This build is a pull-request ---" |
| 77 | + echo "is_pull_request=true" >> $GITHUB_OUTPUT; |
| 78 | + else |
| 79 | + echo "--- This build is a normal branch build ---" |
| 80 | + echo "is_pull_request=false" >> $GITHUB_OUTPUT; |
| 81 | + fi |
| 82 | +
|
| 83 | + - name: Download MinGW |
| 84 | + if: matrix.config.mingw_download |
| 85 | + uses: carlosperate/download-file-action@v2 |
| 86 | + with: |
| 87 | + file-url: "${{ matrix.config.mingw_download }}" |
| 88 | + file-name: mingw.7z |
| 89 | + |
| 90 | + - name: Extract MinGW |
| 91 | + if: matrix.config.mingw_install_dir |
| 92 | + shell: bash |
| 93 | + run: | |
| 94 | + 7z x mingw.7z -o"${{ matrix.config.mingw_install_dir }}" |
| 95 | +
|
| 96 | + - name: Download Ninja |
| 97 | + if: matrix.config.ninja_download |
| 98 | + uses: carlosperate/download-file-action@v2 |
| 99 | + with: |
| 100 | + file-url: "${{ matrix.config.ninja_download }}" |
| 101 | + file-name: ninja.zip |
| 102 | + |
| 103 | + - name: Extract Ninja |
| 104 | + if: matrix.config.ninja_install_dir |
| 105 | + shell: bash |
| 106 | + run: | |
| 107 | + 7z x ninja.zip -o"${{ matrix.config.ninja_install_dir }}" |
| 108 | +
|
| 109 | + - name: Download LFTP |
| 110 | + if: matrix.config.lftp_download |
| 111 | + uses: carlosperate/download-file-action@v2 |
| 112 | + with: |
| 113 | + file-url: "${{ matrix.config.lftp_download }}" |
| 114 | + file-name: lftp.7z |
| 115 | + |
| 116 | + - name: Extract LFTP |
| 117 | + if: matrix.config.lftp_install_dir |
| 118 | + shell: bash |
| 119 | + run: | |
| 120 | + 7z x lftp.7z bin etc -o"${{ matrix.config.lftp_install_dir }}" |
| 121 | +
|
| 122 | + - name: Configure |
| 123 | + shell: bash |
| 124 | + run: | |
| 125 | + if [[ ! -z "${{ matrix.config.extra_path }}" ]]; then |
| 126 | + export PATH=${{ matrix.config.extra_path }}:${PATH} |
| 127 | + echo "PATH environment: ${PATH}" |
| 128 | + fi |
| 129 | + echo "=====================================" |
| 130 | + qmake --version |
| 131 | + echo "=====================================" |
| 132 | + gcc --version |
| 133 | + echo "=====================================" |
| 134 | + git --version |
| 135 | + echo "=====================================" |
| 136 | + cmake --version |
| 137 | + echo "=====================================" |
| 138 | + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_INSTALL_PREFIX="`pwd`/bin-cmake-release" ${{ matrix.config.extra_options }} . |
| 139 | +
|
| 140 | + - name: Build |
| 141 | + shell: bash |
| 142 | + run: | |
| 143 | + if [[ ! -z "${{ matrix.config.extra_path }}" ]]; then |
| 144 | + export PATH=${{ matrix.config.extra_path }}:${PATH} |
| 145 | + export QT_DIR="${{ matrix.config.qt_dir }}" |
| 146 | + export QtDir="${{ matrix.config.qt_dir }}" |
| 147 | + fi |
| 148 | + export MAKEFLAGS=--keep-going |
| 149 | + cmake --build build --target all --config ${{ matrix.config.build_type }} --parallel 3 |
| 150 | +
|
| 151 | + - name: Install |
| 152 | + shell: bash |
| 153 | + run: | |
| 154 | + if [[ ! -z "${{ matrix.config.extra_path }}" ]]; then |
| 155 | + export PATH=${{ matrix.config.extra_path }}:${PATH} |
| 156 | + export QT_DIR="${{ matrix.config.qt_dir }}" |
| 157 | + export QtDir="${{ matrix.config.qt_dir }}" |
| 158 | + fi |
| 159 | + export MAKEFLAGS=--keep-going |
| 160 | + cmake --build build --target install --config ${{ matrix.config.build_type }} |
| 161 | +
|
| 162 | +# - name: Deploy |
| 163 | +# shell: bash |
| 164 | +# run: | |
| 165 | +# if [[ ! -z "${{ matrix.config.extra_path }}" ]]; then |
| 166 | +# export PATH=${{ matrix.config.extra_path }}:${PATH} |
| 167 | +# export QT_DIR="${{ matrix.config.qt_dir }}" |
| 168 | +# export QtDir="${{ matrix.config.qt_dir }}" |
| 169 | +# fi |
| 170 | +# export MAKEFLAGS=--keep-going |
| 171 | +# cmake --build build --target windeploy --config ${{ matrix.config.build_type }} |
| 172 | +# cmake --build build --target enable_portable |
| 173 | +# cmake --build build --target put_online_help |
| 174 | +# cmake --build build --target create_zip |
| 175 | +# cmake --build build --target create_zip_tools |
| 176 | +# cmake --build build --target create_zip_install |
| 177 | +# mkdir _packed |
| 178 | +# mv bin-cmake-release/_packed/*.zip _packed |
| 179 | + |
| 180 | +# - name: Deploy to builds.wohlsoft.ru |
| 181 | +# if: success() && github.event_name != 'pull_request' && steps.event-check.outputs.is_pull_request == 'false' && steps.upload-check.outputs.available == 'true' |
| 182 | +# shell: bash |
| 183 | +# run: | |
| 184 | +# if [[ ! -z "${{ matrix.config.extra_path }}" ]]; then |
| 185 | +# export PATH=${{ matrix.config.extra_path }}:${PATH} |
| 186 | +# fi |
| 187 | +# UPLOAD_LIST="set ssl:verify-certificate no;" |
| 188 | +# for q in ./_packed/*.zip; do |
| 189 | +# UPLOAD_LIST="${UPLOAD_LIST} put -O ${{ matrix.config.upload_directory }} $q;" |
| 190 | +# done |
| 191 | +# lftp -e "${UPLOAD_LIST} exit" -u ${{ secrets.builds_login }},${{ secrets.builds_password }} ${{ secrets.builds_host }} |
| 192 | + |
| 193 | + - name: List Build Directory |
| 194 | + if: always() |
| 195 | + shell: bash |
| 196 | + run: | |
| 197 | + git status |
| 198 | + ls -lR build |
0 commit comments