From 96953eeab3ba66ad40fc813093b69fb3afc0371d Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Sun, 6 Sep 2020 21:51:54 +0000 Subject: [PATCH] draft jenkins file --- tests/gadget-zero/Jenkinsfile | 71 +++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/gadget-zero/Jenkinsfile diff --git a/tests/gadget-zero/Jenkinsfile b/tests/gadget-zero/Jenkinsfile new file mode 100644 index 00000000..939fb9e0 --- /dev/null +++ b/tests/gadget-zero/Jenkinsfile @@ -0,0 +1,71 @@ + +pipeline { + agent {label 'locm3-usb'} + parameters { + string(name:'pr_from_git_url', description:'the git url we are going to clone the pr from') + string(name:'pr_from_sha', description:'what we are going to build') + } + + stages { + # TODO - set build status to pneding.... + stage('checkout') { + steps { + step([$class: 'GitHubSetCommitStatusBuilder']) + checkout([$class: 'GitSCM', branches: [[name: $pr_from_sha]], userRemoteConfigs: [[url: $pr_from_git_url]]]) + } + } + stage('build') { + steps { + sh 'make -j5 V=s' + sh 'make -C tests/gadget-zero all V=s' + } + } + stage('Testprepare') { + steps { + sh label: 'preparing ', script: ''' + [ -f .env3 ] || python3 -m venv .env3 + . .env/bin/activate + pip install pyusb + pip install unittest-xml-reporting + ''' + sh label: 'gadget0', script: ''' + cd tests/gadget-zero + echo "hla_serial 53FF6E066765505136472567" > openocd.stm32f3-disco.local.cfg + echo "hla_serial 57FF6B064967485630481087" > openocd.stm32f4disco.local.cfg + ''' + } + } + stage('flashin') { + steps { + dir('tests/gadget-zero') { + sh ''' + make -f Makefile.stm32f3-disco flash V=1 + make -f Makefile.stm32f4disco flash V=1 + ''' + } + } + } + stage('run-test') { + steps { + sh ''' + . .env/bin/activate + cd tests/gadget-zero + python test_gadget0.py -X + for x in tests/*; do TT=$(basename $x); sed -i "s/testcase classname=\"/testcase classname=\"${TT}./g" $x/TEST-*; done + ''' + } + } + } + post { + always { + junit 'tests/gadget-zero/tests/*/TEST-*.xml' + step([ + $class: "GitHubCommitStatusSetter", + commitShaSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/karlp/libopencm3"], + reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/karlp/libopencm3"], + contextSource: [$class: "DefaultCommitContextSource"], + statusResultSource: [ $class: "DefaultStatusResultSource"] + ]); + } + } +}