Merge pull request #2796 from jimklimov/fix-docs-markup
[networkupstools.git] / appveyor.yml
blobb6d1a32c56baac817dd28cfc7677936deff2e761
2 # Network UPS Tools: AppVeyor CI build recipe: NUT for Windows with MSYS2/MinGW x64
4 # https://www.msys2.org/docs/ci/
5 # https://www.appveyor.com/docs/appveyor-yml/
6 # https://www.appveyor.com/docs/build-configuration/
7 # https://www.appveyor.com/docs/windows-images-software/
9 version: 2.8.2.{build}-{branch}
11 # base image
12 image: Visual Studio 2022
14 # branches to build
15 branches:
16   # whitelist
17   only:
18     - master
19     - /Windows/
21 platform: x64
23 # https://www.appveyor.com/docs/build-cache/
24 environment:
25   APPVEYOR_SAVE_CACHE_ON_ERROR: true
26   APPVEYOR_CACHE_ENTRY_ZIP_ARGS: -t7z -m0=lzma -mx=6
27   CCACHE_DIR: /home/appveyor/.ccache
29 # https://github.com/networkupstools/nut/blob/Windows-v2.8.0-1/docs/config-prereqs.txt#L951
30 # or look for the chapter in nearby lines in later (current) revisions.
31 # Note: not using `time` in scripts currently - they did upset
32 # AppVeyor console log scanner with a /^sys.*/ match (apparently)
33 install:
34   - cmd: |
35         REM Do not give pacman cause for complaints:
36         C:\msys64\usr\bin\bash -lc "mkdir -p /var/cache/pacman/pkg; ls -la /"
37         REM FIXME: Since Jan 2025, normal update below fails with the message:
38         REM   installing mingw-w64-i686-gdb (16.1-1) breaks dependency
39         REM   'mingw-w64-i686-gdb=15.2' required by mingw-w64-i686-gdb-multiarch
40         REM Currently we sweep it away by removing the conflicting package:
41         C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -R mingw-w64-i686-gdb-multiarch || true"
42   - cmd: |
43         REM Core update (in case any core packages are outdated):
44         C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -Syuu"
45   - cmd: |
46         REM Normal update (same command again):
47         C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -Syuu"
48   - cmd: |
49         REM Prerequisites for NUT per https://github.com/networkupstools/nut/blob/master/docs/config-prereqs.txt :
50         C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -S --needed base-devel mingw-w64-x86_64-toolchain autoconf-wrapper automake-wrapper libtool mingw-w64-x86_64-libltdl gcc ccache mingw-w64-x86_64-ccache git aspell aspell-en python mingw-w64-x86_64-python-pygments mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-neon libneon-devel mingw-w64-x86_64-libgd mingw-w64-x86_64-cppunit"
51         REM SKIP mingw-w64-x86_64-libmodbus-git : we custom-build one with USB support
52   - cmd: |
53         REM Assorted stats after package processing:
54         C:\msys64\usr\bin\bash -lc "date -u; ls -la / ; du -ksx / ; date -u; du -ks /var/cache/pacman/pkg; date -u"
55         REM Preserve the current working directory:
56         set CHERE_INVOKING=yes
57         REM Start a 64 bit Mingw environment:
58         set MSYSTEM=MINGW64
59         C:\msys64\usr\bin\bash -lc 'PATH="/mingw64/bin:$PATH" ; export PATH ; pwd ; ccache -sv || echo "SKIP: Could not query ccache stats" ; ccache -o sloppiness=file_macro || true ; ccache -o compression=true || true '
62 before_build:
63   - cmd: |
64       REM Ensure we have a net-snmp to build against
65       REM Adapted from scripts/Windows/README.adoc document.
66       REM Here we hope to build it once, then use the
67       REM stashed version across Appveyor rebuilds.
68       REM Preserve the current working directory:
69       set CHERE_INVOKING=yes
70       REM Start a 64 bit Mingw environment:
71       set MSYSTEM=MINGW64
72       C:\msys64\usr\bin\bash -lc 'date -u; export MSYS2_PATH ; PATH="/mingw64/lib/ccache/bin:/mingw64/bin:$PATH" bash ./scripts/Windows/build-mingw-prereqs.sh'
75 build_script:
76   - cmd: |
77         REM Preserve the current working directory:
78         set CHERE_INVOKING=yes
79         REM Start a 64 bit Mingw environment:
80         set MSYSTEM=MINGW64
81         C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" CI_SKIP_CHECK=true CANBUILD_WITH_LIBMODBUS_USB=yes ./ci_build.sh'
84 after_build:
85   - cmd: |
86         REM Preserve the current working directory:
87         set CHERE_INVOKING=yes
88         REM Start a 64 bit Mingw environment:
89         set MSYSTEM=MINGW64
90         C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" ; export PATH ; ccache -sv || ccache -s || echo "SKIP: Could not query ccache stats"'
93 test_script:
94   - cmd: |
95         REM Preserve the current working directory:
96         set CHERE_INVOKING=yes
97         REM Start a 64 bit Mingw environment:
98         set MSYSTEM=MINGW64
99         REM Start Mingw-based integration and unit checks:
100         C:\msys64\usr\bin\bash -lc 'date -u; NUT_STATEPATH="C:\\Users\\appveyor\\AppData\\Local\\Temp\\nut-test"; mkdir -p "${NUT_STATEPATH}"; export NUT_STATEPATH; PATH="/mingw64/lib/ccache/bin:/mingw64/bin:$PATH" make -s check || bash -lc "for F in tests/*.log tests/*.trs ; do echo \"===---=== $F :\"; cat \"$F\"; done; exit 1;" '
101         REM Start a Mingw-based documentation spellcheck (note that "make check" above could cover some documents in path of artifact delivery, but maybe not all that we have):
102         C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/lib/ccache/bin:/mingw64/bin:$PATH" make -s -j 8 spellcheck'
105 after_test:
106   - cmd: |
107         REM Preserve the current working directory:
108         set CHERE_INVOKING=yes
109         REM Start a 64 bit Mingw environment:
110         set MSYSTEM=MINGW64
111         REM Oh the joys of shell scripting with strings passed through CMD:
112         REM Note: currently Python installation path with MSYS is buggy [#1584]
113         C:\msys64\usr\bin\bash -lc 'date -u; set -e ; if ! rm -rf ".inst" ; then echo "WARNING: Failed to clean away .inst" ; fi ; PATH="/mingw64/lib/ccache/bin:/mingw64/bin:$PATH" make -s install-win-bundle DESTDIR="`pwd`/.inst/NUT-for-Windows-x86_64-SNAPSHOT-%APPVEYOR_BUILD_VERSION%" ; ln -fs "NUT-for-Windows-x86_64-SNAPSHOT-%APPVEYOR_BUILD_VERSION%" ./.inst/NUT-for-Windows-x86_64-SNAPSHOT ; ( cd .inst/NUT-for-Windows-x86_64-SNAPSHOT ; find . -ls ; ) ; date -u'
114         cd .inst
115         7z a ../NUT-for-Windows-x86_64-SNAPSHOT-%APPVEYOR_BUILD_VERSION%.7z NUT*
116   - cmd: |
117         REM Preserve the current working directory:
118         set CHERE_INVOKING=yes
119         REM Start a 64 bit Mingw environment:
120         set MSYSTEM=MINGW64
121         C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" ; export PATH ; ccache -sv || ccache -s || echo "SKIP: Could not query ccache stats"'
122         C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" ; export PATH ; ccache -x || echo "SKIP: Could not query ccache compression stats"'
125 artifacts:
126   - path: 'NUT-for-Windows*.7z'
127     name: Bundle of binary files and FOSS dependencies of NUT for Windows
129   - path: config.log
130     name: config.log of recent build of NUT for Windows
132   - path: config.nut_report_feature.log
133     name: config.nut_report_feature.log of recent build of NUT for Windows
135 # Example optional cache (depends on file change):
136 # - C:\msys64 -> appveyor.yml
137 cache:
138   - C:\msys64\home\appveyor\.ccache
139   - C:\msys64\home\appveyor\ccache # likely missing, no problem - but the name is reported in ccache status
140   - C:\Users\appveyor\AppData\Local\ccache # may be default in newer versions
141   - C:\Users\appveyor\AppData\Local\.ccache # may be missing, but for completeness like above
142   - C:\msys64\var\cache\pacman\pkg
143   - C:\msys64\home\appveyor\nut-win-deps
145 # Below we tried to stash binaries of MSYS2 environment
146 # so VM deployment is faster on subsequent builds
147 # (update/install "from scratch" costs about 3 min),
148 # but unstashing the archive takes comparable time
149 # and often leads to conflicts in pacman book-keeping,
150 # while creating/updating the archive costs ~10 min.
151   #- C:\msys64\var\lib\pacman
152   #- C:\msys64\var\lib
153   #- C:\msys64\mingw64
154   #- C:\msys64\mingw32
155   #- C:\msys64\ucrt64
156   #- C:\msys64\clang32
157   #- C:\msys64\clang64
158   #- C:\msys64\clangarm64
159   #- C:\msys64\usr
160   #- C:\msys64\bin
161   #- C:\msys64\etc
162   #- C:\msys64\*.*
163   #- C:\msys64\installerResources