aboutsummaryrefslogtreecommitdiff
path: root/appveyor.yml
blob: 800b002956661361a9f4736fd5ab0e6af4e69fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
image: Visual Studio 2013
clone_folder: "c:\\pandoc"
environment:
  global:
    WIXBIN: "c:\\Program Files (x86)\\WiX Toolset v3.11\\bin"
    STACK_BUILD_OPTS: "--no-terminal -j1 --no-system-ghc --install-ghc --test --local-bin-path=.\\windows"
    # Override the temp directory to avoid sed escaping issues
    # See https://github.com/haskell/cabal/issues/5386
    TMP: "c:\\tmp"
    # see #4201, https://github.com/haskell-tools/haskell-tools/issues/277
  matrix:
# - BUILD_TYPE: "stack"
#   OSARCH: "windows-x86_64"
#   STACK_ROOT: "c:\\sr64"
#   STACK_YAML: "stack.yaml"
#   STACK_FLAGS: "--arch=x86_64"
#   ARCH: "x64"
#   CHOCO_OPTS: ""
# - BUILD_TYPE: "stack"
#   OSARCH: "windows-i386"
#   STACK_ROOT: "c:\\sr32"
#   STACK_YAML: "stack.lts11.yaml"
#   STACK_FLAGS: "--arch=i386 --flag=hslua:lua_32bits"
#   ARCH: "x86"
#   CHOCO_OPTS: "--x86"
#   # note: we do a lts11 build because of
#   # https://github.com/commercialhaskell/stackage/issues/3385
#   # with luck this will be fixed in ghc 8.6.
  - BUILD_TYPE: "cabal"
    OSARCH: "windows-x86_64"
    GHC_VERSION: "8.6.1.1"
    GHC_MINOR_VERSION: "8.6.1"
    GHC: "C:\\ProgramData\\chocolatey\\lib\\ghc\\tools\\ghc-%GHC_MINOR_VERSION%\\bin\\ghc.exe"
    CABAL_VERSION: "2.4.0.0"
    CABAL_STORE: "C:\\cs"
    CABAL_OPTS: "--allow-newer -fembed_data_files -fbibutils"
    GHC_OPTS: "-fhide-source-paths"
    ARCH: "x64"
    CHOCO_OPTS: ""
  - BUILD_TYPE: "cabal"
    OSARCH: "windows-i386"
    GHC_VERSION: "8.6.1.1"
    GHC_MINOR_VERSION: "8.6.1"
    GHC: "C:\\ProgramData\\chocolatey\\lib\\ghc\\tools\\ghc-%GHC_MINOR_VERSION%\\bin\\ghc.exe"
    CABAL_VERSION: "2.4.0.0"
    CABAL_STORE: "C:\\cs"
    CABAL_OPTS: "--allow-newer -flua_32bits -fembed_data_files -fbibutils"
    GHC_OPTS: "-fhide-source-paths"
    ARCH: "x86"
    CHOCO_OPTS: "--x86"

skip_commits:
  files:
    - '*.md'
    - '*.txt'
    - '.travis.yml'
    - 'Makefile'
    - 'man/pandoc.1'
    - 'linux/*'
    - 'macos/*'

matrix:
  fast_finish: true

cache:
  - "%CABAL_STORE%"
  # - "%STACK_ROOT%"
  # This is where stack install ghc by default, but we don't
  # cache it because it's too large:
  # - "c:\\Users\\appveyor\\AppData\\Local\\Programs\\stack"

# Note: to reset build cache, do the following in JavaScript
# console on appveyor:
# $.ajax({ url: 'https://ci.appveyor.com/api/projects/jgm/pandoc/buildcache', type: 'DELETE'})
# We don't do a normal C build, but build in test_script via stack
build: off

install:
  - choco install wixtoolset --version 3.11.1 %CHOCO_OPTS%
  - if "%BUILD_TYPE%" == "stack" (
      choco install haskell-stack %CHOCO_OPTS%
    )
  - if "%BUILD_TYPE%" == "cabal" (
      choco install ghc --version %GHC_VERSION% --ignore-dependencies %CHOCO_OPTS% &&
      choco install cabal --version %CABAL_VERSION% --ignore-dependencies %CHOCO_OPTS%
    )

# before_test:

test_script:
  # The ugly echo "" hack is to avoid complaints about 0 being an invalid file
  # descriptor
  - if "%BUILD_TYPE%" == "stack" (
        stack --version &&
        stack path &&
        echo "" | stack clean &&
        echo "" | stack install --stack-yaml %STACK_YAML% %STACK_BUILD_OPTS% %STACK_FLAGS% pandoc pandoc-citeproc
    )
  # Note: we manually create cabal store, because of a cabal bug:
  # see https://github.com/haskell/cabal/issues/5516
  - if "%BUILD_TYPE%" == "cabal" (
        cabal --version &&
        mkdir "%CABAL_STORE%"/ghc-%GHC_MINOR_VERSION%/package.db &&
        cabal --store-dir="%CABAL_STORE%" new-update &&
        cabal --store-dir="%CABAL_STORE%" new-build -w %GHC% --enable-tests --run-tests %CABAL_OPTS% --ghc-options="%GHC_OPTS%" . pandoc-citeproc &&
        forfiles /P .\dist-newstyle /M pandoc*.exe /S /C "cmd /C copy @path C:\pandoc\windows"
    )

after_test:
    # .\ in the stack commandline seems to be .\windows\ (where the stack-appveyor.yaml is)
  - cd windows
  - .\pandoc.exe -s --toc ..\MANUAL.txt -o MANUAL.html
  - .\pandoc.exe -s ..\COPYING.md -o COPYING.rtf
  - copy ..\COPYRIGHT COPYRIGHT.txt
  - 7z a "pandoc-%OSARCH%.zip" pandoc.exe pandoc-citeproc.exe MANUAL.html COPYING.rtf
  - |
      set VERSION=
      for /f "tokens=1-2 delims= " %%a in ('.\pandoc.exe --version') do ( if not defined VERSION set "VERSION=%%b" )
      echo %VERSION%
      "%WIXBIN%"\candle -arch %ARCH% -dVERSION=%VERSION% -dBINPATH=. *.wxs -out wixobj\
      "%WIXBIN%"\light -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us -loc Pandoc-en-us.wxl -out "pandoc-%OSARCH%.msi" wixobj\*.wixobj

# for debugging
# on_finish:
#   - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

artifacts:
  - path: 'windows\pandoc-%OSARCH%.zip'
    name: exe
  - path: 'windows\pandoc-%OSARCH%.msi'
    name: msi