• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) Viktor Szakats
2#
3# SPDX-License-Identifier: curl
4
5name: windows
6
7on:
8  push:
9    branches:
10      - master
11      - '*/ci'
12    paths-ignore:
13      - '**/*.md'
14      - '.azure-pipelines.yml'
15      - '.circleci/**'
16      - '.cirrus.yml'
17      - 'appveyor.*'
18      - 'packages/**'
19      - 'plan9/**'
20      - 'projects/**'
21      - 'winbuild/**'
22  pull_request:
23    branches:
24      - master
25    paths-ignore:
26      - '**/*.md'
27      - '.azure-pipelines.yml'
28      - '.circleci/**'
29      - '.cirrus.yml'
30      - 'appveyor.*'
31      - 'packages/**'
32      - 'plan9/**'
33      - 'projects/**'
34      - 'winbuild/**'
35
36concurrency:
37  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
38  cancel-in-progress: true
39
40permissions: {}
41
42jobs:
43  cygwin:
44    name: "cygwin (${{ matrix.build }}, ${{ matrix.platform }}, ${{ matrix.config }})"
45    runs-on: windows-latest
46    timeout-minutes: 45
47    env:
48      SHELLOPTS: 'igncr'
49    strategy:
50      matrix:
51        include:
52          - { build: 'automake', platform: 'x86_64', tflags: '', config: '--enable-debug --disable-threaded-resolver' }
53          - { build: 'cmake'   , platform: 'x86_64', tflags: '', config: '-DCURL_USE_OPENSSL=ON' }
54      fail-fast: false
55    steps:
56      - run: git config --global core.autocrlf input
57      - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
58      - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4
59        with:
60          platform: ${{ matrix.platform }}
61          # https://cygwin.com/cgi-bin2/package-grep.cgi
62          packages: autoconf libtool ${{ matrix.build }} gcc-core gcc-g++ binutils make libssl-devel zlib-devel libbrotli-devel libnghttp2-devel libpsl-devel libssh2-devel
63          site: https://mirrors.kernel.org/sourceware/cygwin/
64
65      - name: 'autotools configure'
66        if: ${{ matrix.build == 'automake' }}
67        timeout-minutes: 5
68        shell: C:\cygwin\bin\bash.exe '{0}'
69        run: |
70          export PATH="/usr/bin:$(cygpath ${SYSTEMROOT})/system32"
71          autoreconf -fi
72          mkdir bld && cd bld && ../configure --enable-warnings --enable-werror \
73            --prefix="${HOME}"/install \
74            --enable-websockets \
75            --with-openssl \
76            --with-libssh2 \
77            ${{ matrix.config }} || { tail -n 1200 config.log; false; }
78
79      - name: 'autotools build'
80        if: ${{ matrix.build == 'automake' }}
81        timeout-minutes: 10
82        shell: C:\cygwin\bin\bash.exe '{0}'
83        run: |
84          make -C bld -j3 V=1 install
85          find . -name '*.exe' -o -name '*.dll'
86          bld/src/curl.exe --disable --version
87
88      - name: 'autotools build examples'
89        if: ${{ matrix.build == 'automake' }}
90        timeout-minutes: 5
91        shell: C:\cygwin\bin\bash.exe '{0}'
92        run: |
93          make -C bld -j3 V=1 examples
94
95      - name: 'autotools build tests'
96        if: ${{ matrix.build == 'automake' }}
97        timeout-minutes: 10
98        shell: C:\cygwin\bin\bash.exe '{0}'
99        run: |
100          make -C bld -j3 -C tests V=1
101
102      - name: 'autotools run tests'
103        if: ${{ matrix.build == 'automake' && matrix.tflags != 'skip' }}
104        timeout-minutes: 40
105        shell: C:\cygwin\bin\bash.exe '{0}'
106        run: |
107          export TFLAGS='-j8 ${{ matrix.tflags }}'
108          if [ -x "$(cygpath -u "${SYSTEMROOT}/System32/curl.exe")" ]; then
109            TFLAGS+=" -ac $(cygpath -u "${SYSTEMROOT}/System32/curl.exe")"
110          fi
111          make -C bld -j3 V=1 test-ci
112
113      - name: 'cmake configure'
114        if: ${{ matrix.build == 'cmake' }}
115        timeout-minutes: 5
116        shell: C:\cygwin\bin\bash.exe '{0}'
117        run: |
118          export PATH="/usr/bin:$(cygpath ${SYSTEMROOT})/system32"
119          cmake -B bld ${options} ${{ matrix.config }} \
120            "-DCMAKE_C_FLAGS=${cflags}" \
121            -DCMAKE_UNITY_BUILD=ON \
122            -DCURL_WERROR=ON \
123            -DBUILD_EXAMPLES=ON \
124            -DENABLE_WEBSOCKETS=ON \
125            -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON
126
127      - name: 'cmake build'
128        if: ${{ matrix.build == 'cmake' }}
129        timeout-minutes: 10
130        shell: C:\cygwin\bin\bash.exe '{0}'
131        run: |
132          cmake --build bld --config '${{ matrix.type }}' --parallel 3
133          [[ '${{ matrix.config }}' != *'BUILD_SHARED_LIBS=OFF'* ]] && cp -f -p bld/lib/*.dll bld/src/
134          find . -name '*.exe' -o -name '*.dll'
135          bld/src/curl.exe --disable --version
136
137  msys2:
138    name: "msys2 (${{ matrix.build }}, ${{ matrix.sys }}, ${{ matrix.env }}, ${{ matrix.config }})"
139    runs-on: windows-latest
140    timeout-minutes: 45
141    strategy:
142      matrix:
143        include:
144          - { build: 'autotools', sys: 'msys'   , env: 'x86_64'      , tflags: '!19                !1233', config: '--enable-debug --disable-threaded-resolver --disable-proxy' }
145          - { build: 'autotools', sys: 'msys'   , env: 'x86_64'      , tflags: '!19 !504 !704 !705 !1233', config: '--enable-debug --disable-threaded-resolver' }
146          - { build: 'autotools', sys: 'msys'   , env: 'x86_64'      , tflags: '!19 !504 !704 !705 !1233', config: '' }
147          # FIXME: WebSockets test results ignored due to frequent failures on native Windows:
148          - { build: 'cmake'    , sys: 'mingw64', env: 'x86_64'      , tflags: '!TFTP ~2301 ~2302'       , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Debug' }
149          - { build: 'cmake'    , sys: 'mingw64', env: 'x86_64'      , tflags: 'skip'                    , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Release' }
150          - { build: 'cmake'    , sys: 'clang64', env: 'clang-x86_64', tflags: 'skip'                    , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON -DENABLE_UNICODE=OFF', type: 'Release' }
151      fail-fast: false
152    steps:
153      - run: git config --global core.autocrlf input
154      - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
155      - uses: msys2/setup-msys2@d0e80f58dffbc64f6a3a1f43527d469b4fc7b6c8 # v2
156        if: ${{ matrix.sys == 'msys' }}
157        with:
158          msystem: ${{ matrix.sys }}
159          # https://packages.msys2.org/search
160          install: gcc ${{ matrix.build }} make openssl-devel zlib-devel brotli-devel libnghttp2-devel libpsl-devel libssh2-devel
161      - uses: msys2/setup-msys2@d0e80f58dffbc64f6a3a1f43527d469b4fc7b6c8 # v2
162        if: ${{ matrix.sys != 'msys' }}
163        with:
164          msystem: ${{ matrix.sys }}
165          install: >-
166            mingw-w64-${{ matrix.env }}-cc
167            mingw-w64-${{ matrix.env }}-${{ matrix.build }} make
168            mingw-w64-${{ matrix.env }}-openssl
169
170      - name: 'autotools configure'
171        if: ${{ matrix.build == 'autotools' }}
172        timeout-minutes: 5
173        shell: msys2 {0}
174        run: |
175          autoreconf -fi
176          mkdir bld && cd bld && ../configure --enable-warnings --enable-werror \
177            --prefix="${HOME}"/install \
178            --enable-websockets \
179            --with-openssl \
180            --with-libssh2 \
181            ${{ matrix.config }} || { tail -n 1200 config.log; false; }
182
183      - name: 'autotools build'
184        if: ${{ matrix.build == 'autotools' }}
185        timeout-minutes: 10
186        shell: msys2 {0}
187        run: |
188          make -C bld -j3 V=1 install
189          find . -name '*.exe' -o -name '*.dll'
190          bld/src/curl.exe --disable --version
191
192      - name: 'autotools build examples'
193        if: ${{ matrix.build == 'autotools' }}
194        timeout-minutes: 5
195        shell: msys2 {0}
196        run: |
197          make -C bld -j3 V=1 examples
198
199      - name: 'autotools build tests'
200        if: ${{ matrix.build == 'autotools' }}
201        timeout-minutes: 10
202        shell: msys2 {0}
203        run: |
204          make -C bld -j3 -C tests V=1
205
206      - name: 'autotools run tests'
207        if: ${{ matrix.build == 'autotools' && matrix.tflags != 'skip' }}
208        timeout-minutes: 30
209        shell: msys2 {0}
210        run: |
211          export TFLAGS='-j14 ${{ matrix.tflags }}'
212          if [ -x "$(cygpath -u 'C:/msys64/usr/bin/curl.exe')" ]; then
213            TFLAGS+=" -ac $(cygpath -u 'C:/msys64/usr/bin/curl.exe')"
214          fi
215          make -C bld -j3 V=1 test-ci
216
217      - name: 'cmake configure'
218        if: ${{ matrix.build == 'cmake' }}
219        timeout-minutes: 5
220        shell: msys2 {0}
221        run: |
222          if [[ '${{ matrix.env }}' = 'clang'* ]]; then
223            options='-DCMAKE_C_COMPILER=clang'
224          else
225            options='-DCMAKE_C_COMPILER=gcc'
226          fi
227          cflags='-Wno-deprecated-declarations'
228          if [ '${{ matrix.test }}' = 'uwp' ]; then
229            options+=' -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0'
230            pacman --noconfirm --ask 20 --noprogressbar --sync --needed 'mingw-w64-${{ matrix.env }}-winstorecompat-git'
231            specs="$(realpath gcc-specs-uwp)"
232            gcc -dumpspecs | sed -e 's/-lmingwex/-lwindowsapp -lmingwex -lwindowsapp -lwindowsappcompat/' -e 's/-lmsvcrt/-lmsvcr120_app/' > "${specs}"
233            cflags+=" -specs=${specs} -DWINSTORECOMPAT -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
234            # CMake (as of v3.26.4) gets confused and applies the MSVC rc.exe command-line
235            # template to windres. Reset it to the windres template manually:
236            rcopts='<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>'
237          else
238            rcopts=''
239          fi
240          [ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
241          [ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
242          [ '${{ matrix.type }}' = 'Release' ] && [[ '${{ matrix.config }}' = *'ENABLE_DEBUG=ON'* ]] && cflags+=' -DDEBUGBUILD'
243          cmake -B bld ${options} ${{ matrix.config }} \
244            "-DCMAKE_C_FLAGS=${cflags}" \
245            "-DCMAKE_RC_COMPILE_OBJECT=${rcopts}" \
246            "-DCMAKE_BUILD_TYPE=${{ matrix.type }}" \
247            -DCMAKE_UNITY_BUILD=ON \
248            -DCURL_WERROR=ON \
249            -DBUILD_EXAMPLES=ON \
250            -DENABLE_WEBSOCKETS=ON \
251            -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON
252
253      - name: 'cmake build'
254        if: ${{ matrix.build == 'cmake' }}
255        timeout-minutes: 10
256        shell: msys2 {0}
257        run: |
258          cmake --build bld --config '${{ matrix.type }}' --parallel 3
259          [[ '${{ matrix.config }}' != *'BUILD_SHARED_LIBS=OFF'* ]] && cp -f -p bld/lib/*.dll bld/src/
260          find . -name '*.exe' -o -name '*.dll'
261          bld/src/curl.exe --disable --version
262
263      - name: 'cmake build tests'
264        if: ${{ matrix.build == 'cmake' }}
265        timeout-minutes: 10
266        shell: msys2 {0}
267        run: |
268          cmake --build bld --config '${{ matrix.type }}' --parallel 3 --target testdeps
269
270      - name: 'cmake run tests'
271        if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skip' }}
272        timeout-minutes: 40
273        shell: msys2 {0}
274        run: |
275          export TFLAGS='-j14 ${{ matrix.tflags }}'
276          if [ -x "$(cygpath -u 'C:/msys64/usr/bin/curl.exe')" ]; then
277            TFLAGS+=" -ac $(cygpath -u 'C:/msys64/usr/bin/curl.exe')"
278          fi
279          ls bld/lib/*.dll >/dev/null 2>&1 && cp -f -p bld/lib/*.dll bld/tests/libtest/
280          cmake --build bld --config '${{ matrix.type }}' --target test-ci
281