summaryrefslogtreecommitdiff
path: root/.github/workflows/mingw.yml
blob: d0f2af85385ef57c65be24250cd803fb7e10e6c9 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
---
name: mingw

on:
  pull_request:
    types: [opened, synchronize]
    paths-ignore:
      - '**.md'
      - '.mailmap'
      - 'ChangeLog*'
      - 'whatsnew*'
      - 'LICENSE'
  push:
    paths-ignore:
      - '**.md'
      - '.mailmap'
      - 'ChangeLog*'
      - 'whatsnew*'
      - 'LICENSE'

jobs:
  autotools:
    runs-on: windows-2019
    if: "!contains(github.event.head_commit.message, 'ci skip')"
    strategy:
      fail-fast: false
      matrix:
        EVENT_MATRIX:
          - none
          - disable-openssl
          - disable-thread-support
          - disable-debug-mode
          - disable-malloc-replacement

    steps:
      - uses: actions/checkout@v2.0.0

      - name: Cache MinGW
        id: cache-mingw
        uses: actions/cache@v1.1.2
        with:
          path: D:\a\_temp\msys
          key: windows-mingw

      - name: Cache Build
        uses: actions/cache@v1.1.2
        with:
          path: build
          key: mingw-autotools-${{ matrix.EVENT_MATRIX }}-v3

      - uses: numworks/setup-msys2@v1
        if: steps.cache-mingw.outputs.cache-hit != 'true'
        with:
          msystem: MINGW64

      - name: Install Dependes
        if: steps.cache-mingw.outputs.cache-hit != 'true'
        run: |
          msys2do pacman -S --noconfirm mingw-w64-x86_64-gcc autoconf automake libtool mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls

      - name: Build And Test
        shell: powershell
        run: |
          $env:EVENT_CONFIGURE_OPTIONS=""
          if ( "${{ matrix.EVENT_MATRIX }}" -ne "none" ) {
            $env:EVENT_CONFIGURE_OPTIONS="--${{ matrix.EVENT_MATRIX }}"
          }
          $env:EVENT_TESTS_PARALLEL=1
          $env:EVENT_BUILD_PARALLEL=10

          $script='
          export PATH="/mingw64/bin:/usr/bin:/bin:/usr/local/bin:/opt/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:$PATH"
          ./autogen.sh 2>&1 3>&1
          [[ $? -ne 0 ]] && exit 1
          mkdir -p build
          cd build
          [[ $? -ne 0 ]] && exit 1
          LDFLAGS="-L/mingw64/lib" CFLAGS="-I/mingw64/include" ../configure $EVENT_CONFIGURE_OPTIONS 2>&1
          [[ $? -ne 0 ]] && exit 1
          make -j $EVENT_BUILD_PARALLEL 2>&1
          [[ $? -ne 0 ]] && exit 1
          make verify -j $EVENT_TESTS_PARALLEL 2>&1 '
          D:\a\_temp\msys\msys64\usr\bin\bash.exe -c $script

      - uses: actions/upload-artifact@v1
        if: failure()
        with:
          name: mingw-${{ matrix.EVENT_MATRIX }}-build
          path: build

  cmake:
    runs-on: windows-2019
    if: "!contains(github.event.head_commit.message, 'ci skip')"
    strategy:
      fail-fast: false
      matrix:
        EVENT_MATRIX:
          - NONE
          - DISABLE_OPENSSL
          - DISABLE_THREAD_SUPPORT
          - DISABLE_DEBUG_MODE
          - DISABLE_MM_REPLACEMENT

    steps:
      - uses: actions/checkout@v2.0.0

      - name: Cache MinGW
        id: cache-mingw-cmake
        uses: actions/cache@v1.1.2
        with:
          path: D:\a\_temp\msys
          key: windows-mingw-cmake

      - name: Cache Build
        uses: actions/cache@v1.1.2
        with:
          path: build
          key: mingw-cmake-${{ matrix.EVENT_MATRIX }}-v3

      - uses: numworks/setup-msys2@v1
        if: steps.cache-mingw-cmake.outputs.cache-hit != 'true'
        with:
          msystem: MINGW64

      - name: Install Dependes
        if: steps.cache-mingw-cmake.outputs.cache-hit != 'true'
        run: |
          msys2do pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls

      - name: Build And Test
        shell: powershell
        run: |
          $EVENT_CONFIGURE_OPTIONS=""
          if ( "${{ matrix.EVENT_MATRIX }}" -ne "NONE" ) {
            $EVENT_CONFIGURE_OPTIONS="-DEVENT__${{ matrix.EVENT_MATRIX }}=ON"
          }
          $env:PATH="D:\a\_temp\msys\msys64\mingw64\bin;D:\a\_temp\msys\msys64\usr\bin;$env:PATH"
          mkdir build -ea 0
          cd build
          function cmake_configure($retry)
          {
            $errcode=0
            try {
              cmake .. -G "MSYS Makefiles" $EVENT_CONFIGURE_OPTIONS -DCMAKE_C_FLAGS=-w
              $errcode=$LastExitCode
            }
            catch {
              $errcode=1
            }
            finally {
              if ($errcode -ne 0) {
                if ($retry -eq 0) {
                  $host.SetShouldExit($LastExitCode)
                } else {
                  echo "Remove all entries in build directory"
                  rm -r -fo *
                  cmake_configure 0
                }
              }
            }
          }
          cmake_configure 1
          cmake --build .
          ctest -V

      - uses: actions/upload-artifact@v1
        if: failure()
        with:
          name: mingw-${{ matrix.EVENT_MATRIX }}-build
          path: build