ci: add Windows Cygwin and msys2 builds to GitHub Actions
authorVincent Fu <vincent.fu@samsung.com>
Fri, 21 Apr 2023 18:56:59 +0000 (18:56 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Thu, 27 Apr 2023 16:03:42 +0000 (12:03 -0400)
AppVeyor will only run builds one at a time whereas GitHub Actions will
run all builds in parallel.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
.github/workflows/ci.yml
ci/actions-build.sh
ci/actions-install.sh
ci/common.sh

index 4bc91d3ed77492b06be7f775c50b39ca444d6738..ebe7b58a73433251c81476aff0a616068a5cf99a 100644 (file)
@@ -16,6 +16,9 @@ jobs:
         - macos
         - linux-i686-gcc
         - android
+        - windows-cygwin-64
+        - windows-cygwin-32
+        - windows-msys2-64
         include:
         - build: linux-gcc
           os: ubuntu-22.04
@@ -31,6 +34,22 @@ jobs:
         - build: android
           os: ubuntu-22.04
           arch: aarch64-linux-android32
+        - build: windows-cygwin-64
+          os: windows-latest
+          arch: x86_64
+          installer_arch: x64
+          shell: bash
+        - build: windows-cygwin-32
+          os: windows-latest
+          arch: i686
+          installer_arch: x86
+          shell: bash
+        - build: windows-msys2-64
+          os: windows-latest
+          cc: clang
+          arch: x86_64
+          installer_arch: x64
+          shell: msys2
 
     env:
       CI_TARGET_BUILD: ${{ matrix.build }}
@@ -38,13 +57,61 @@ jobs:
       CC: ${{ matrix.cc }}
 
     steps:
+    - name: git config line endings (Windows)
+      if: ${{ contains( matrix.build, 'windows' ) }}
+      run: git config --global core.autocrlf input
     - name: Checkout repo
       uses: actions/checkout@v3
+    - name: Install Cygwin toolchain (Windows)
+      if: ${{ startsWith(matrix.build, 'windows-cygwin') }}
+      uses: cygwin/cygwin-install-action@master
+      with:
+        packages: >
+          mingw64-${{matrix.arch}}-binutils
+          mingw64-${{matrix.arch}}-CUnit
+          mingw64-${{matrix.arch}}-curl
+          mingw64-${{matrix.arch}}-dlfcn
+          mingw64-${{matrix.arch}}-gcc-core
+          mingw64-${{matrix.arch}}-headers
+          mingw64-${{matrix.arch}}-runtime
+          mingw64-${{matrix.arch}}-zlib
+
+    - name: Install msys2 toolchain (Windows)
+      if: ${{ startsWith(matrix.build, 'windows-msys2') }}
+      uses: msys2/setup-msys2@v2
+      with:
+        install: >
+          git
+          base-devel
+          mingw-w64-${{matrix.arch}}-clang
+          mingw-w64-${{matrix.arch}}-cunit
+          mingw-w64-${{matrix.arch}}-toolchain
+          mingw-w64-${{matrix.arch}}-lld
+          mingw-w64-${{matrix.arch}}-python-scipy
+          mingw-w64-${{matrix.arch}}-python-six
+          mingw-w64-${{matrix.arch}}-python-statsmodels
+          mingw-w64-${{matrix.arch}}-python-sphinx
+
     - name: Install dependencies
-      run: ./ci/actions-install.sh
+      run: ${{matrix.shell}} ./ci/actions-install.sh
+      if: ${{ !contains( matrix.build, 'msys2' ) }}
     - name: Build
-      run: ./ci/actions-build.sh
+      run:  ${{matrix.shell}} ./ci/actions-build.sh
+    - name: Build installer (Windows)
+      if: ${{ contains( matrix.build, 'windows' ) }}
+      shell: cmd
+      run: |
+        cd os\windows
+        dobuild.cmd ${{ matrix.installer_arch }}
+        cd ..\..
+
+    - name: Upload installer (Windows)
+      if: ${{ contains( matrix.build, 'windows' ) }}
+      uses: actions/upload-artifact@v3
+      with:
+        name: ${{ matrix.build }}-installer
+        path: os\windows\*.msi
     - name: Smoke test
-      run: ./ci/actions-smoke-test.sh
+      run:  ${{matrix.shell}} ./ci/actions-smoke-test.sh
     - name: Full test
-      run: ./ci/actions-full-test.sh
+      run:  ${{matrix.shell}} ./ci/actions-full-test.sh
index 2b3de8e3daa272cff5638d745b322ae65da45d28..7146fb592b39258ec66823fc71e889e2f7041c4d 100755 (executable)
@@ -41,7 +41,17 @@ main() {
                     )
                     ;;
             esac
-        ;;
+           ;;
+        */windows)
+           configure_flags+=("--disable-native")
+            case "${CI_TARGET_ARCH}" in
+                "i686")
+                   configure_flags+=("--build-32bit-win")
+                    ;;
+                "x86_64")
+                    ;;
+            esac
+           ;;
     esac
     configure_flags+=(--extra-cflags="${extra_cflags}")
 
index fb3bd141c8ae8e4540833f6ca6078709a6d3fb8c..39395de8b7876b616f9ce8665ac7bc2ccedf79e6 100755 (executable)
@@ -89,6 +89,10 @@ install_macos() {
     pip3 install scipy six statsmodels
 }
 
+install_windows() {
+       pip3 install scipy six statsmodels sphinx
+}
+
 main() {
     if [ "${CI_TARGET_BUILD}" = "android" ]; then
        echo "Installing Android NDK..."
index 8861f843f0a3e87d4f38cb3ba6911b03f25882de..3cf6a4169fa58ccb66ca15be4783785234c5518b 100644 (file)
@@ -15,7 +15,7 @@ function set_ci_target_os {
             darwin*)
                 CI_TARGET_OS="macos"
                 ;;
-            msys*)
+            cygwin|msys*)
                 CI_TARGET_OS="windows"
                 ;;
             bsd*)