Files
postgrest/appveyor.yml
T

48 lines
1.9 KiB
YAML

## AppVeyor is only used for building a Windows binary, no tests are run here.
platform: x64
image: Visual Studio 2015
cache:
- "c:\\sr"
- .stack-work
- "c:\\Users\\appveyor\\AppData\\Local\\Programs\\stack"
environment:
global:
STACK_ROOT: "c:\\sr"
GOPATH: c:\gopath
TMP: "c:\\tmp"
test: off
install:
- set PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH%
- curl -sS -ostack.zip -L --insecure http://www.stackage.org/stack/windows-x86_64
- 7z x stack.zip stack.exe
- set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
- go get -u github.com/tcnksm/ghr
build_script:
- stack setup --no-terminal > nul
# Appveyor has a timeout of 60 mins, building can take longer, limit the time and make sure this succeeds,
# previous work will get cached and finish on next commit
- bash -lc "timeout 2700 'C:\projects\postgrest\stack.exe' build -j1 --copy-bins --local-bin-path . || (($?==124))"
artifacts:
- path: postgrest.exe
deploy_script:
## set the env vars outside of the IF because that doesn't work: https://stackoverflow.com/questions/9102422/windows-batch-set-inside-if-not-working
- set DATE=%APPVEYOR_REPO_COMMIT_TIMESTAMP:~0,10%
- set SHA=%APPVEYOR_REPO_COMMIT:~0,7%
- set SUFFIX=%DATE%-%SHA%
- IF DEFINED APPVEYOR_REPO_TAG_NAME (
IF "%APPVEYOR_REPO_TAG_NAME%"=="nightly" (
7z a -tzip postgrest-nightly-%SUFFIX%-windows-x64.zip postgrest.exe &&
bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && ghr -t $GITHUB_TOKEN -u $APPVEYOR_ACCOUNT_NAME -r $APPVEYOR_PROJECT_NAME --replace nightly postgrest-nightly-$SUFFIX-windows-x64.zip"
) ELSE (
7z a -tzip postgrest-%APPVEYOR_REPO_TAG_NAME%-windows-x64.zip postgrest.exe &&
bash -lc "exec 0</dev/null && cd $APPVEYOR_BUILD_FOLDER && ghr -t $GITHUB_TOKEN -u $APPVEYOR_ACCOUNT_NAME -r $APPVEYOR_PROJECT_NAME -b \"`sed -n \"1,/$APPVEYOR_REPO_TAG_NAME/d;/## \[/q;p\" CHANGELOG.md`\" --replace $APPVEYOR_REPO_TAG_NAME postgrest-$APPVEYOR_REPO_TAG_NAME-windows-x64.zip"
)
)