|
| 1 | +name: Build libdither |
| 2 | + |
| 3 | +env: |
| 4 | + QT_VERSION_WIN: "6.9.2" |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + push: |
| 9 | + tags: |
| 10 | + - '*-*-*' |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + name: Build (${{ matrix.project }}) |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - os: windows-latest |
| 24 | + project: win64_msvc |
| 25 | + - os: windows-latest |
| 26 | + project: win64_mingw |
| 27 | + - os: ubuntu-22.04 |
| 28 | + project: linux_x86_64 |
| 29 | + - os: macos-latest |
| 30 | + project: macos_universal |
| 31 | + qt_arch: clang_64 |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + submodules: recursive |
| 38 | + |
| 39 | + - name: Set up msbuild (Windows MSVC) |
| 40 | + if: matrix.project == 'win64_msvc' |
| 41 | + uses: microsoft/setup-msbuild@v2 |
| 42 | + with: |
| 43 | + msbuild-architecture: x64 |
| 44 | + |
| 45 | + - name: Build libdither (Windows MSVC) |
| 46 | + if: matrix.project == 'win64_msvc' |
| 47 | + run: | |
| 48 | + msbuild libdither.vcxproj /p:Configuration=Release /property:Platform=x64 |
| 49 | + shell: cmd |
| 50 | + |
| 51 | + - name: Build demo (Windows MSVC) |
| 52 | + if: matrix.project == 'win64_msvc' |
| 53 | + run: | |
| 54 | + msbuild libdither_static.vcxproj /p:Configuration=Release /property:Platform=x64 |
| 55 | + msbuild demo.vcxproj /p:Configuration=Release /property:Platform=x64 |
| 56 | + shell: cmd |
| 57 | + |
| 58 | + - name: Run demo (Windows MSVC) |
| 59 | + if: matrix.project == 'win64_msvc' |
| 60 | + run: | |
| 61 | + make demo_run_msvc |
| 62 | + shell: cmd |
| 63 | + |
| 64 | + - name: Set up Make and Chocolatey (Windows MinGW) |
| 65 | + if: matrix.project == 'win64_mingw' |
| 66 | + uses: crazy-max/ghaction-chocolatey@v3 |
| 67 | + with: |
| 68 | + args: 'install make' |
| 69 | + |
| 70 | + - name: Set up Qt (Windows MinGW) |
| 71 | + if: matrix.project == 'win64_mingw' |
| 72 | + uses: jurplel/install-qt-action@v4 |
| 73 | + with: |
| 74 | + target: 'desktop' |
| 75 | + arch: ${{ matrix.qt_arch }} |
| 76 | + version: ${{ env.QT_VERSION_WIN }} |
| 77 | + archives: 'qtbase MinGW' |
| 78 | + setup-python: true |
| 79 | + cache: true |
| 80 | + add-tools-to-path: true |
| 81 | + set-env: true |
| 82 | + |
| 83 | + - name: Build libdither (Windows MinGW) |
| 84 | + if: matrix.project == 'win64_mingw' |
| 85 | + run: | |
| 86 | + make WIN_MINGW_BIN_PATH=%GITHUB_WORKSPACE%\Qt\${{ env.QT_VERSION_WIN }}\mingw_64\bin libdither |
| 87 | + shell: cmd |
| 88 | + |
| 89 | + - name: Build demo (Windows MinGW) |
| 90 | + if: matrix.project == 'win64_mingw' |
| 91 | + run: | |
| 92 | + make WIN_MINGW_BIN_PATH=%GITHUB_WORKSPACE%\Qt\${{ env.QT_VERSION_WIN }}\mingw_64\bin demo |
| 93 | + shell: cmd |
| 94 | + |
| 95 | + - name: Run demo (Windows MinGW) |
| 96 | + if: matrix.project == 'win64_mingw' |
| 97 | + run: | |
| 98 | + make demo_run |
| 99 | + shell: cmd |
| 100 | + |
| 101 | + - name: Install prerequisites (Linux) |
| 102 | + if: matrix.project == 'linux_x86_64' |
| 103 | + run: | |
| 104 | + sudo apt-get update |
| 105 | + sudo apt-get install -y build-essential |
| 106 | +
|
| 107 | + - name: Build libdither (Linux) |
| 108 | + if: matrix.project == 'linux_x86_64' |
| 109 | + run: | |
| 110 | + make libdither |
| 111 | + shell: bash -l {0} |
| 112 | + |
| 113 | + - name: Build demo (Linux) |
| 114 | + if: matrix.project == 'linux_x86_64' |
| 115 | + run: | |
| 116 | + make demo |
| 117 | + shell: bash -l {0} |
| 118 | + |
| 119 | + - name: Run demo (Linux) |
| 120 | + if: matrix.project == 'linux_x86_64' |
| 121 | + run: | |
| 122 | + make demo_run |
| 123 | + shell: bash -l {0} |
| 124 | + |
| 125 | + - name: Build libdither (macOS) |
| 126 | + if: matrix.project == 'macos_universal' |
| 127 | + run: | |
| 128 | + make libdither_universal |
| 129 | + shell: bash |
| 130 | + |
| 131 | + - name: Build demo (macOS) |
| 132 | + if: matrix.project == 'macos_universal' |
| 133 | + run: | |
| 134 | + make demo |
| 135 | + shell: bash |
| 136 | + |
| 137 | + - name: Run demo (macOS) |
| 138 | + if: matrix.project == 'macos_universal' |
| 139 | + run: | |
| 140 | + make demo_run |
| 141 | + shell: bash |
| 142 | + |
| 143 | + - name: Cleanup (Windows MSVC) |
| 144 | + if: matrix.project == 'win64_msvc' |
| 145 | + run: | |
| 146 | + ls -la $GITHUB_WORKSPACE/dist/Release |
| 147 | + rm dist/Release/*.bmp |
| 148 | + rm dist/Release/*.png |
| 149 | + rm dist/Release/demo.* |
| 150 | + shell: bash |
| 151 | + |
| 152 | + - name: Cleanup (General) |
| 153 | + if: matrix.project != 'win64_msvc' |
| 154 | + run: | |
| 155 | + ls -la $GITHUB_WORKSPACE/dist |
| 156 | + rm dist/*.bmp |
| 157 | + rm dist/*.png |
| 158 | + rm dist/demo* |
| 159 | + shell: bash |
| 160 | + |
| 161 | + - name: Package artifacts |
| 162 | + id: pkg |
| 163 | + run: | |
| 164 | + ls -la $GITHUB_WORKSPACE/dist |
| 165 | + echo "dist_path=$GITHUB_WORKSPACE/dist" >> $GITHUB_OUTPUT |
| 166 | + shell: bash |
| 167 | + |
| 168 | + - name: Upload artifacts |
| 169 | + uses: actions/upload-artifact@v4 |
| 170 | + with: |
| 171 | + name: ditherista-${{ matrix.project }} |
| 172 | + path: ${{ steps.pkg.outputs.dist_path }} |
| 173 | + if-no-files-found: warn |
| 174 | + retention-days: 14 |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
0 commit comments