xref: /curl/.github/workflows/cygwin.yml (revision 60c3d044)
1# Copyright (C) Viktor Szakats
2#
3# SPDX-License-Identifier: curl
4
5name: Cygwin
6
7'on':
8  push:
9    branches:
10      - master
11      - '*/ci'
12    paths-ignore:
13      - '**/*.md'
14      - '.circleci/**'
15      - 'appveyor.*'
16      - 'packages/**'
17      - 'plan9/**'
18      - 'projects/**'
19      - 'winbuild/**'
20  pull_request:
21    branches:
22      - master
23    paths-ignore:
24      - '**/*.md'
25      - '.circleci/**'
26      - 'appveyor.*'
27      - 'packages/**'
28      - 'plan9/**'
29      - 'projects/**'
30      - 'winbuild/**'
31
32concurrency:
33  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
34  cancel-in-progress: true
35
36permissions: {}
37
38jobs:
39  cygwin:
40    name: "cygwin, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.platform }} ${{ matrix.name }}"
41    runs-on: windows-latest
42    timeout-minutes: 45
43    defaults:
44      run:
45        shell: C:\cygwin\bin\bash.exe '{0}'
46    env:
47      SHELLOPTS: 'igncr'
48    strategy:
49      matrix:
50        include:
51          - { build: 'automake', platform: 'x86_64', tflags: ''       , config: '--enable-debug --disable-threaded-resolver', name: 'openssl' }
52          - { build: 'cmake'   , platform: 'x86_64', tflags: 'skiprun', config: '-DCURL_USE_OPENSSL=ON', name: 'openssl R' }
53      fail-fast: false
54    steps:
55      - run: git config --global core.autocrlf input
56        shell: pwsh
57      - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
58      - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4
59        with:
60          platform: ${{ matrix.platform }}
61          site: https://mirrors.kernel.org/sourceware/cygwin/
62          # https://cygwin.com/cgi-bin2/package-grep.cgi
63          packages: >-
64            autoconf libtool gcc-core gcc-g++ binutils
65            ${{ matrix.build }} make ninja
66            openssh
67            libssl-devel
68            libssh2-devel
69            libpsl-devel
70            zlib-devel
71            libbrotli-devel
72            libnghttp2-devel
73
74      - name: 'autotools autoreconf'
75        if: ${{ matrix.build == 'automake' }}
76        timeout-minutes: 2
77        run: autoreconf -fi
78
79      - name: 'autotools configure'
80        if: ${{ matrix.build == 'automake' }}
81        timeout-minutes: 5
82        run: |
83          PATH="/usr/bin:$(cygpath "${SYSTEMROOT}")/System32"
84          mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
85            --prefix="${HOME}"/install \
86            --enable-websockets \
87            --with-openssl \
88            --with-libssh2 \
89            --disable-dependency-tracking \
90            ${{ matrix.config }}
91
92      - name: 'autotools configure log'
93        if: ${{ matrix.build == 'automake' && !cancelled() }}
94        run: cat bld/config.log 2>/dev/null || true
95
96      - name: 'curl_config.h'
97        if: ${{ matrix.build == 'automake' }}
98        run: cat bld/lib/curl_config.h | grep -F '#define' | sort || true
99
100      - name: 'curl_config.h (full)'
101        if: ${{ matrix.build == 'automake' }}
102        run: cat bld/lib/curl_config.h || true
103
104      - name: 'autotools build'
105        if: ${{ matrix.build == 'automake' }}
106        timeout-minutes: 10
107        run: make -C bld -j5 V=1 install
108
109      - name: 'curl version'
110        if: ${{ matrix.build == 'automake' }}
111        timeout-minutes: 1
112        run: |
113          find . -name '*.exe' -o -name '*.dll'
114          bld/src/curl.exe --disable --version
115
116      - name: 'autotools build tests'
117        if: ${{ matrix.build == 'automake' && matrix.tflags != 'skipall' }}
118        timeout-minutes: 15
119        run: make -C bld -j5 V=1 -C tests
120
121      - name: 'autotools run tests'
122        if: ${{ matrix.build == 'automake' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
123        timeout-minutes: 15
124        run: |
125          export TFLAGS='-j8 ${{ matrix.tflags }} ~615'
126          if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
127            TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
128          fi
129          make -C bld -j5 V=1 test-ci
130
131      - name: 'autotools build examples'
132        if: ${{ matrix.build == 'automake' }}
133        timeout-minutes: 5
134        run: make -C bld -j5 V=1 examples
135
136      - name: 'cmake configure'
137        if: ${{ matrix.build == 'cmake' }}
138        timeout-minutes: 5
139        run: |
140          PATH="/usr/bin:$(cygpath "${SYSTEMROOT}")/System32"
141          cmake -B bld -G Ninja ${options} \
142            -DCMAKE_UNITY_BUILD=ON \
143            -DCURL_WERROR=ON \
144            -DENABLE_WEBSOCKETS=ON \
145            -DCURL_BROTLI=ON \
146            ${{ matrix.config }}
147
148      - name: 'cmake configure log'
149        if: ${{ matrix.build == 'cmake' && !cancelled() }}
150        run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
151
152      - name: 'curl_config.h'
153        if: ${{ matrix.build == 'cmake' }}
154        run: cat bld/lib/curl_config.h | grep -F '#define' | sort || true
155
156      - name: 'curl_config.h (full)'
157        if: ${{ matrix.build == 'cmake' }}
158        run: cat bld/lib/curl_config.h || true
159
160      - name: 'cmake build'
161        if: ${{ matrix.build == 'cmake' }}
162        timeout-minutes: 10
163        run: cmake --build bld --config '${{ matrix.type }}' --parallel 5
164
165      - name: 'curl version'
166        if: ${{ matrix.build == 'cmake' }}
167        timeout-minutes: 1
168        run: |
169          find . -name '*.exe' -o -name '*.dll' | grep -v '/examples/'
170          PATH="$PWD/bld/lib:$PATH"
171          bld/src/curl.exe --disable --version
172
173      - name: 'cmake build tests'
174        if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skipall' }}
175        timeout-minutes: 15
176        run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
177
178      - name: 'cmake run tests'
179        if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
180        timeout-minutes: 15
181        run: |
182          export TFLAGS='-j8 ${{ matrix.tflags }} ~615'
183          if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
184            TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
185          fi
186          PATH="$PWD/bld/lib:$PATH"
187          cmake --build bld --config '${{ matrix.type }}' --target test-ci
188
189      - name: 'cmake build examples'
190        if: ${{ matrix.build == 'cmake' }}
191        timeout-minutes: 5
192        run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples
193