skip_branch_with_pr: true

branches:
  except:
    - coverity_scan
    - /^continuous.*/

image:
  - Visual Studio 2017

init:
  - ps: Get-Date -UFormat '### %Y-%m-%d %T init started'
  # Uncomment to enable RDP login at init time, this will not block job execution.
  #  - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

install:
  - ps: Get-Date -UFormat '### %Y-%m-%d %T install started'
  - set PATH=c:\msys64\usr\bin
  - C:\msys64\usr\bin\bash -lc "echo 'export PATH=/mingw64/bin:/usr/bin' > ~/.bashrc"
  - C:\msys64\usr\bin\bash -lc /c/projects/openscad/scripts/msys2-install-dependencies.sh
  - ps: Get-Date -UFormat '### %Y-%m-%d %T install finished'

build_script:
  - ps: Get-Date -UFormat '### %Y-%m-%d %T build started'
  - ps: Get-Date -UFormat '### %Y-%m-%d %T qmake'
  - C:\msys64\usr\bin\bash -lc "cd /c/projects/openscad && qmake.exe openscad.pro CONFIG-=debug CONFIG+=experimental CONFIG+=snapshot CONFIG+=info"
  - ps: Get-Date -UFormat '### %Y-%m-%d %T make'
  - C:\msys64\usr\bin\bash -lc "cd /c/projects/openscad && mingw32-make.exe -j2"
  - ps: Get-Date -UFormat '### %Y-%m-%d %T prepare test build'
  - C:\msys64\usr\bin\bash -lc "cd /c/projects/openscad && git submodule update --init"
  - ps: Get-Date -UFormat '### %Y-%m-%d %T cmake'
  - C:\msys64\usr\bin\bash -lc "cd /c/projects/openscad/tests && EIGENDIR=/mingw64/include/eigen3 /mingw64/bin/cmake.exe -G 'MSYS Makefiles' ."
  - ps: Get-Date -UFormat '### %Y-%m-%d %T make'
  - C:\msys64\usr\bin\bash -lc "cd /c/projects/openscad/tests && mingw32-make.exe -j2"
  - ps: Get-Date -UFormat '### %Y-%m-%d %T build finished'

test_script:
  - ps: Get-Date -UFormat '### %Y-%m-%d %T test started'
  - C:\msys64\usr\bin\bash -lc "cd /c/projects/openscad/release && cp -v /mingw64/bin/opengl32.dll ."
  - ps: Get-Date -UFormat '### %Y-%m-%d %T ctest'
  - C:\msys64\usr\bin\bash -lc "cd /c/projects/openscad/tests && /mingw64/bin/ctest.exe -j2 -E 'opencsgtest_issue1165|opencsgtest_issue1215|throwntogethertest_issue1089|throwntogethertest_issue1215|openscad-nonascii|import_3mf|3mfpngtest|3mfexport'"
  - ps: Get-Date -UFormat '### %Y-%m-%d %T test finished'

artifacts:
  - path: 'tests\Testing\Temporary\*_report.html'

on_failure:
  - ps: Get-ChildItem c:\projects\openscad\tests\Testing\Temporary\*_report.html | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }

# Uncomment RDP login at job end with specical blocking flag to prevent the worker from exitting. Continue by deleting lock file on desktop.
# Alternatively if RDP is already enabled earlier, just adding "pause" will block the worker till timeout (60 minutes).
#on_finish:
#  - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#  - pause
