2019-01-24 15:54:43 +00:00
|
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2018-07-31 09:20:17 +00:00
|
|
|
version: '{build}.{branch}'
|
|
|
|
|
|
|
|
skip_branch_with_pr: true
|
|
|
|
|
2018-10-15 16:08:19 +00:00
|
|
|
clone_folder: C:\deno
|
2018-07-31 09:20:17 +00:00
|
|
|
clone_depth: 1
|
|
|
|
|
|
|
|
environment:
|
|
|
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
2018-08-22 17:42:04 +00:00
|
|
|
DENO_BUILD_MODE: release
|
2018-12-13 21:19:17 +00:00
|
|
|
DENO_BUILD_PATH: $(APPVEYOR_BUILD_FOLDER)\target\release
|
2018-07-31 09:20:17 +00:00
|
|
|
DENO_THIRD_PARTY_PATH: $(APPVEYOR_BUILD_FOLDER)\third_party
|
2018-11-01 05:06:55 +00:00
|
|
|
RELEASE_ARTIFACT: deno_win_x64.zip
|
2019-01-17 00:38:27 +00:00
|
|
|
# Renamed to fix an Appveyor cache bug (restoring old caches).
|
|
|
|
RUST_DIR: $(USERPROFILE)\xrust
|
2018-11-07 02:53:20 +00:00
|
|
|
CARGO_HOME: $(RUST_DIR)\cargo
|
|
|
|
RUSTUP_HOME: $(RUST_DIR)\rustup
|
2019-01-02 16:39:26 +00:00
|
|
|
RUST_BACKTRACE: full
|
2018-12-19 17:05:38 +00:00
|
|
|
RUSTC_WRAPPER: sccache
|
2019-02-11 17:57:26 +00:00
|
|
|
PYTHONPATH: third_party\python_packages
|
2018-12-18 08:00:19 +00:00
|
|
|
SCCACHE_BUCKET: deno-sccache
|
2018-12-19 18:40:44 +00:00
|
|
|
AWS_ACCESS_KEY_ID: AKIAIVRN52PLDBP55LBQ
|
2018-12-18 08:00:19 +00:00
|
|
|
AWS_SECRET_ACCESS_KEY:
|
2018-12-19 18:40:44 +00:00
|
|
|
secure: 8ybpi/y5qE2baChsCBhNHmykng3FitELAtTYOiqZd0mw38i88dzdAX8ETNtBogMV
|
2018-12-18 08:00:19 +00:00
|
|
|
|
2018-07-31 09:20:17 +00:00
|
|
|
|
|
|
|
# Appveyor uses 7zip to pack cache directories. We use these options:
|
2018-09-05 23:53:18 +00:00
|
|
|
# -t7z : Use '7z' format.
|
|
|
|
# -snl : Store symlinks; doesn't work, but it prevents following symlinks.
|
2018-07-31 09:20:17 +00:00
|
|
|
# -mtc : Use UTC timestamps. This is required for incremental builds.
|
|
|
|
# -mx=1 : Fast compression.
|
|
|
|
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: -t7z -snl -mtc -mx=1
|
|
|
|
|
2018-08-03 22:02:45 +00:00
|
|
|
# Define some PowerShell helper functions which are used in the scripts below.
|
|
|
|
# They're defined in an environment variable to reduce noise in the build log.
|
|
|
|
PS_UTILS: |-
|
|
|
|
# `Exec` runs a regular executable. It looks at the process' exit code,
|
|
|
|
# rather than its stderr output, to tell if a command has failed.
|
|
|
|
function Exec([ScriptBlock] $Command, [switch] $NoNewLines) {
|
|
|
|
"$Command".TrimStart(" &") | Write-Host # Echo command.
|
|
|
|
& $Command 2>&1 | Write-Host -NoNewLine:$NoNewLines # Execute command.
|
|
|
|
if ($NoNewLines) { Write-Host } # Write newline.
|
|
|
|
if ($LastExitCode -ne 0) { throw "Failure. Exit code: $LastExitCode" }
|
|
|
|
}
|
|
|
|
|
2018-08-17 01:29:56 +00:00
|
|
|
# Get-Tree lists all objects in a tree. It's different from Get-ChildItem
|
|
|
|
# in that the latter recurses through symlinks, which is problematic.
|
|
|
|
function Get-Tree([string[]] $Path, [switch] $Recurse, [switch] $Force) {
|
|
|
|
function Get-SubDirs([string[]] $Path) {
|
|
|
|
Get-ChildItem $Path -Force:$Force `
|
|
|
|
-Attributes Directory+!ReparsePoint |
|
|
|
|
foreach { $_.FullName } |
|
|
|
|
foreach { $_; Get-SubDirs $_ }
|
|
|
|
}
|
|
|
|
if ($Recurse) { $Path += Get-SubDirs $Path }
|
|
|
|
Get-ChildItem $Path -Force:$Force @args
|
|
|
|
}
|
|
|
|
|
2018-08-03 22:02:45 +00:00
|
|
|
# `Delete-Tree` is a simple wrapper around Remove-Item. It doesn't set
|
|
|
|
# an error status if one of the paths to be deleted doesn't exist.
|
|
|
|
function Delete-Tree([string[]] $Path) {
|
2018-08-17 06:05:05 +00:00
|
|
|
$Path | foreach {
|
2018-08-03 22:02:45 +00:00
|
|
|
"Deleting '$_'" | Write-Host -NoNewLine
|
2018-08-17 06:05:05 +00:00
|
|
|
if (Test-Path $_) {
|
|
|
|
Remove-Item $_ -Recurse -Force -ErrorAction Ignore
|
2018-08-03 22:02:45 +00:00
|
|
|
$(if ($?) { " - ok" } else { " - failed" }) | Write-Host
|
|
|
|
} else {
|
|
|
|
" - not found" | Write-Host
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-17 01:29:56 +00:00
|
|
|
# Get-SaveCache returns $true if the cache will be saved at the end.
|
|
|
|
function Get-SaveCache {
|
|
|
|
-not $env:APPVEYOR_PULL_REQUEST_NUMBER -and
|
2018-10-25 20:47:52 +00:00
|
|
|
-not ($env:APPVEYOR_CACHE_SKIP_SAVE -eq "true")
|
2018-08-17 01:29:56 +00:00
|
|
|
}
|
2018-08-03 22:02:45 +00:00
|
|
|
|
|
|
|
for:
|
|
|
|
# Do no save the build cache for feature branches. TODO: Once we have multiple
|
|
|
|
# permanent branches, use a build matrix so each branch has it's own cache.
|
|
|
|
- branches:
|
|
|
|
except:
|
|
|
|
- master
|
|
|
|
environment:
|
|
|
|
APPVEYOR_CACHE_SKIP_SAVE: true
|
|
|
|
|
2018-07-31 09:20:17 +00:00
|
|
|
cache:
|
|
|
|
# Rust stuff.
|
2018-11-07 02:53:20 +00:00
|
|
|
- $(RUST_DIR)
|
2019-01-30 22:20:56 +00:00
|
|
|
- $(APPVEYOR_BUILD_FOLDER)\prebuilt\win\
|
2018-07-31 09:20:17 +00:00
|
|
|
|
|
|
|
init:
|
2018-08-03 22:02:45 +00:00
|
|
|
# Load utility functions
|
|
|
|
- ps: Invoke-Expression $env:PS_UTILS
|
2018-07-31 09:20:17 +00:00
|
|
|
|
2019-03-05 03:25:04 +00:00
|
|
|
# Upgrade git.
|
|
|
|
# TODO: remove when Appveyor upgrades to version 2.19.2.windows.1 or higher.
|
|
|
|
- ps: |-
|
|
|
|
$git_setup_uri = "https://github.com/git-for-windows/git/releases/" +
|
|
|
|
"download/v2.21.0.windows.1/Git-2.21.0-64-bit.exe"
|
|
|
|
Invoke-WebRequest -Uri $git_setup_uri -OutFile "$env:TEMP\git-setup.exe"
|
|
|
|
Start-Process -FilePath "$env:TEMP\git-setup.exe" `
|
|
|
|
-ArgumentList "/verysilent" `
|
|
|
|
-Wait
|
|
|
|
|
2018-07-31 09:20:17 +00:00
|
|
|
# Make git check out symlinks (not placeholder text files).
|
|
|
|
- git config --global core.symlinks true
|
|
|
|
|
|
|
|
install:
|
2018-12-19 02:09:30 +00:00
|
|
|
# Make sure the PATH includes the prebuilt files (downloaded during setup.py)
|
|
|
|
- set PATH=%PATH%;%CD%\prebuilt\win\
|
2018-12-18 08:00:19 +00:00
|
|
|
|
2018-07-31 09:20:17 +00:00
|
|
|
# Clone the third_party submodule.
|
2018-08-03 22:02:45 +00:00
|
|
|
- ps: |-
|
2018-07-31 09:20:17 +00:00
|
|
|
try {
|
|
|
|
Exec { & git submodule update --init --force --depth 1 }
|
|
|
|
} catch {
|
|
|
|
# Git will fail if the `third_party` directory was restored from cache,
|
|
|
|
# but the `.git/modules` directory wasn't. Rebuild it from scratch.
|
2018-08-17 06:05:05 +00:00
|
|
|
Delete-Tree $env:DENO_THIRD_PARTY_PATH
|
2018-07-31 09:20:17 +00:00
|
|
|
Exec -NoNewLines { & git submodule update --init --force --depth 1 }
|
|
|
|
}
|
|
|
|
|
2018-08-17 01:29:56 +00:00
|
|
|
# Configure depot_tools and add it to the search path. This is necessary
|
|
|
|
# because, later in this script, we need to invoke ninja directly.
|
|
|
|
- ps: |-
|
|
|
|
$env:PATH = "$env:DENO_THIRD_PARTY_PATH\depot_tools;$env:PATH"
|
|
|
|
$env:DEPOT_TOOLS_WIN_TOOLCHAIN = "0"
|
|
|
|
|
2018-07-31 09:20:17 +00:00
|
|
|
# Install a recent Node.js version.
|
2018-08-17 01:29:56 +00:00
|
|
|
- ps: Install-Product -Product node -Version 10 -Platform x64
|
2018-07-31 09:20:17 +00:00
|
|
|
|
|
|
|
# Make sure the right Python version is in PATH, and others are not.
|
2018-08-03 22:02:45 +00:00
|
|
|
- ps: |-
|
2018-07-31 09:20:17 +00:00
|
|
|
# Remove the wrong Python version(s) from PATH.
|
2018-10-22 01:47:34 +00:00
|
|
|
$p = $env:PATH -split ";" | where { -not (Test-Path "$_\python.exe") }
|
2018-07-31 09:20:17 +00:00
|
|
|
# Add python27-x64.
|
2018-10-15 16:08:19 +00:00
|
|
|
$p += "C:\Python27-x64"
|
2018-07-31 09:20:17 +00:00
|
|
|
$env:PATH = $p -join ";"
|
|
|
|
|
|
|
|
# Add Rust/Cargo to PATH.
|
|
|
|
- ps: $env:PATH += ";$env:CARGO_HOME\bin"
|
|
|
|
|
2018-10-26 17:09:38 +00:00
|
|
|
# Install Rust via rustup-init.
|
|
|
|
# * After install, the rustup directory is very big, with many files,
|
2018-08-03 22:02:45 +00:00
|
|
|
# slowing down cache save/restore a lot, so we remove unnecessary stuff.
|
|
|
|
# * TODO: Use `rustup component remove docs` instead, when this issue
|
|
|
|
# is resolved: https://github.com/rust-lang-nursery/rustup.rs/issues/998.
|
|
|
|
# * TODO: Ship Rust in the third_party repo. See issue #386.
|
|
|
|
- ps: |-
|
2018-08-17 06:05:05 +00:00
|
|
|
if (-not (Test-Path $env:CARGO_HOME)) {
|
2018-07-31 09:20:17 +00:00
|
|
|
Invoke-WebRequest -Uri "https://win.rustup.rs" `
|
|
|
|
-OutFile "$env:TEMP\rustup-init.exe"
|
2018-10-26 17:09:38 +00:00
|
|
|
Exec -NoNewLines {
|
2019-03-20 22:55:52 +00:00
|
|
|
& "$env:TEMP\rustup-init.exe" -y --default-toolchain 1.33.0
|
2018-10-26 17:09:38 +00:00
|
|
|
}
|
2018-08-17 06:05:05 +00:00
|
|
|
Delete-Tree @(
|
2018-08-03 22:02:45 +00:00
|
|
|
"$env:RUSTUP_HOME\downloads",
|
|
|
|
"$env:RUSTUP_HOME\tmp",
|
|
|
|
"$env:RUSTUP_HOME\toolchains\stable-x86_64-pc-windows-msvc\share\doc"
|
|
|
|
)
|
2018-07-31 09:20:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Log installed Node.js version + processor architecture.
|
|
|
|
- node -p "`Node ${process.version} ${process.arch}`"
|
|
|
|
|
|
|
|
# Log installed Python version + processor architecture.
|
2018-08-03 22:02:45 +00:00
|
|
|
- ps: |-
|
2018-07-31 09:20:17 +00:00
|
|
|
@("from sys import version",
|
|
|
|
"print 'Python', version") -join "`n" | & python -
|
|
|
|
|
|
|
|
# Log some more versions.
|
|
|
|
- rustc --version
|
|
|
|
- cargo --version
|
|
|
|
|
|
|
|
before_build:
|
|
|
|
# Download clang and gn, generate ninja files.
|
|
|
|
- python tools\setup.py
|
|
|
|
|
2018-12-19 18:34:26 +00:00
|
|
|
# Start sccache, then throw away the S3 access key.
|
|
|
|
- ps: |-
|
|
|
|
sccache --start-server
|
|
|
|
$env:AWS_SECRET_ACCESS_KEY = $null
|
|
|
|
|
2018-07-31 09:20:17 +00:00
|
|
|
build_script:
|
2018-12-19 10:27:15 +00:00
|
|
|
# Build with Cargo first. Both builds produce a deno.exe in the same dir. We
|
|
|
|
# want the final one (which gets tested and released) to be built by Ninja.
|
2019-01-13 21:32:06 +00:00
|
|
|
- cargo build -vv --release --locked
|
2018-12-19 10:27:15 +00:00
|
|
|
- python tools\build.py
|
2018-07-31 09:20:17 +00:00
|
|
|
|
|
|
|
test_script:
|
|
|
|
- python tools\lint.py
|
2018-10-21 17:43:47 +00:00
|
|
|
- python tools\test_format.py
|
2018-07-31 09:20:17 +00:00
|
|
|
- ps: Exec { & python tools\test.py $env:DENO_BUILD_PATH }
|
2018-08-17 01:29:56 +00:00
|
|
|
|
|
|
|
after_test:
|
2018-09-18 04:32:57 +00:00
|
|
|
# Delete the the rollup cache, which is unreliable, so that it doesn't get
|
|
|
|
# persisted in the appveyor cache.
|
|
|
|
- ps: if (Get-SaveCache) { Delete-Tree "$env:DENO_BUILD_PATH\.rpt2_cache" }
|
|
|
|
|
2018-12-19 18:34:26 +00:00
|
|
|
# Stop sccache and show stats.
|
|
|
|
- ps: sccache --stop-server
|
|
|
|
|
2018-08-17 20:42:26 +00:00
|
|
|
# Verify that the build is fully up-to-date. Running ninja should be a no-op.
|
|
|
|
# This catches erroneous file cleanup, and incorrectly set up build deps.
|
|
|
|
- ps: |-
|
2018-08-17 22:23:14 +00:00
|
|
|
$out = ninja -C $env:DENO_BUILD_PATH -n -d explain
|
2018-08-17 20:42:26 +00:00
|
|
|
if ($out -notcontains "ninja: no work to do.") {
|
2018-09-06 09:58:30 +00:00
|
|
|
throw "Build should be up-to-date but isn't."
|
2018-08-17 20:42:26 +00:00
|
|
|
}
|
2018-08-22 17:42:04 +00:00
|
|
|
|
2018-09-13 04:26:26 +00:00
|
|
|
# Verify that javascript and typescript files which are bundled by rollup are
|
2019-03-30 18:45:36 +00:00
|
|
|
# listed explicitly in cli\BUILD.gn. This is not an air-tight check.
|
2018-09-13 04:26:26 +00:00
|
|
|
# TODO: make rollup or another bundler write a depfile.
|
|
|
|
- ps: |-
|
|
|
|
$ignore = "test_util.ts", "unit_tests.ts", "*_test.ts"
|
|
|
|
Get-ChildItem "js" -File -Force -Name |
|
|
|
|
where { $name = $_; -not ($ignore | where { $name -like $_ }) } |
|
2019-03-30 18:45:36 +00:00
|
|
|
where { -not (Select-String -Pattern $_ -Path cli\BUILD.gn `
|
2018-09-13 04:26:26 +00:00
|
|
|
-SimpleMatch -CaseSensitive) } |
|
2019-03-30 18:45:36 +00:00
|
|
|
foreach { throw "$_ should be listed in cli\BUILD.gn but isn't." }
|
2018-09-13 04:26:26 +00:00
|
|
|
|
2018-08-25 17:02:21 +00:00
|
|
|
# Verify that generated ninja files do not use absolute path names.
|
|
|
|
# If they do, it makes ccache/sccache much less effective.
|
|
|
|
- ps: |-
|
|
|
|
$trap = "NO_ABS_PATH_PLS"
|
|
|
|
$dir = "$env:APPVEYOR_BUILD_FOLDER\out\$trap"
|
|
|
|
Exec { gn gen $dir | Out-Null }
|
|
|
|
$files = Get-Tree $dir -File -Force -Recurse | where Extension -ne ".dll"
|
2018-10-20 17:20:48 +00:00
|
|
|
Select-String $trap -Path $files -SimpleMatch | where {
|
|
|
|
# V8 took the liberty to produce an absolute path in their ninja
|
|
|
|
# output. We can't do much about that, so we just ignore it.
|
2018-11-01 12:05:21 +00:00
|
|
|
$_.Line -notmatch "v8/builtins-generated/bytecodes-builtins-list.h"
|
2018-10-20 17:20:48 +00:00
|
|
|
} | tee -Variable line_matches
|
2018-08-25 17:02:21 +00:00
|
|
|
if ($line_matches) {
|
|
|
|
$ctx = $line_matches.Line |
|
|
|
|
Select-String "[^\s;,]*[\s=]*[^\s;,=]*$trap[^\s;,]*" -AllMatches |
|
|
|
|
foreach { $_.Matches.Value -replace '\$(.)', '$1' } |
|
|
|
|
sort -Unique
|
|
|
|
throw @("Absolute path(s) found in build script:") + $ctx -join "`n "
|
|
|
|
}
|
|
|
|
|
2018-08-22 18:56:40 +00:00
|
|
|
# If this build is going to be deployed, build a zip file.
|
2018-08-22 17:42:04 +00:00
|
|
|
- ps: |-
|
2018-08-25 15:10:42 +00:00
|
|
|
if ($env:APPVEYOR_REPO_TAG -eq "true") {
|
2018-08-22 18:56:40 +00:00
|
|
|
Compress-Archive -CompressionLevel Optimal -Force `
|
|
|
|
-Path "$env:DENO_BUILD_PATH\deno.exe" `
|
|
|
|
-DestinationPath "$env:APPVEYOR_BUILD_FOLDER\$env:RELEASE_ARTIFACT"
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts:
|
|
|
|
path: $(RELEASE_ARTIFACT)
|
2018-08-22 17:42:04 +00:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
provider: GitHub
|
|
|
|
auth_token:
|
|
|
|
secure: HQIIUEOtep3yRiBacZCtX8hVmgtdNvt6Hx7u9fP4Wj2ZYp+eBFP2OLf67RKVa5VZ
|
|
|
|
on:
|
2018-08-22 18:56:40 +00:00
|
|
|
APPVEYOR_REPO_NAME: denoland/deno
|
|
|
|
APPVEYOR_REPO_TAG: true
|