summaryrefslogtreecommitdiff
path: root/.github/workflows/ci_windows.yml
blob: affcf7248f914073df3a1404647d6b0bb8096122 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: CI Windows

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

env:
  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  BUILD_TYPE: RELWITHDEBINFO

jobs:
  CI:
    runs-on: windows-latest
    strategy:
          matrix:
            arch:
              - x64
              - x86
              - amd64_arm64
    name: ${{ matrix.arch }}
    defaults:
      run:
        shell: cmd

    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - uses: ilammy/msvc-dev-cmd@v1
        with:
          arch: ${{ matrix.arch }}

      - name: Install Dependencies
        run: |
          curl -o ${{ matrix.arch }}-windows.7z  https://raw.githubusercontent.com/libgd/libgd-windows-vcpkg-prebuild/main/${{matrix.arch}}-windows.7z
          7z.exe x ${{ matrix.arch }}-windows.7z -o${{github.workspace}}\vcpkgusr

      - name: Configure CMake
        # vcpkg libde265 fails on arm64 and match prefix
        if: matrix.arch == 'amd64_arm64'
        run:  cmake -D CMAKE_GENERATOR="NMake Makefiles" -DENABLE_PNG=1 -DENABLE_FREETYPE=1 -DENABLE_JPEG=1
              -DENABLE_GD_FORMATS=1 -DENABLE_TIFF=1 -DBUILD_TEST=1
              -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
              -DCMAKE_LIBRARY_PATH=${{github.workspace}}\vcpkgusr\arm64-windows\lib
              -DCMAKE_INCLUDE_PATH=${{github.workspace}}\vcpkgusr\arm64-windows\include

      - name: Configure CMake
        if: matrix.arch != 'amd64_arm64'
        run:  cmake -D CMAKE_GENERATOR="NMake Makefiles" -DENABLE_PNG=1 -DENABLE_FREETYPE=1 -DENABLE_JPEG=1
               -DENABLE_GD_FORMATS=1 -DENABLE_TIFF=1 -DENABLE_HEIF=1
              -DBUILD_TEST=1 -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
              -DCMAKE_LIBRARY_PATH=${{github.workspace}}\vcpkgusr\${{ matrix.arch }}-windows\lib
              -DCMAKE_INCLUDE_PATH=${{github.workspace}}\vcpkgusr\${{ matrix.arch }}-windows\include

      - name: Build
        run: |
         cd ${{github.workspace}}/build
         nmake

      - name: Tests
        working-directory: ${{github.workspace}}/build
        # skip test for cross builds
        if: matrix.arch != 'amd64_arm64'
        run: |
          echo ${{runner.temp}}
          echo %TMP%
          echo %TEMP%
          set PATH=${{github.workspace}}\vcpkgusr\${{ matrix.arch }}-windows\bin;%PATH%
          set CTEST_OUTPUT_ON_FAILURE=1
          nmake test