Skip to content

Commit

Permalink
.travis:Adjust travis related code
Browse files Browse the repository at this point in the history
Add arch key to facilitate subsequent support of multiple CPU arch;
Add function to install clang distinguish by CPU

Signed-off-by: Jianlin Lv <[email protected]>
  • Loading branch information
Jianlin-lv authored and tgraf committed Feb 25, 2020
1 parent 3b055d1 commit 3d81edb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ dist: trusty
sudo: required

go:
- 1.13.8
- 1.13.8

arch:
- amd64
- arm64

jobs:
allow_failures:
- arch: arm64

if: branch = master OR type = pull_request

Expand All @@ -17,6 +25,5 @@ before_install: ./.travis/prepare.sh

before_script:
- export PATH=/usr/local/clang/bin:$PATH
- export GO=/home/travis/.gimme/versions/go1.13.8.linux.amd64/bin/go

script: ./.travis/build.sh
35 changes: 26 additions & 9 deletions .travis/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
#!/bin/bash

CLANG_DIR="clang+llvm-3.8.1-x86_64-linux-gnu-ubuntu-14.04"
CLANG_FILE="${CLANG_DIR}.tar.xz"
CLANG_URL="http://releases.llvm.org/3.8.1/$CLANG_FILE"
CLANG_VERSION=3.8.1

wget -nv $CLANG_URL
sudo rm -rf /usr/local/clang
sudo mkdir -p /usr/local
sudo tar -C /usr/local -xJf $CLANG_FILE
sudo ln -s /usr/local/$CLANG_DIR /usr/local/clang
rm $CLANG_FILE
function setup_env() {
case `uname -m` in
'x86_64' )
CLANG_DIR="clang+llvm-$CLANG_VERSION-x86_64-linux-gnu-ubuntu-14.04"
;;
'aarch64' )
CLANG_DIR="clang+llvm-$CLANG_VERSION-aarch64-linux-gnu"
;;
esac
}

function install_clang() {
CLANG_FILE="$CLANG_DIR.tar.xz"
CLANG_URL="http://releases.llvm.org/$CLANG_VERSION/$CLANG_FILE"

wget -nv $CLANG_URL
sudo rm -rf /usr/local/clang
sudo mkdir -p /usr/local
sudo tar -C /usr/local -xJf $CLANG_FILE
sudo ln -s /usr/local/$CLANG_DIR /usr/local/clang
rm $CLANG_FILE
}

setup_env
install_clang

NEWPATH="/usr/local/clang/bin"
export PATH="$NEWPATH:$PATH"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ifeq ($(SKIP_KVSTORES),"false")
$(CONTAINER_ENGINE_FULL) run -d \
--name "cilium-etcd-test-container" \
-p 4002:4001 \
quay.io/coreos/etcd:v3.2.17 \
$(ETCD_IMAGE) \
etcd -name etcd0 \
-advertise-client-urls http://0.0.0.0:4001 \
-listen-client-urls http://0.0.0.0:4001 \
Expand Down
6 changes: 6 additions & 0 deletions Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ endif
# Container engine
CONTAINER_ENGINE?=docker
CONTAINER_ENGINE_FULL=$(QUIET)$(CONTAINER_ENGINE)

ifeq ($(shell uname -m),aarch64)
ETCD_IMAGE=quay.io/coreos/etcd:v3.2.17-arm64
else
ETCD_IMAGE=quay.io/coreos/etcd:v3.2.17
endif

0 comments on commit 3d81edb

Please sign in to comment.