Windows CI (#364)

* ci: remove the old Jenkins files

* WORKSPACE: remove unuset this_breaks_windows

* ci: add Windows builds to Azure Pipeline
This commit is contained in:
Michał Majcherski 2019-04-11 14:26:55 +02:00 committed by Jonas Chevalier
parent 61d8459494
commit 08bd36a10c
12 changed files with 137 additions and 219 deletions

3
.dadew
View File

@ -13,7 +13,6 @@
"nodejs-10.12.0",
"pester-4.4.2",
"python-3.6.7",
"pipenv-2018.11.26",
"wget-1.19.4"
"pipenv-2018.11.26"
]
}

View File

@ -665,12 +665,3 @@ jar_jar_repositories()
# dependencies.
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
# NOTE:
# this_breaks_windows_start
#
# wrap problematic parts of the WORKSPACE file with these markers /\--\/
# to get the middle part excluded for Windows builds on CI
#
# this_breaks_windows_stop

View File

@ -34,8 +34,9 @@ jobs:
steps:
- template: ci/build-unix.yml
# - job: Windows
# pool:
# vmImage: 'windows-2019'
# steps:
# - template: ci/build-windows.yml
- job: Windows
timeoutInMinutes: 360
pool:
vmImage: 'vs2017-win2016'
steps:
- template: ci/build-windows.yml

228
build.ps1
View File

@ -1,3 +1,5 @@
param ([String]$mode = 'full')
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
@ -8,165 +10,99 @@ $ErrorActionPreference = 'Stop'
function bazel() {
Write-Output ">> bazel $args"
$global:lastexitcode = 0
. bazel.exe --bazelrc=.\nix\bazelrc @args
if ($global:lastexitcode -ne 0) {
$backupErrorActionPreference = $script:ErrorActionPreference
$script:ErrorActionPreference = "Continue"
& bazel.exe --bazelrc=.\nix\bazelrc @args 2>&1 | %{ "$_" }
$script:ErrorActionPreference = $backupErrorActionPreference
if ($global:lastexitcode -ne 0 -And $args[0] -ne "shutdown") {
Write-Output "<< bazel $args (failed, exit code: $global:lastexitcode)"
throw ("Bazel returned non-zero exit code: $global:lastexitcode")
}
Write-Output "<< bazel $args (ok)"
}
# FIXME: Until all bazel issues on Windows are resolved we will be testing only specific bazel targets
function build-partial() {
bazel build `
//compiler/daml-lf-ast/... `
//daml-lf/interface/... `
//language-support/java/bindings/...
# general workspace test
bazel test //pipeline/samples/bazel/java/...
bazel shutdown
# zipper on Windows
# NOTE(FM): before we were just pulling the external sandbox, now we're building it,
# and it does not work.
# bazel build //ledger/sandbox:sandbox
bazel test `
//daml-lf/interface/... `
//language-support/java/bindings/...
}
# basic test for the haskell infrastructure
bazel build //pipeline/samples/bazel/haskell/...
bazel build //compiler/haskell-ide-core/...
bazel build //compiler/daml-lf-ast/...
function build-full() {
# FIXME: Until all bazel issues on Windows are resolved we will be testing only specific bazel targets
bazel build `
@com_github_grpc_grpc//:grpc `
//nix/third-party/gRPC-haskell/core:fat_cbits `
//daml-foundations/daml-tools/daml-extension:daml_extension_lib `
//daml-foundations/daml-tools/language-server-tests:lib-js `
//daml-lf/archive:daml_lf_archive_scala `
//daml-lf/archive:daml_lf_archive_protos_zip `
//daml-lf/archive:daml_lf_archive_protos_tarball `
//compiler/haskell-ide-core/... `
//compiler/daml-lf-ast/... `
//daml-lf/data/... `
//daml-lf/engine:engine `
//daml-lf/interface/... `
//daml-lf/interpreter/... `
//daml-lf/lfpackage/... `
//daml-lf/parser/... `
//daml-lf/repl/... `
//daml-lf/scenario-interpreter/... `
//daml-lf/transaction-scalacheck/... `
//daml-lf/validation/... `
//daml-foundations/daml-tools/docs/... `
//language-support/java/testkit:testkit `
//language-support/java/bindings/... `
//language-support/java/bindings-rxjava/... `
//ledger/backend-api/... `
//ledger/ledger-api-client/... `
//ledger/ledger-api-common/... `
//ledger/ledger-api-domain/... `
//ledger/ledger-api-server-example `
//ledger-api/rs-grpc-akka/... `
//pipeline/samples/bazel/java/... `
//pipeline/samples/bazel/haskell/...
# build gRPC
bazel build @com_github_grpc_grpc//:grpc
bazel build //nix/third-party/gRPC-haskell/core:fat_cbits
# XXX: Remove once haskell-gRPC builds
bazel build @haskell_c2hs//...
# ScalaCInvoker, a Bazel worker, created by rules_scala opens some of the bazel execroot's files,
# which later causes issues on Bazel init (source forest creation) on Windows. A shutdown closes workers,
# which is a workaround for this problem.
bazel shutdown
# node / npm / yarn test
bazel build //daml-foundations/daml-tools/daml-extension:daml_extension_lib
bazel build //daml-foundations/daml-tools/language-server-tests:lib-js
# ScalaCInvoker, a Bazel worker, created by rules_scala opens some of the bazel execroot's files,
# which later causes issues on Bazel init (source forest creation) on Windows. A shutdown closes workers,
# which is a workaround for this problem.
bazel shutdown
##################################################################
## ledger
bazel build //ledger/backend-api/...
bazel shutdown
bazel build //ledger/ledger-api-client/...
bazel shutdown
bazel test //ledger/ledger-api-client/...
bazel shutdown
bazel build //ledger/ledger-api-common/...
bazel shutdown
bazel test //ledger/ledger-api-common/...
bazel shutdown
bazel build //ledger/ledger-api-domain/...
bazel shutdown
bazel build //ledger/ledger-api-server-example
bazel shutdown
##################################################################
## ledger-api
bazel build //ledger-api/rs-grpc-akka/...
bazel shutdown
bazel test //ledger-api/rs-grpc-akka/...
bazel shutdown
###################################################################
## daml-lf (some parts of it are still not building correctly
# - falling back to target by target build until all issues are resolved)
# TODO: haskell targets left in //daml-lf/archive
bazel build //daml-lf/archive:daml_lf_archive_scala
bazel shutdown
bazel build //daml-lf/archive:daml_lf_archive_protos_zip
bazel build //daml-lf/archive:daml_lf_archive_protos_tarball
bazel build //daml-lf/data/...
bazel shutdown
bazel test //daml-lf/data/...
bazel shutdown
bazel build //daml-lf/engine:engine
bazel shutdown
bazel build //daml-lf/interface/...
bazel shutdown
bazel test //daml-lf/interface/...
bazel shutdown
bazel build //daml-lf/interpreter/...
bazel shutdown
bazel test `
//daml-lf/data/... `
//daml-lf/interface/... `
//daml-lf/lfpackage/... `
//daml-lf/parser/... `
//daml-lf/validation/... `
//language-support/java/bindings/... `
//language-support/java/bindings-rxjava/... `
//ledger/ledger-api-client/... `
//ledger/ledger-api-common/... `
//ledger-api/rs-grpc-akka/... `
//pipeline/samples/bazel/java/... `
//pipeline/samples/bazel/haskell/...
}
# FIXME: one of tests fails
#bazel test //daml-lf/interpreter/...
#bazel shutdown
bazel build //daml-lf/lfpackage/...
bazel shutdown
# FIXME:
# @haskell_c2hs//... `
#ERROR: C:/users/vssadministrator/_bazel_vssadministrator/w3d6ug6o/external/haskell_c2hs/BUILD.bazel:16:3: unterminated string literal at eol
#ERROR: C:/users/vssadministrator/_bazel_vssadministrator/w3d6ug6o/external/haskell_c2hs/BUILD.bazel:17:1: unterminated string literal at eol
#ERROR: C:/users/vssadministrator/_bazel_vssadministrator/w3d6ug6o/external/haskell_c2hs/BUILD.bazel:17:1: Implicit string concatenation is forbidden, use the + operator
#ERROR: C:/users/vssadministrator/_bazel_vssadministrator/w3d6ug6o/external/haskell_c2hs/BUILD.bazel:17:1: syntax error at '",
#"': expected ,
bazel test //daml-lf/lfpackage/...
bazel shutdown
bazel build //daml-lf/parser/...
bazel shutdown
bazel test //daml-lf/parser/...
bazel shutdown
bazel build //daml-lf/repl/...
bazel shutdown
#no tests
#bazel test //daml-lf/repl/...
#bazel shutdown
bazel build //daml-lf/scenario-interpreter/...
bazel shutdown
#no tests
#bazel test //daml-lf/scenario-interpreter/...
#bazel shutdown
bazel build //daml-lf/transaction-scalacheck/...
bazel shutdown
#no tests
#bazel test //daml-lf/transaction-scalacheck/...
#bazel shutdown
bazel build //daml-lf/validation/...
bazel shutdown
bazel test //daml-lf/validation/...
bazel shutdown
###################################################################
bazel build //daml-foundations/daml-tools/docs/...
##############################################################
## language-support
bazel build //language-support/java/testkit:testkit
bazel shutdown
bazel build //language-support/java/bindings/...
bazel shutdown
bazel test //language-support/java/bindings/...
bazel shutdown
bazel build //language-support/java/bindings-rxjava/...
bazel shutdown
bazel test //language-support/java/bindings-rxjava/...
bazel shutdown
###################################################################
Write-Output "Running in $mode mode"
if ($mode -eq "partial") {
build-partial
} else {
build-full
}

View File

@ -18,13 +18,16 @@ steps:
displayName: 'Platform-agnostic lints and checks'
condition: eq(variables['Agent.OS'], 'Linux')
- bash: ci/build.sh
displayName: 'Build'
- bash: ci/configure-bazel.sh
displayName: 'Configure Bazel'
env:
IS_FORK: $(System.PullRequest.IsFork)
# to upload to the bazel cache
GOOGLE_APPLICATION_CREDENTIALS_CONTENT: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)
- bash: ./build.sh "_$(uname)"
displayName: 'Build'
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:

View File

@ -1,8 +1,12 @@
steps:
- checkout: self
- powershell: '.\dev-env\windows\dadew-installer.ps1'
displayName: 'Install dev-env'
#- script: ./ci/configure-bazel.ps1
# displayName: 'Configure Bazel'
- powershell: '.\build.ps1'
displayName: 'Bazel Build'
- bash: ci/configure-bazel.sh
displayName: 'Configure Bazel'
env:
IS_FORK: $(System.PullRequest.IsFork)
# to upload to the bazel cache
GOOGLE_APPLICATION_CREDENTIALS_CONTENT: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)
- powershell: '.\build.ps1 partial'
displayName: 'Build'

View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
cd "$(dirname "$0")/.."
@ -11,27 +10,46 @@ step() {
echo "step: $*" >&2
}
to_lower() {
echo "$1" | tr '[:upper:]' '[:lower:]'
is_windows() {
[[ $os = windows ]]
}
## Main
kernel=$(to_lower "$(uname)")
# always run in the project root
cd "$(dirname "$0")/.."
# detect the OS
case $(uname) in
Linux)
os=linux
;;
Darwin)
os=darwin
;;
MINGW*)
os=windows
;;
*)
echo "unknown kernel: $(uname)"
exit 1
;;
esac
cd "$(dirname "$0")"/..
step "configuring bazel"
if is_windows; then
echo "build --config windows-ci" > .bazelrc.local
fi
# sets up write access to the shared remote cache if the branch is not a fork
if [[ "${IS_FORK}" = False ]]; then
step "configuring write access to the remote cache"
GOOGLE_APPLICATION_CREDENTIALS=$(mktemp)
GOOGLE_APPLICATION_CREDENTIALS=$(mktemp .tmp.XXXXXXXXXX)
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > "$GOOGLE_APPLICATION_CREDENTIALS"
unset GOOGLE_APPLICATION_CREDENTIALS_CONTENT
export GOOGLE_APPLICATION_CREDENTIALS
echo "build --remote_http_cache=https://storage.googleapis.com/daml-bazel-cache --remote_upload_local_results=true --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS}" >> .bazelrc.local
fi
# build
step "./build.sh"
./build.sh "_$kernel"

View File

@ -7,15 +7,6 @@ function da_install {
return
}
# show notification to change execution policy:
$execPolicy = Get-ExecutionPolicy
if($execPolicy -ne 'RemoteSigned' -and $execPolicy -ne 'Bypass') {
da_error "PowerShell requires an execution policy of 'RemoteSigned' to run DA Windows DevEnv - current policy: $execPolicy."
da_error "To make this change please run:"
da_error "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"
return
}
if([System.Enum]::GetNames([System.Net.SecurityProtocolType]) -notcontains 'Tls12') {
da_error "DA Windows DevEnv requires at least .NET Framework 4.5"
da_error "Please download and install it first:"

View File

@ -21,7 +21,7 @@
"env_add_path": ".",
"post_install": [
"try { bash.exe -lc 'pacman --version' } catch { }",
"bash.exe -lc 'pacman -S --noconfirm patch unzip zip vim mingw-w64-x86_64-gcc'",
"bash.exe -lc 'pacman -S --noconfirm patch unzip zip mingw-w64-x86_64-gcc'",
"try { bash.exe -lc 'pacman -S --noconfirm tar' } catch { }",
"mkdir $dir\\bin",
"cp $dir\\mingw64\\bin\\*.dll $dir\\bin"

View File

@ -1,7 +0,0 @@
{
"version": "0.0.1",
"tools": [
"cacert",
"wget-1.19.4"
]
}

View File

@ -1,22 +0,0 @@
#!/usr/bin/env groovy
@Library('da-jenkins-build-helpers@v0.76') _
pipeline {
agent {label 'ghc'}
options {
timeout(time: 45, unit: 'MINUTES')
timestamps()
disableConcurrentBuilds()
}
stages {
stage('Build'){
steps {
dir('ghc-lib/ci/jenkins') {
sh './run-ci.sh'
}
}
}
}
}

View File

@ -81,6 +81,10 @@ build:windows-ci --crosstool_top=@io_tweag_rules_haskell_ghc_windows_amd64//:too
# source information and doesn't provide an option to turn this flag on.
# Ideally we would only set this option for the proto_library target we care about.
# See https://github.com/bazelbuild/rules_go/issues/1519#issuecomment-451622947
build --protocopt=--include_source_info
build:linux --protocopt=--include_source_info
build:darwin --protocopt=--include_source_info
#FIXME: it generates stderr, which is causing error in bazel on windows:
# https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/compiler/command_line_interface.cc#L1363
#build:windows --protocopt=--include_source_info
try-import %workspace%/.bazelrc.local