Skip to content

Commit c616b23

Browse files
authored
Merge pull request #394 from feiskyer/windows-ci
Enable windows CI on travis
2 parents f559d44 + 49537a8 commit c616b23

File tree

3 files changed

+74
-5
lines changed

3 files changed

+74
-5
lines changed

.travis.yml

+31-4
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,57 @@ sudo: required
33
dist: trusty
44

55
go:
6-
- "1.11.1"
6+
- 1.11.x
7+
8+
os:
9+
- linux
10+
- windows
711

812
go_import_path: github.com/kubernetes-sigs/cri-tools
913

1014
services:
1115
- docker
1216

1317
before_install:
14-
- hack/install-docker.sh
15-
- hack/install-kubelet.sh
18+
- |
19+
(
20+
set -Eeuo pipefail
21+
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
22+
choco install -y make mingw
23+
export PATH="/c/tools/mingw64/bin:/c/ProgramData/chocolatey/bin;$PATH"
24+
fi
25+
)
1626
1727
install:
1828
- make install.tools
1929

2030
jobs:
2131
include:
2232
- stage: Static check
33+
os: linux # Only need to run on Linux
2334
script:
2435
- make lint
2536
- make gofmt
2637
- stage: Build
38+
os: linux # Only need to run on Linux
2739
script:
28-
- make release
40+
- make release
2941
- stage: Test
42+
os: linux
3043
script:
3144
- make
45+
- hack/install-docker.sh
46+
- hack/install-kubelet.sh
3247
- sudo env PATH=$PATH GOPATH=$GOPATH hack/run-critest.sh
48+
- stage: Test
49+
os: windows
50+
script:
51+
- make
52+
- powershell -c "Set-ExecutionPolicy Bypass -Scope CURRENTUSER -Force"
53+
- powershell hack/install-kubelet.ps1
54+
# Skip hack/run-critest.sh temporarily.
55+
56+
stages:
57+
- Static check
58+
- Build
59+
- Test

hack/install-docker.sh

-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ rm -f docker.tgz
3434

3535
# Restart docker daemon.
3636
sudo service docker restart
37-

hack/install-kubelet.ps1

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2017 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Stop on any error.
16+
$ErrorActionPreference = "Stop"
17+
$VerbosePreference = "Continue"
18+
19+
# Install kubelet
20+
$gopath = [System.Environment]::GetEnvironmentVariable("GOPATH")
21+
$k8siopath = $gopath + "/src/k8s.io"
22+
$kubernetespath = $k8siopath + "/kubernetes"
23+
mkdir -p $k8siopath
24+
cd $k8siopath
25+
git clone -c core.symlinks=true https://github.com/kubernetes/kubernetes
26+
27+
cd $kubernetespath
28+
$branch = [System.Environment]::GetEnvironmentVariable("TRAVIS_BRANCH")
29+
if ( ! "$branch".Equals("master") ) {
30+
# We can do this because cri-tools have the same branch name with kubernetes.
31+
git checkout "$branch"
32+
}
33+
34+
# Build kubelet
35+
$version = git describe --tags --dirty --always
36+
go build -ldflags "-X k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitVersion=$version -X k8s.io/kubernetes/pkg/version.gitVersion=$version" ./cmd/kubelet/kubelet.go
37+
cp ./kubelet.exe "$gopath/bin/"
38+
39+
# Dump version
40+
echo "Kubelet version:"
41+
kubelet.exe --version
42+
echo "Docker version:"
43+
docker version

0 commit comments

Comments
 (0)