From 6485a64f1d029afb4263322155af64fd64dab45b Mon Sep 17 00:00:00 2001 From: Babil Golam Sarwar Date: Mon, 28 May 2018 10:06:29 +1000 Subject: [PATCH] Add build with Windows support on AppVeyor --- appveyor.yml | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..02552dd6 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,91 @@ +# Build worker image (VM template) +image: Visual Studio 2017 + +# Build platform, i.e. x86, x64, Any CPU. +platform: + - Any CPU + +# Set `git clone` directory +clone_folder: 'C:\Tridactyl' + +# Environment variables +environment: + PYINSTALLER: 0 + +init: + # Extend %PATH% + - ps: $env:PATH = "C:\Program Files\Git\mingw64\bin;$env:PATH" + # - ps: $env:PATH = "C:\msys64\bin;$env:PATH" + + # Verify %PATH% + - ps: Write-Host "[+] Current PATH contains ..." + - ps: Write-Host $env:PATH.Replace(";", "`r`n") + + # Verify Bash + - ps: Write-Host "[+] Location of Bash ..." + - ps: Get-Command -Name 'bash' + + # Verify NPM + - ps: Write-Host "[+] Location of NPM ..." + - ps: Get-Command -Name 'npm' + + # Verify software versions + - ps: Write-Host "[+] Verifying software verisons ..." + - sh --version + - bash --version + - node --version + - npm --version + + # Python version here will be 2.7, which is needed to keep NPM's + # 'bunyan' > 'dtrace-provider' modules happy. 'Dtrace-provider' + # needs Python 'gyp' module, which is only available for Python 2. + # We will prepend Python 3.6 to $PATH, under 'build_script'. + - python --version + +install: + # If there is a newer build queued for the same PR, cancel this + # one. The AppVeyor 'rollout builds' option is supposed to serve + # the same purpose but it is problematic because it tends to + # cancel builds pushed directly to master instead of just PR + # builds (or the converse). credits: JuliaLang developers. + - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + throw "There are newer queued builds for this pull request, failing early." } + + # Change to build directory + - ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER + + # Verify CWD + - ps: Write-Host "[+] Current PWD is ..." + - ps: Get-Location + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh" + + # Install Python modules + - ps: python -m pip install --upgrade pip + # - ps: python -m pip install --upgrade packager + - ps: python -m pip install --upgrade pyinstaller + + # Install NPM modules + # - bash -e -l -c "cd /C/Tridactyl && npm install -g windows-build-tools" + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && npm -g install marked" + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && npm -g install typedoc" + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && npm -g install nearley" + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && npm install" + +build_script: + # Add Python3 to %PATH% + - ps: $env:PATH = "C:\Python36-x64\Scripts;$env:PATH" + - ps: $env:PATH = "C:\Python36-x64;$env:PATH" + - ps: Copy-Item -Path "C:\Python36-x64\Python.exe" -Destination "C:\Python36-x64\Python3.exe" + + # Change to build directory and verify CWD + - ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER + - ps: Write-Host "[+] Current PWD is ..." + - ps: Get-Location + + # Start build + - bash -e -l -c "echo $PATH" + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && ls -alh" + - bash -e -l -c "cd $APPVEYOR_BUILD_FOLDER && PYINSTALLER=1 sh -x scripts/build.sh" +