Skip to content

Commit f4a3df1

Browse files
committed
Shorten CI by using matrix
1 parent ab559d1 commit f4a3df1

File tree

1 file changed

+24
-198
lines changed

1 file changed

+24
-198
lines changed

.github/workflows/github-CI-Windows.yml

Lines changed: 24 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ jobs:
1010
matrix:
1111
#os: [ubuntu-latest, windows-latest] # run native test
1212
bits: [32, 64]
13+
ftype: [shared-full, static-lite]
1314
fail-fast: false
1415
# https://github.com/actions/virtual-environments
15-
name: mingw${{matrix.bits}}-wintls-winhashes-shared-full
16+
name: mingw${{matrix.bits}}-wintls-winhashes-${{matrix.ftype}}
1617
runs-on: windows-latest
1718
env:
1819
mingw: mingw${{matrix.bits}}
19-
build_type: wintls-winhashes-shared-full
20+
build_type: wintls-winhashes-${{matrix.ftype}}
2021
defaults:
2122
run:
2223
shell: msys2 {0}
@@ -102,222 +103,47 @@ jobs:
102103
# wget => gnulib_po => gnulib/build-aux/po/Makefile.in.in, po/Makefile.in.in from MSYS2 gettext
103104
- name: Generate configure
104105
run: |
105-
loc_ver=$(gettext -V | sed -n "s/gettext[^[:digit:]]\+\([0-9]\+\.[0-9]\+\).*/\1/p")
106+
loc_ver=$(gettext -V | sed -n "s/gettext[^0-9]\+\([0-9.]\+\).*/\1/p")
106107
req_ver=$(sed -n "s/^\gettext\s\+\([0-9.]\+\)$/\1/mp" bootstrap.conf)
107108
if [ -n "${req_ver}" ] && [ ${loc_ver} \< ${req_ver} ]; then
108-
echo "gettext: bootstrap.conf requires "${req_ver}", local is "${loc_ver}
109+
echo "Reset gettext version: bootstrap.conf requires "${req_ver}", local is "${loc_ver}
109110
sed -i "s/^\(gettext\s\+\)[0-9.]\+$/\1${loc_ver}/gm" bootstrap.conf
110111
fi
111112
req_ver=$(sed -n "s/^AM_GNU_GETTEXT_VERSION(\[\([0-9.]\+\)\])$/\1/mp" configure.ac)
112113
if [ -n "${req_ver}" ] && [ ${loc_ver} \< ${req_ver} ]; then
113-
echo "gettext: configure.ac requires "${req_ver}", local is "${loc_ver}
114+
echo "Reset gettext version: configure.ac requires "${req_ver}", local is "${loc_ver}
114115
sed -i "s/^\(AM_GNU_GETTEXT_VERSION(\[\)[0-9.]\+\(\])\)$/\1${loc_ver}\2/gm" configure.ac
115116
fi
116117
./bootstrap --skip-po
117118
sed -i "s/-dirty\b//p" configure
118119
119120
# -->
120-
- name: Install extra c-ares
121-
run: |
122-
wget https://github.com/c-ares/c-ares/releases/download/cares-1_17_1/c-ares-1.17.1.tar.gz
123-
tar -xvzf c-ares-1.17.1.tar.gz
124-
cd c-ares-1.17.1
125-
./configure --disable-tests
126-
make install
127-
128-
- name: configure
129-
run: |
130-
mkdir -p $BDir
131-
mkdir -p $CDir
132-
cd $CDir
133-
pwd
134-
$BRoot/configure --prefix=$BDir --disable-rpath --with-cares --with-winidn --enable-threads=windows CPPFLAGS=-D_WIN32_WINNT=0x0600
135-
# <--
136-
137-
# gnulib_po gettext requires gettext version 0.20 higher than MSYS2 has!
138-
- name: Build
139-
run: |
140-
cd $CDir
141-
echo -e "all:\n\n" > gnulib_po/Makefile
142-
make
143-
144-
- name: Show compiled wget info
145-
run: |
146-
ls -l $CDir/src/wget.exe
147-
$CDir/src/wget -V
148-
149-
- name: fuzz
150-
run: |
151-
cd $CDir/fuzz
152-
make check
153-
154-
- name: testenv
155-
if: ${{success()}} || ${{failure()}}
156-
run: |
157-
cd $CDir/testenv
158-
make check
159-
timeout-minutes: 5 # in case of stuck
160-
161-
- name: tests
162-
if: ${{success()}} || ${{failure()}}
163-
run: |
164-
cd $CDir/tests
165-
make check
166-
timeout-minutes: 5 # in case of stuck
167-
168-
- name: Upload wget
169-
uses: actions/upload-artifact@v2
170-
if: ${{success()}} || ${{failure()}}
171-
with:
172-
name: wget-${{env.mingw}}-${{env.build_type}}
173-
path: |
174-
build/${{env.build_type}}/${{env.mingw}}-config/src/wget.exe
175-
176-
- name: Upload test logs
177-
uses: actions/upload-artifact@v2
178-
if: ${{failure()}}
179-
with:
180-
name: wget-${{env.mingw}}-${{env.build_type}}-logs
181-
# Can be stuck, and then timeout, so all `.log` files and sub-folders.
182-
path: |
183-
build/${{env.build_type}}/${{env.mingw}}-config/fuzz/*.log
184-
build/${{env.build_type}}/${{env.mingw}}-config/testenv/
185-
build/${{env.build_type}}/${{env.mingw}}-config/tests/*.log
186-
build/${{env.build_type}}/${{env.mingw}}-config/tests/Makefile
187-
build/${{env.build_type}}/${{env.mingw}}-config/tests/**/
188-
!build/${{env.build_type}}/${{env.mingw}}-config/tests/.deps/
189-
!build/${{env.build_type}}/${{env.mingw}}-config/tests/*.exe
190-
!build/${{env.build_type}}/${{env.mingw}}-config/tests/*.o
191-
192-
193-
# Customize the env and configure args
194-
build-lite:
195-
# https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
196-
strategy:
197-
matrix:
198-
#os: [ubuntu-latest, windows-latest] # test
199-
bits: [32, 64]
200-
fail-fast: false
201-
# https://github.com/actions/virtual-environments
202-
name: mingw${{matrix.bits}}-wintls-winhashes-static-lite
203-
runs-on: windows-latest
204-
env:
205-
mingw: mingw${{matrix.bits}}
206-
build_type: wintls-winhashes-static-lite
207-
defaults:
208-
run:
209-
shell: msys2 {0}
210-
steps:
211-
- name: Set up ENVs for MSYS2 to inherit
212-
shell: bash
213-
run: |
214-
case $mingw in
215-
mingw32) arch="i686" ;;
216-
mingw64) arch="x86_64" ;;
217-
*) exit 1 ;;
218-
esac
219-
#ORIGINAL_PATH="/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/Git/cmd"
220-
BRoot="$PWD"
221-
BDir="$BRoot/build/${build_type}/$mingw"
222-
CDir="${BDir}-config"
223-
echo arch="$arch" >> $GITHUB_ENV
224-
#echo ORIGINAL_PATH="$ORIGINAL_PATH" >> $GITHUB_ENV
225-
echo BRoot="$BRoot" >> $GITHUB_ENV
226-
echo BDir="$BDir" >> $GITHUB_ENV
227-
echo CDir="$CDir" >> $GITHUB_ENV
228-
229-
# https://github.com/msys2/setup-msys2
230-
- name: Set up MSYS2
231-
uses: msys2/setup-msys2@v2
232-
with:
233-
msystem: ${{env.mingw}}
234-
release: false
235-
#path-type: inherit
236-
# `AX_CODE_COVERAGE` requires autoconf-archive: https://github.com/google/oss-fuzz/pull/5379/files
237-
# gpgme for metalink, but depends on many others, that's not preferred on windows
238-
# gettext for NLS, expat for metalink, libidn2 and libunistring for libpsl
239-
install: >-
240-
autoconf-archive
241-
mingw-w64-${{env.arch}}-libmetalink
242-
mingw-w64-${{env.arch}}-expat
243-
mingw-w64-${{env.arch}}-gpgme
244-
mingw-w64-${{env.arch}}-libpsl
245-
mingw-w64-${{env.arch}}-libidn2
246-
mingw-w64-${{env.arch}}-libunistring
247-
mingw-w64-${{env.arch}}-gettext
248-
git
249-
python
250-
251-
# In here, test requires linux flavor python!
252-
- name: Hack python
253-
run: |
254-
python -V
255-
python -c "import sys; print(sys.executable)"
256-
python3 -V
257-
python3 -c "import sys; print(sys.executable)"
258-
rm /$mingw/bin/python* 2>/dev/null
259-
#pacman -R -dd --noconfirm mingw-w64-${{env.arch}}-python 2>/dev/null
260-
261-
# MinGW-w64 pre-installed
262-
- name: Show setup result
263-
run: |
264-
echo "ls /"
265-
ls /
266-
echo "bash --version"
267-
bash --version
268-
echo "gcc -v"
269-
gcc -v
270-
git --version
271-
python -V
272-
python -c "import sys; print(sys.executable)"
273-
python3 -V
274-
python3 -c "import sys; print(sys.executable)"
275-
pwd
276-
echo "PATH"
277-
echo "$PATH"
278-
echo "$BRoot"
279-
echo "$BDir"
280-
echo "$CDir"
281-
282-
- uses: actions/checkout@v2
283-
# Shallow fetch makes version unknown: git describe --abbrev=4 --match="$prefix*" HEAD
284-
with:
285-
fetch-depth: 0
286-
287-
# gettext-0.20 issue: https://github.com/coreutils/gnulib/blob/master/build-aux/po/Makefile.in.in#L11
288-
# gettext and gettext-devel v0.20 is not available on MSYS2
289-
# wget => gnulib_po => gnulib/build-aux/po/Makefile.in.in, po/Makefile.in.in from MSYS2 gettext
290-
- name: Generate configure
291-
run: |
292-
loc_ver=$(gettext -V | sed -n "s/gettext[^[:digit:]]\+\([0-9]\+\.[0-9]\+\).*/\1/p")
293-
req_ver=$(sed -n "s/^\gettext\s\+\([0-9.]\+\)$/\1/mp" bootstrap.conf)
294-
if [ -n "${req_ver}" ] && [ ${loc_ver} \< ${req_ver} ]; then
295-
echo "gettext: bootstrap.conf requires "${req_ver}", local is "${loc_ver}
296-
sed -i "s/^\(gettext\s\+\)[0-9.]\+$/\1${loc_ver}/gm" bootstrap.conf
121+
- name: Install extra dependencies
122+
run: |
123+
if [ "${{matrix.ftype}}" = "shared-full" ]; then
124+
wget https://github.com/c-ares/c-ares/releases/download/cares-1_17_1/c-ares-1.17.1.tar.gz
125+
tar -xvzf c-ares-1.17.1.tar.gz
126+
cd c-ares-1.17.1
127+
./configure --disable-tests
128+
make install
129+
elif [ "${{matrix.ftype}}" = "static-lite" ]; then
130+
wget https://github.com/win-iconv/win-iconv/archive/refs/tags/v0.0.8.tar.gz
131+
tar -xvzf v0.0.8.tar.gz
132+
cd win-iconv-0.0.8
133+
make -E CFLAGS=-Os -E prefix=/$mingw install
297134
fi
298-
req_ver=$(sed -n "s/^AM_GNU_GETTEXT_VERSION(\[\([0-9.]\+\)\])$/\1/mp" configure.ac)
299-
if [ -n "${req_ver}" ] && [ ${loc_ver} \< ${req_ver} ]; then
300-
echo "gettext: configure.ac requires "${req_ver}", local is "${loc_ver}
301-
sed -i "s/^\(AM_GNU_GETTEXT_VERSION(\[\)[0-9.]\+\(\])\)$/\1${loc_ver}\2/gm" configure.ac
302-
fi
303-
./bootstrap --skip-po
304-
sed -i "s/-dirty\b//p" configure
305-
306-
# -->
307-
- name: Install win-iconv instead
308-
run: |
309-
wget https://github.com/win-iconv/win-iconv/archive/refs/tags/v0.0.8.tar.gz
310-
tar -xvzf v0.0.8.tar.gz
311-
cd win-iconv-0.0.8
312-
make -E CFLAGS=-Os -E prefix=/$mingw install
313135
314136
- name: configure
315137
run: |
316138
mkdir -p $BDir
317139
mkdir -p $CDir
318140
cd $CDir
319141
pwd
320-
$BRoot/configure --prefix=$BDir --disable-debug --disable-rpath --disable-nls --without-libpsl --without-metalink --disable-pcre --with-winidn --enable-threads=windows CFLAGS=-Os 'LDFLAGS=-static -s' CPPFLAGS=-D_WIN32_WINNT=0x0600
142+
if [ "${{matrix.ftype}}" = "shared-full" ]; then
143+
$BRoot/configure --prefix=$BDir --disable-rpath --with-cares --with-winidn --enable-threads=windows CPPFLAGS=-D_WIN32_WINNT=0x0600
144+
elif [ "${{matrix.ftype}}" = "static-lite" ]; then
145+
$BRoot/configure --prefix=$BDir --disable-debug --disable-rpath --disable-nls --without-libpsl --without-metalink --disable-pcre --with-winidn --enable-threads=windows CFLAGS=-Os 'LDFLAGS=-static -s' CPPFLAGS=-D_WIN32_WINNT=0x0600
146+
fi
321147
# <--
322148

323149
# gnulib_po gettext requires gettext version 0.20 higher than MSYS2 has!

0 commit comments

Comments
 (0)