| # This workflow generates artifacts such as avifenc.exe and avifdec.exe for convenience. |
| |
| name: CI Windows Artifacts |
| on: |
| release: |
| types: [created] |
| |
| permissions: |
| contents: write |
| |
| jobs: |
| build-windows-artifacts: |
| runs-on: ${{ matrix.os }} |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [windows-latest] |
| |
| steps: |
| - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 |
| - name: Setup Visual Studio shell |
| if: runner.os == 'Windows' |
| uses: egor-tensin/vs-shell@9a932a62d05192eae18ca370155cf877eecc2202 # v2.1 |
| - name: Cache external dependencies |
| id: cache-ext |
| uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 |
| with: |
| path: ext, build/_deps |
| key: ${{ runner.os }}-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}-releasedeps |
| - name: Print cmake version |
| run: cmake --version |
| - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 |
| - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 |
| - run: pip install meson |
| - name: Build aom |
| if: steps.cache-ext.outputs.cache-hit != 'true' |
| working-directory: ./ext |
| run: ./aom.cmd |
| # Visual Studio 2022 has an issue starting at 17.8.0 which might cause |
| # AVX-512 instructions to be emitted in non-AVX-512 code. See |
| # https://github.com/AOMediaCodec/libavif/issues/2033#issuecomment-1960062751. |
| env: |
| CC: clang-cl |
| CXX: clang-cl |
| - name: Build dav1d |
| if: steps.cache-ext.outputs.cache-hit != 'true' |
| working-directory: ./ext |
| run: ./dav1d.cmd |
| - name: Build libyuv |
| if: steps.cache-ext.outputs.cache-hit != 'true' |
| working-directory: ./ext |
| run: ./libyuv.cmd |
| # Use clang-cl to build libyuv. The assembly code in libyuv is written in the |
| # GCC inline assembly format. Visual C++ doesn't support GCC inline assembly. |
| env: |
| CC: clang-cl |
| CXX: clang-cl |
| - name: Build libsharpyuv |
| if: steps.cache-ext.outputs.cache-hit != 'true' |
| working-directory: ./ext |
| run: ./libsharpyuv.cmd |
| - name: Build libjpeg |
| if: steps.cache-ext.outputs.cache-hit != 'true' |
| working-directory: ./ext |
| run: ./libjpeg.cmd |
| - name: Build zlib and libpng |
| if: steps.cache-ext.outputs.cache-hit != 'true' |
| working-directory: ./ext |
| run: ./zlibpng.cmd |
| |
| - name: Prepare libavif (cmake) |
| run: > |
| cmake -G Ninja -S ./ -B build |
| -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF |
| -DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_AOM_ENCODE=ON |
| -DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_DAV1D=LOCAL |
| -DAVIF_LIBYUV=LOCAL -DAVIF_LIBSHARPYUV=LOCAL |
| -DAVIF_JPEG=LOCAL -DAVIF_ZLIBPNG=LOCAL |
| -DAVIF_BUILD_EXAMPLES=OFF -DAVIF_BUILD_APPS=ON |
| -DAVIF_BUILD_TESTS=OFF -DAVIF_ENABLE_WERROR=ON |
| - name: Build libavif (ninja) |
| working-directory: ./build |
| run: ninja |
| - name: Archive artifacts |
| uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # 0.7.6 |
| with: |
| type: 'zip' |
| filename: 'windows-artifacts.zip' |
| directory: 'build' |
| path: '*.exe' |
| - name: Upload artifacts |
| uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| with: |
| # See https://docs.github.com/en/webhooks/webhook-events-and-payloads#release. |
| upload_url: ${{ github.event.release.upload_url }} |
| asset_path: build/windows-artifacts.zip |
| asset_name: windows-artifacts.zip |
| asset_content_type: application/zip |