appveyor: cleanup and add separate install script
authorSitsofe Wheeler <sitsofe@yahoo.com>
Wed, 19 Aug 2020 19:21:22 +0000 (20:21 +0100)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Sat, 12 Sep 2020 10:54:19 +0000 (11:54 +0100)
- Rename PLATFORM environment variable to ARCHITECTURE to avoid clash
  with Appveyor variable
  (https://www.appveyor.com/docs/environment-variables/ )
- Introduce support for using MSYS2
- Perform clang builds that also package PDB symbols
- Drop PACKAGE_ARCH variable since it can be derived
- Switch some lines to just call native binaries directly

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
.appveyor.yml
ci/appveyor-install.sh [new file with mode: 0755]

index 352caeee73ada60d975c06c2d2b05d5bdb33092e..fad1632665d04724f7823f9f483040f55afb0c40 100644 (file)
@@ -5,33 +5,49 @@ image:
 
 environment:
   CYG_MIRROR: http://cygwin.mirror.constant.com
-  CYG_ROOT: C:\cygwin64
-  MAKEFLAGS: -j 2
   matrix:
-    - platform: x64
-      PACKAGE_ARCH: x86_64
+    - ARCHITECTURE: x64
+      CC: clang
+      CONFIGURE_OPTIONS: --enable-pdb
+      DISTRO: msys2
+# Skip 32 bit clang build
+#    - ARCHITECTURE: x86
+#      CC: clang
+#      CONFIGURE_OPTIONS: --enable-pdb
+#      DISTRO: msys2
+    - ARCHITECTURE: x64
       CONFIGURE_OPTIONS:
-    - platform: x86
-      PACKAGE_ARCH: i686
+      DISTRO: cygwin
+    - ARCHITECTURE: x86
       CONFIGURE_OPTIONS: --build-32bit-win --target-win-ver=xp
+      DISTRO: cygwin
 
 install:
-  - '%CYG_ROOT%\setup-x86_64.exe --quiet-mode --no-shortcuts --only-site --site "%CYG_MIRROR%" --packages "mingw64-%PACKAGE_ARCH%-zlib,mingw64-%PACKAGE_ARCH%-CUnit" > NUL'
-  - SET PATH=C:\Python38-x64;%CYG_ROOT%\bin;%PATH% # NB: Changed env variables persist to later sections
+  - if %DISTRO%==cygwin (
+      SET "PATH=C:\cygwin64\bin;C:\cygwin64;%PATH%"
+    )
+  - if %DISTRO%==msys2 if %ARCHITECTURE%==x86 (
+      SET "PATH=C:\msys64\mingw32\bin;C:\msys64\usr\bin;%PATH%"
+    )
+  - if %DISTRO%==msys2 if %ARCHITECTURE%==x64 (
+      SET "PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%"
+    )
+  - SET PATH=C:\Python38-x64;%PATH% # NB: Changed env variables persist to later sections
   - SET PYTHONUNBUFFERED=TRUE
-  - python.exe -m pip install scipy six
+  - bash.exe ci\appveyor-install.sh
 
 build_script:
-  - 'bash.exe -lc "cd \"${APPVEYOR_BUILD_FOLDER}\" && ./configure --disable-native --extra-cflags=\"-Werror\" ${CONFIGURE_OPTIONS} && make.exe'
+  - bash.exe configure --extra-cflags=-Werror --disable-native %CONFIGURE_OPTIONS%
+  - make.exe -j2
 
 after_build:
   - file.exe fio.exe
   - make.exe test
-  - 'cd os\windows && dobuild.cmd %PLATFORM% && cd ..'
+  - 'cd os\windows && dobuild.cmd %ARCHITECTURE% && cd ..'
   - ps: Get-ChildItem .\os\windows\*.msi | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name -DeploymentName fio.msi }
 
 test_script:
-  - 'bash.exe -lc "cd \"${APPVEYOR_BUILD_FOLDER}\" && [ -f fio.exe ] && python.exe t/run-fio-tests.py --artifact-root test-artifacts --debug'
+  - python.exe t/run-fio-tests.py --artifact-root test-artifacts --debug
 
 on_finish:
   - 'bash.exe -lc "cd \"${APPVEYOR_BUILD_FOLDER}\" && [ -d test-artifacts ] && 7z a -t7z test-artifacts.7z test-artifacts -xr!foo.0.0 -xr!latency.?.0 -xr!fio_jsonplus_clat2csv.test && appveyor PushArtifact test-artifacts.7z'
diff --git a/ci/appveyor-install.sh b/ci/appveyor-install.sh
new file mode 100755 (executable)
index 0000000..c73e4cb
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+# The PATH to appropriate distro commands must already be set before invoking
+# this script
+# The following environment variables must be set:
+# PLATFORM={i686,x64}
+# DISTRO={cygwin,msys2}
+# The following environment can optionally be set:
+# CYG_MIRROR=<URL>
+set -eu
+
+case "${ARCHITECTURE}" in
+    "x64")
+        PACKAGE_ARCH="x86_64"
+        ;;
+    "x86")
+        PACKAGE_ARCH="i686"
+        ;;
+esac
+
+echo "Installing packages..."
+case "${DISTRO}" in
+    "cygwin")
+        CYG_MIRROR=${CYG_MIRROR:-"http://cygwin.mirror.constant.com"}
+        setup-x86_64.exe --quiet-mode --no-shortcuts --only-site \
+            --site "${CYG_MIRROR}" --packages \
+            "mingw64-${PACKAGE_ARCH}-CUnit,mingw64-${PACKAGE_ARCH}-zlib"
+        ;;
+    "msys2")
+        #pacman --noconfirm -Syuu # MSYS2 core update
+        #pacman --noconfirm -Syuu # MSYS2 normal update
+        pacman.exe --noconfirm -S \
+            mingw-w64-${PACKAGE_ARCH}-clang \
+            mingw-w64-${PACKAGE_ARCH}-cunit \
+            mingw-w64-${PACKAGE_ARCH}-lld
+        ;;
+esac
+
+python.exe -m pip install scipy six
+
+echo "Python3 path: $(type -p python3 2>&1)"
+echo "Python3 version: $(python3 -V 2>&1)"