Skip to content

Commit

Permalink
Merge pull request torvalds#395 from tavip/lkl-fix-circle-ci
Browse files Browse the repository at this point in the history
A few fixes and improvements for circleci
  • Loading branch information
tavip authored Nov 13, 2017
2 parents 52a6a64 + 2a0c8e2 commit 8fbd00d
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 131 deletions.
215 changes: 94 additions & 121 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,168 +2,140 @@ version: 2
general:
artifacts:

do_steps: &do_steps
steps:
- run: echo "$CROSS_COMPILE" > ~/_cross_compile
- restore_cache:
key: code-tree-shallow
- run:
name: checkout build tree
command: |
mkdir -p ~/.ssh/
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
if ! [ -d .git ]; then
git clone --depth=1 $CIRCLE_REPOSITORY_URL .;
fi
if [[ $CIRCLE_BRANCH == pull/* ]]; then
git fetch --depth=1 origin $CIRCLE_BRANCH/head;
else
git fetch --depth=1 origin $CIRCLE_BRANCH;
fi
git reset --hard $CIRCLE_SHA1
- save_cache:
key: code-tree-shallow-{{ epoch }}
paths:
- /home/ubuntu/project/.git
- run: cd tools/lkl && make clean
- run: mkdir -p /home/ubuntu/.ccache
- restore_cache:
key: compiler-cache-{{ checksum "~/_cross_compile" }}
- run:
name: build DPDK
command: |
if [ "$MKARG" = "dpdk=yes" ]; then
sudo apt-get update && sudo apt-get install -y linux-headers-$(uname -r)
cd tools/lkl && ./scripts/dpdk-sdk-build.sh;
fi
- run:
name: copy mingw binutils
command: |
if [ "$CROSS_COMPILE" = "i686-w64-mingw32-" ]; then
sudo cp tools/lkl/bin/i686-w64-mingw32-* /usr/bin;
fi
- run:
name: start android emulator
command: |
if [[ $CROSS_COMPILE == *android* ]]; then
emulator -avd Nexus5_API24 -no-window -no-audio -no-boot-anim;
fi
background: true
- run: cd tools/lkl && make -j8 ${MKARG}
- save_cache:
paths:
- /home/ubuntu/.ccache
key: compiler-cache-{{ checksum "~/_cross_compile" }}-{{ epoch }}
- run:
name: wait android emulator to boot
command: |
if [[ $CROSS_COMPILE == *android* ]]; then
/home/ubuntu/circle-android.sh wait-for-boot;
fi
- run: cd tools/lkl && make test
- run: if [ $VALGRIND = 1]; then cd tools/lkl && make valgrind; fi
- run:
name: save test results
command: |
mkdir -p ~/junit/
find ./tools/lkl/ -type f -name "*.xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
- store_artifacts:
path: ~/junit

## Customize the test machine
jobs:
x86_64:
docker:
- image: thehajime/lkl-docker:1.1
- image: lkldocker/circleci-x86_64:0.1
environment:
CROSS_COMPILE: ""
MKARG: "dpdk=yes"
LKL_TEST_DHCP: 1
steps:
- run: mkdir -p /home/ubuntu/.ccache
- restore_cache:
key: compiler-cache0
# speed up `git clone` instead of `checkout`
- run:
name: checkout build tree
command: |
mkdir -p ~/.ssh/
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
git clone --depth=1 --branch $CIRCLE_BRANCH --single-branch $CIRCLE_REPOSITORY_URL .
git reset --hard $CIRCLE_SHA1
- run: cd tools/lkl && make clean
- run: sudo apt-get update && sudo apt-get install -y linux-headers-$(uname -r)
- run: cd tools/lkl && ./scripts/dpdk-sdk-build.sh
- run: cd tools/lkl && make -j8 ${MKARG}
- run: cd tools/lkl && make test
- save_cache:
key: compiler-cache0-{{ checksum "~/project/tools/lkl/liblkl-hijack.so" }}
paths:
- /home/ubuntu/.ccache
<<: *do_steps

mingw32:
docker:
- image: thehajime/lkl-docker:1.1
- image: lkldocker/circleci-mingw:0.1
environment:
CROSS_COMPILE: "i686-w64-mingw32-"
LKL_TEST_DHCP: 1
steps:
- run: mkdir -p /home/ubuntu/.ccache
- restore_cache:
key: compiler-cache1
- restore_cache:
key: code-tree
- checkout
- save_cache:
key: code-tree
paths:
- /home/ubuntu/project/.git
- run: sudo cp tools/lkl/bin/i686-w64-mingw32-* /usr/bin
- run: cd tools/lkl && make clean
- run: cd tools/lkl && make -j8 ${MKARG}
- run: cd tools/lkl && make test
- run: git fetch --tags git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
- run: tools/lkl/scripts/checkpatch.sh
- save_cache:
key: compiler-cache1-{{ checksum "~/project/tools/lkl/liblkl.dll" }}
paths:
- /home/ubuntu/.ccache
<<: *do_steps

android-arm32:
docker:
- image: thehajime/lkl-docker:1.1
- image: lkldocker/circleci-android-arm32:0.1
environment:
CROSS_COMPILE: "arm-linux-androideabi-"
LKL_TEST_DHCP: 1
LKL_ANDROID_TEST: 1
ANDROID_SDK_ROOT: /home/ubuntu/android-sdk
steps:
- run: mkdir -p /home/ubuntu/.ccache
- restore_cache:
key: compiler-cache2
# speed up `git clone` instead of `checkout`
- run:
name: checkout build tree
command: |
mkdir -p ~/.ssh/
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
git clone --depth=1 --branch $CIRCLE_BRANCH --single-branch $CIRCLE_REPOSITORY_URL .
git reset --hard $CIRCLE_SHA1
- run: cd tools/lkl && make clean
- run: cd tools/lkl && make -j8 ${MKARG}
- run:
command: emulator -avd Nexus5_API24 -no-window
background: true
- run: /home/ubuntu/circle-android.sh wait-for-boot
- run: cd tools/lkl && make test
- save_cache:
key: compiler-cache2-{{ checksum "~/project/tools/lkl/liblkl-hijack.so" }}
paths:
- /home/ubuntu/.ccache
<<: *do_steps

android-aarch64:
docker:
- image: thehajime/lkl-docker:1.1
- image: lkldocker/circleci-android-arm64:0.1
environment:
CROSS_COMPILE: "aarch64-linux-android-"
LKL_TEST_DHCP: 1
LKL_ANDROID_TEST: 1
ANDROID_SDK_ROOT: /home/ubuntu/android-sdk
steps:
- run: mkdir -p /home/ubuntu/.ccache
- restore_cache:
key: compiler-cache3
# speed up `git clone` instead of `checkout`
- run:
name: checkout build tree
command: |
mkdir -p ~/.ssh/
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
git clone --depth=1 --branch $CIRCLE_BRANCH --single-branch $CIRCLE_REPOSITORY_URL .
git reset --hard $CIRCLE_SHA1
- run: cd tools/lkl && make clean
- run: cd tools/lkl && make -j8 ${MKARG}
- run:
command: emulator -avd Nexus5X_API24 -no-window
background: true
- run: /home/ubuntu/circle-android.sh wait-for-boot
- run: cd tools/lkl && make test
- save_cache:
key: compiler-cache3-{{ checksum "~/project/tools/lkl/liblkl-hijack.so" }}
paths:
- /home/ubuntu/.ccache
<<: *do_steps

x86_64_valgrind:
docker:
- image: thehajime/lkl-docker:1.1
- image: lkldocker/circleci-x86_64:0.1
environment:
CROSS_COMPILE: ""
MKARG: "dpdk=yes"
LKL_TEST_DHCP: 1
VALGRIND: 1
<<: *do_steps

checkpatch:
docker:
- image: lkldocker/circleci:0.1
environment:
steps:
- run: mkdir -p /home/ubuntu/.ccache
- restore_cache:
key: compiler-cache4
# speed up `git clone` instead of `checkout`
- run:
name: checkout build tree
command: |
mkdir -p ~/.ssh/
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
git clone --depth=1 --branch $CIRCLE_BRANCH --single-branch $CIRCLE_REPOSITORY_URL .
git reset --hard $CIRCLE_SHA1
- run: cd tools/lkl && make clean
- run: sudo apt-get update && sudo apt-get install -y linux-headers-$(uname -r)
- run: cd tools/lkl && ./scripts/dpdk-sdk-build.sh
- run: cd tools/lkl && make -j8 ${MKARG}
- run: cd tools/lkl && make test
- run: cd tools/lkl && make valgrind
- run:
name: Save test results
command: |
mkdir -p ~/junit/
find ./tools/lkl/ -type f -name "*.xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
- store_artifacts:
path: ~/junit
key: code-tree-full-history
- checkout
- run: tools/lkl/scripts/checkpatch.sh
- save_cache:
key: compiler-cache4-{{ checksum "~/project/tools/lkl/liblkl-hijack.so" }}
key: code-tree-full-history-{{ epoch }}
paths:
- /home/ubuntu/.ccache
- /home/ubuntu/project/.git
when: always

workflows:
version: 2
Expand All @@ -173,3 +145,4 @@ workflows:
- mingw32
- android-arm32
- android-aarch64
- checkpatch
11 changes: 1 addition & 10 deletions tools/lkl/scripts/checkpatch.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
#!/bin/sh -ex

# Sometime we might want to skip certain checkpatch.pl errors
# (e.g. when trying to preserve existing code style that checkpatch.pl
# complains about). In that case just add a new variable in the
# CircleCI project settings and rebuild. Don't forget to remove them
# after restarting the build.
if [ -n "$SKIP_CHECKPATCH" ]; then
exit 0
fi

if [ -z "$origin_master" ]; then
origin_master="origin/master"
fi
Expand All @@ -20,7 +11,7 @@ upstream=`git remote -v | grep $UPSTREAM | cut -f1 | head -n1`
lkl=`git remote -v | grep $LKL | cut -f1 | head -n1`

if [ -z "$upstream" ]; then
git fetch --tags --progress http://$UPSTREAM
git fetch --tags --progress git://$UPSTREAM
else
git fetch --tags $upstream
fi
Expand Down

0 comments on commit 8fbd00d

Please sign in to comment.