This patch cleans up the Windows CI to look more similar to the refactored
Linux CI on GitHub Actions.

It switches the environment set-up from some manual cygwin setup via choco to
the msys2/setup-msys2@v2 action which just works and allows later steps to look
like any others without need to manually specify the shell.

This new setup is much faster than before where a single Windows build required
more than 10 minutes with more than 5 minutes just spent setting up the
environment and more than 6 minutes compiling HAProxy.

With this patch the setting of of the environment is done in less than a minute
and HAProxy is compiled in less than 2 minutes.

The only drawback is that Lua does not appear to be readily available. I expect
this to be acceptable and that the benefits far outweight this small drawback.
---
 .github/workflows/windows-latest.yml | 20 ----------
 .github/workflows/windows.yml        | 60 ++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 20 deletions(-)
 delete mode 100644 .github/workflows/windows-latest.yml
 create mode 100644 .github/workflows/windows.yml

diff --git a/.github/workflows/windows-latest.yml 
b/.github/workflows/windows-latest.yml
deleted file mode 100644
index 445e021a4..000000000
--- a/.github/workflows/windows-latest.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-# build status appears on https://github.com/haproxy/haproxy/actions
-
-name: windows-latest
-
-on: [push]
-
-jobs:
-  cygwin:
-
-    runs-on: windows-latest
-
-    steps:
-    - uses: actions/checkout@v1
-    - name: install prerequisites
-      run: choco install bash make libssl-devel cygwin-devel gcc-core libgcc1 
binutils lua-devel libpcre-devel zlib-devel --source cygwin
-    - name: fake step
-      run: C:\\tools\\cygwin\\bin\\bash -lc 'pwd'
-    - name: build
-      run: C:\\tools\\cygwin\\bin\\bash -lc 'cd $OLDPWD && make TARGET=cygwin 
ERR=1 USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_LUA=1 USE_OPENSSL=1 USE_THREAD=1 
&& ./haproxy -vv'
-
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
new file mode 100644
index 000000000..5393a4c3a
--- /dev/null
+++ b/.github/workflows/windows.yml
@@ -0,0 +1,60 @@
+# Copyright 2019 Ilya Shipitsin <chipits...@gmail.com>
+# Copyright 2020 Tim Duesterhus <t...@bastelstu.be>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+
+name: Windows
+
+on:
+  push:
+
+jobs:
+  msys2:
+    name: ${{ matrix.name }}
+    runs-on: ${{ matrix.os }}
+    defaults:
+      run:
+        shell: msys2 {0}
+    strategy:
+      matrix:
+        include:
+        - name: "Windows, gcc, all features"
+          TARGET: cygwin
+          CC: gcc
+          os: windows-latest
+          FLAGS:
+          - USE_OPENSSL=1
+          - USE_PCRE=1
+          - USE_PCRE_JIT=1
+          - USE_THREAD=1
+          - USE_ZLIB=1
+    steps:
+    - uses: actions/checkout@v2
+    - uses: msys2/setup-msys2@v2
+      with:
+        install: >-
+          coreutils
+          curl
+          diffutils
+          gawk
+          gcc
+          make
+          tar
+          openssl-devel
+          pcre-devel
+          zlib-devel
+    - name: Compile HAProxy with ${{ matrix.CC }}
+      run: |
+        make -j$(nproc) all \
+          ERR=1 \
+          TARGET=${{ matrix.TARGET }} \
+          CC=${{ matrix.CC }} \
+          ${{ join(matrix.FLAGS, ' ') }}
+    - name: Show HAProxy version
+      id: show-version
+      run: |
+        ./haproxy -vv
+        echo "::set-output name=version::$(./haproxy -v |awk 'NR==1{print 
$3}')"
-- 
2.29.0


Reply via email to