Skip to content

Commit 73ba62a

Browse files
committed
Windows CI - #683
1 parent 2546a90 commit 73ba62a

File tree

4 files changed

+79
-26
lines changed

4 files changed

+79
-26
lines changed

.bazelrc.travis

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# This is from Bazel's former travis setup, to avoid blowing up the RAM usage.
2-
startup --host_jvm_args=-Xmx2500m
3-
startup --host_jvm_args=-Xms2500m
2+
startup --host_jvm_args=-Xmx3072m
3+
startup --host_jvm_args=-Xms1024m
44
# startup --batch # we actually start many bazels in the test script, we don't want batch
5-
test --ram_utilization_factor=10
65

76
# Just making sure that we don't OOM with parallel builds
8-
build --local_resources 2048,.5,1.0
7+
build --local_resources 3072,.5,1.0
98

109
# This is so we understand failures better
1110
build --verbose_failures
@@ -17,7 +16,7 @@ build --verbose_failures
1716
# runs stuff in a container, and since Travis already runs its script
1817
# in a container (unless you require sudo in your .travis.yml) this
1918
# fails to run tests.
20-
build --strategy=Scalac=worker --strategy=ScroogeRule=worker --worker_max_instances=3
19+
build --strategy=Scalac=worker --strategy=ScroogeRule=worker --worker_max_instances=2
2120
#test --test_strategy=standalone
2221

2322
# Below this line, .travis.yml will cat the default bazelrc.

.travis.yml

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sudo: required
44
# xcode8 has jdk8
55
osx_image: xcode8
66
# Not technically required but suppresses 'Ruby' in Job status message.
7-
language: java
7+
language: sh
88

99
cache:
1010
directories:
@@ -13,38 +13,54 @@ cache:
1313
os:
1414
- linux
1515
- osx
16+
- windows
1617

1718
env:
1819
# Linting is broken. Disable until fixed.
1920
# See https://github.com/bazelbuild/rules_scala/pull/622
2021
# we want to test the last release
2122
#- V=0.16.1 TEST_SCRIPT=test_lint.sh
22-
- V=0.23.1 TEST_SCRIPT=test_rules_scala.sh
23+
- V=0.23.1 TEST_SCRIPT=test_rules_scala
2324
#- V=0.14.1 TEST_SCRIPT=test_intellij_aspect.sh
24-
- V=0.23.1 TEST_SCRIPT=test_reproducibility.sh
25+
- V=0.23.1 TEST_SCRIPT=test_reproducibility
26+
2527

2628
before_install:
2729
- |
28-
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
29-
OS=darwin
30-
else
31-
sysctl kernel.unprivileged_userns_clone=1
32-
sudo apt-get update -q
33-
sudo apt-get install libxml2-utils -y
34-
OS=linux
35-
fi
36-
if [[ $V =~ .*rc[0-9]+.* ]]; then
37-
PRE_RC=$(expr "$V" : '\([0-9.]*\)rc.*')
38-
RC_PRC=$(expr "$V" : '[0-9.]*\(rc.*\)')
39-
URL="https://storage.googleapis.com/bazel/${PRE_RC}/${RC_PRC}/bazel-${V}-installer-${OS}-x86_64.sh"
30+
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
31+
choco install jdk8 -params 'installdir=c:\\java8'
32+
choco install bazel --version ${V}
4033
else
41-
URL="https://github.com/bazelbuild/bazel/releases/download/${V}/bazel-${V}-installer-${OS}-x86_64.sh"
34+
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
35+
OS=darwin
36+
else
37+
sudo sysctl kernel.unprivileged_userns_clone=1
38+
sudo add-apt-repository -y ppa:openjdk-r/ppa
39+
sudo apt-get update -q
40+
sudo apt-get install openjdk-8-jdk -y
41+
sudo apt-get install libxml2-utils -y
42+
OS=linux
43+
fi
44+
45+
if [[ $V =~ .*rc[0-9]+.* ]]; then
46+
PRE_RC=$(expr "$V" : '\([0-9.]*\)rc.*')
47+
RC_PRC=$(expr "$V" : '[0-9.]*\(rc.*\)')
48+
URL="https://storage.googleapis.com/bazel/${PRE_RC}/${RC_PRC}/bazel-${V}-installer-${OS}-x86_64.sh"
49+
else
50+
URL="https://github.com/bazelbuild/bazel/releases/download/${V}/bazel-${V}-installer-${OS}-x86_64.sh"
51+
fi
52+
wget -O install.sh "${URL}"
53+
chmod +x install.sh
54+
./install.sh --user
55+
rm -f install.sh
4256
fi
43-
wget -O install.sh "${URL}"
44-
chmod +x install.sh
45-
./install.sh --user
46-
rm -f install.sh
4757
- cat .bazelrc.travis >> .bazelrc
4858

4959
script:
50-
- bash $TEST_SCRIPT ci
60+
- |
61+
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
62+
powershell -Command 'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'
63+
powershell -File ./${TEST_SCRIPT}.ps1
64+
else
65+
bash ./${TEST_SCRIPT}.sh ci
66+
fi

test_reproducibility.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Set-StrictMode -Version latest
2+
$ErrorActionPreference = 'Stop'
3+

test_rules_scala.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env pwsh
2+
3+
Set-StrictMode -Version latest
4+
$ErrorActionPreference = 'Stop'
5+
6+
$env:JAVA_HOME='c:\\java8'
7+
8+
function bazel() {
9+
Write-Output ">> bazel $args"
10+
$global:lastexitcode = 0
11+
$backupErrorActionPreference = $script:ErrorActionPreference
12+
$script:ErrorActionPreference = "Continue"
13+
& bazel.exe @args 2>&1 | %{ "$_" }
14+
$script:ErrorActionPreference = $backupErrorActionPreference
15+
if ($global:lastexitcode -ne 0 -And $args[0] -ne "shutdown") {
16+
Write-Output "<< bazel $args (failed, exit code: $global:lastexitcode)"
17+
throw ("Bazel returned non-zero exit code: $global:lastexitcode")
18+
}
19+
Write-Output "<< bazel $args (ok)"
20+
}
21+
22+
bazel build //test/...
23+
bazel shutdown
24+
25+
bazel test `
26+
//test:HelloLibTest `
27+
//test:HelloLibTestSuite_test_suite_HelloLibTest.scala `
28+
//test:HelloLibTestSuite_test_suite_HelloLibTest2.scala `
29+
//test:TestFilterTests `
30+
//test:no_sig `
31+
//test/aspect:aspect_test `
32+
//test/aspect:scala_test `
33+
//test/proto:test_blacklisted_proto `
34+
//test/src/main/scala/scalarules/test/resource_jars:resource_jars `
35+
//test/src/main/scala/scalarules/test/twitter_scrooge/...

0 commit comments

Comments
 (0)