Skip to content

Commit

Permalink
Add CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Jun 11, 2017
1 parent a9336ec commit 72bf76a
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 44 deletions.
38 changes: 8 additions & 30 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
/build
/simpleimage/*.img
/simpleimage/*.fex
/simpleimage/*.bin
/simpleimage/releases
/u-boot-postprocess/out
/lichee
/u-boot-pine64
/arm-trusted-firmware-pine64
/sunxi-pack-tools
/mkbootimg
/linux
/kernel/*.img
/kernel/initrd.gz
/kernel/*.dtb
/kernel/uEnv.txt
/kernel/releases
/busybox
/blobs/*.dtb
*.snap
/snappy/releases
/snappy/*.img
/snappy/*/stage
/snappy/*/prime
/snappy/*/parts
/snappy/gadget/uboot.env
/snappy/gadget/uboot.conf
/snappy/gadget/boot-assets
/boot-tools/
/*.deb

/kernel
/out
/rkbin
/u-boot
/.repo
*.img
*.img.xz
*.deb
130 changes: 130 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/**
properties([
parameters([
string(defaultValue: '1.0', description: 'Current version number', name: 'VERSION'),
text(defaultValue: '', description: 'A list of changes', name: 'CHANGES'),
booleanParam(defaultValue: false, description: 'If build should be marked as pre-release', name: 'PRERELEASE'),
string(defaultValue: 'ayufan-rock64', description: 'GitHub username or organization', name: 'GITHUB_USER'),
string(defaultValue: 'linux-build', description: 'GitHub repository', name: 'GITHUB_REPO'),
])
])
*/

node('docker && linux-build') {
timestamps {
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
stage "Environment"
checkout scm

def environment = docker.build('build-environment:build-rock64-image', 'environment')

environment.inside("--privileged -u 0:0") {
withEnv([
"USE_CCACHE=true",
"RELEASE_NAME=$VERSION",
"RELEASE=$BUILD_NUMBER"
]) {
stage 'Prepare'
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
ccache -M 0 -F 0
git clean -ffdx -e ccache
'''

stage 'Sources'
sh '''#!/bin/bash
set -xe
export HOME=$WORKSPACE
export USER=jenkins
repo init -u https://github.com/ayufan-rock64/manifests -b default --depth=1
repo sync -j 20 -c --force-sync
'''

stage 'U-boot'
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make u-boot
'''

stage 'Kernel'
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make kernel
'''

stage 'Images'
sh '''#!/bin/bash
set +xe
export CCACHE_DIR=$WORKSPACE/ccache
make
'''
}

withEnv([
"VERSION=$VERSION",
"CHANGES=$CHANGES",
"PRERELEASE=$PRERELEASE",
"GITHUB_USER=$GITHUB_USER",
"GITHUB_REPO=$GITHUB_REPO"
]) {
stage 'Freeze'
sh '''#!/bin/bash
# use -ve, otherwise we could leak GITHUB_TOKEN...
set -ve
shopt -s nullglob
export HOME=$WORKSPACE
export USER=jenkins
repo manifest -r -o manifest.xml
'''

stage 'Release'
sh '''#!/bin/bash
set -xe
shopt -s nullglob
github-release release \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}" \
--draft
github-release upload \
--tag "${VERSION}" \
--name "manifest.xml" \
--file "manifest.xml"
for file in *.xz *.deb; do
github-release upload \
--tag "${VERSION}" \
--name "$(basename "$file")" \
--file "$file" &
done
wait
if [[ "$PRERELEASE" == "true" ]]; then
github-release edit \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}" \
--pre-release
else
github-release edit \
--tag "${VERSION}" \
--name "$VERSION: $BUILD_TAG" \
--description "${CHANGES}\n\n${BUILD_URL}"
fi
'''
}
}
}
}
}
46 changes: 32 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ linux-rock64-package-$(RELEASE_NAME).deb: package package/rtk_bt/rtk_hciattach/r
%.img.xz: %.img
pxz -f -3 $<

xenial-minimal-rock64-$(RELEASE_NAME)-$(RELEASE).img: linux-rock64-package-$(RELEASE_NAME).deb
xenial-minimal-rock64-$(RELEASE_NAME)-$(RELEASE)-system.img: linux-rock64-package-$(RELEASE_NAME).deb
sudo bash ./build-system-image.sh \
$(shell readlink -f $@) \
$(shell readlink -f $<) \
Expand All @@ -43,47 +43,65 @@ xenial-minimal-rock64-$(RELEASE_NAME)-$(RELEASE).img: linux-rock64-package-$(REL
rock64 \
minimal

xenial-minimal-rock64-$(RELEASE_NAME)-$(RELEASE).img: linux-rock64-package-$(RELEASE_NAME).deb
sudo bash ./build-system-image.sh \
xenial-minimal-rock64-$(RELEASE_NAME)-$(RELEASE)-system.img: linux-rock64-package-$(RELEASE_NAME).deb
cd rootfs/ && sudo bash ./build-system-image.sh \
$(shell readlink -f $@) \
$(shell readlink -f $<) \
$(shell readlink -f linux-rock64-$(RELEASE_NAME).tar.xz) \
"" \
"" \
$(shell readlink -f linux-rock64-package-$(RELEASE_NAME).deb) \
xenial \
rock64 \
minimal

xenial-mate-rock64-$(RELEASE_NAME)-$(RELEASE).img: linux-rock64-package-$(RELEASE_NAME).deb
sudo bash ./build-system-image.sh \
xenial-mate-rock64-$(RELEASE_NAME)-$(RELEASE)-system.img: linux-rock64-package-$(RELEASE_NAME).deb
cd rootfs/ && sudo bash ./build-system-image.sh \
$(shell readlink -f $@) \
$(shell readlink -f $<) \
"" \
"" \
$(shell readlink -f linux-rock64-package-$(RELEASE_NAME).deb) \
xenial \
rock64 \
mate \
7300

xenial-i3-rock64-$(RELEASE_NAME)-$(RELEASE).img: linux-rock64-package-$(RELEASE_NAME).deb
sudo bash ./build-system-image.sh \
xenial-i3-rock64-$(RELEASE_NAME)-$(RELEASE)-system.img: linux-rock64-package-$(RELEASE_NAME).deb
cd rootfs/ && sudo bash ./build-system-image.sh \
$(shell readlink -f $@) \
$(shell readlink -f $<) \
"" \
"" \
$(shell readlink -f linux-rock64-package-$(RELEASE_NAME).deb) \
xenial \
rock64 \
i3

stretch-i3-rock64-$(RELEASE_NAME)-$(RELEASE).img: linux-rock64-package-$(RELEASE_NAME).deb
sudo bash ./build-system-image.sh \
stretch-i3-rock64-$(RELEASE_NAME)-$(RELEASE)-system.img: linux-rock64-package-$(RELEASE_NAME).deb
cd rootfs/ && sudo bash rootfs/build-system-image.sh \
$(shell readlink -f $@) \
$(shell readlink -f $<) \
"" \
"" \
$(shell readlink -f linux-rock64-package-$(RELEASE_NAME).deb) \
stretch \
rock64 \
i3

out/kernel/Image out/kernel/rk3328-rock64.dtb: kernel/arch/arm64/configs/rockchip_linux_defconfig
build/mk-kernel.sh rk3328-rock64

out/boot.img: out/kernel/Image out/kernel/rk3328-rock64.dtb
build/mk-image.sh -c rk3328 -t boot

out/u-boot/uboot.img: u-boot/configs/rock64-rk3328_defconfig
build/mk-uboot.sh rk3328-rock64

%.img: %-system.img
build/mk-image.sh -c rk3328 -t system -s 4000 -r "$<" -o "$@"

.PHONY: kernel
kernel: out/boot.img

.PHONY: u-boot
u-boot: out/u-boot/uboot.img

.PHONY: linux-package
linux-package: linux-rock64-package-$(RELEASE_NAME).deb

Expand Down
22 changes: 22 additions & 0 deletions environment/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ubuntu:xenial

RUN apt-get update -y
RUN apt-get install -y python git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip mtools u-boot-tools \
htop iotop sysstat iftop pigz bc device-tree-compiler lunzip \
dosfstools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi ccache \
sudo cpio nano vim kmod kpartx wget bsdtar qemu-user-static \
pxz ruby-dev debootstrap multistrap

RUN gem install fpm

RUN curl -L https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2 | tar -C /tmp -jx && \
mv /tmp/bin/linux/amd64/github-release /usr/local/bin/

RUN which github-release

ENV USER=root \
HOME=/root

0 comments on commit 72bf76a

Please sign in to comment.