Commit 0984e0d3 authored by Paul Barker's avatar Paul Barker Committed by Paul Barker

CI: Initial implementation of new CI scheme

Signed-off-by: Paul Barker's avatarPaul Barker <pbarker@toganlabs.com>
parent ec3e945b
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- export ORYX_VERSION=${CI_BUILD_REF_SLUG}_$(date -I)
- echo 'INHERIT += "rm_work"' > build/conf/auto.conf
- mkdir -p ~/ci-cache/{sstate-cache,downloads}
- ln -sfn ~/ci-cache/sstate-cache build/
- ln -sfn ~/ci-cache/downloads build/
- source build/conf/setenv
after_script:
- rm -rf build/tmp
- rm -rf build/cache
qemux86:
script:
- ./scripts/run-build.py -M qemux86 -V ${ORYX_VERSION}
- ./ci/run.py ${CI_BUILD_REF_SLUG}_$(date -I) qemux86
raspberrypi3:
script:
- ./scripts/run-build.py -M raspberrypi3 -V ${ORYX_VERSION}
- ./ci/run.py ${CI_BUILD_REF_SLUG}_$(date -I) raspberrypi3
raspberrypi3-64:
script:
- ./scripts/run-build.py -M raspberrypi3-64 -V ${ORYX_VERSION}
- ./ci/run.py ${CI_BUILD_REF_SLUG}_$(date -I) raspberrypi3-64
beaglebone-yocto:
script:
- ./scripts/run-build.py -M beaglebone-yocto -V ${ORYX_VERSION}
- ./ci/run.py ${CI_BUILD_REF_SLUG}_$(date -I) beaglebone-yocto
# Configuration modifications for CI
INHERIT += "rm_work"
DL_DIR = "~/ci-cache/downloads"
SSTATE_DIR = "~/ci-cache/sstate-cache"
#! /usr/bin/env python3
import argparse
import shutil
import subprocess
import sys
BUILDS = (
# SYSTEM_PROFILE APPLICATION_PROFILE
( 'native' , 'host' ),
( 'native' , 'host-test' ),
( 'guest' , 'minimal' ),
( 'guest' , 'full-cmdline' )
)
N_BUILDS = len(BUILDS)
def msg(message):
print(message, flush=True)
def parse_args():
parser = argparse.ArgumentParser(
description='CI script for Oryx Embedded Linux')
parser.add_argument('version', help='Version string used to identify this build')
parser.add_argument('machine', help='Machine to test')
return parser.parse_args()
def prepare():
msg('>>> Copying CI configuration')
shutil.copyfile('ci/auto.conf', 'build/conf/auto.conf')
def run_build(version, machine, sys_profile, app_profile):
script = 'source build/conf/setenv && ./scripts/run-build.py -k -V %s -M %s -S %s -A %s' % (
version, machine, sys_profile, app_profile)
cp = subprocess.run(script, shell=True, executable='/bin/bash')
return cp.returncode
def run_all_builds(version, machine):
failures = 0
for i, (sys_profile, app_profile) in enumerate(BUILDS, 1):
msg('>>> Running build %d of %d' % (i, N_BUILDS))
rc = run_build(version, machine, sys_profile, app_profile)
if rc == 0:
msg('>>> Build succeeded')
else:
msg('>>> Build failed')
failures += 1
msg('>>> Completed %d builds with %d failures' % (N_BUILDS, failures))
if failures > 0:
return 1
else:
return 0
def cleanup():
msg('>>> Removing tmp & cache directories')
shutil.rmtree('build/tmp')
shutil.rmtree('build/cache')
def main():
args = parse_args()
prepare()
rc = run_all_builds(args.version, args.machine)
cleanup()
sys.exit(rc)
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment