diff --git a/tools/jenkins.yaml b/tools/jenkins.yaml deleted file mode 100644 index f5da744..0000000 --- a/tools/jenkins.yaml +++ /dev/null @@ -1,552 +0,0 @@ -# ----- weather-station - Defaults -------------------------------------------- - -- defaults: - name: global - description: atMETEO - An ATmega based weather station - project-type: freestyle - concurrent: true - wrappers: - - ansicolor - - timestamps - - -# ----- Parameter ------------------------------------------------------------- - -- parameter: - name: gitlab-parameters - parameters: - - string: - name: SourceBranch - default: master - - string: - name: TargetBranch - default: master - - -# ----- Properties ------------------------------------------------------------ - -- property: - name: logrotate-property - properties: - - build-discarder: - num-to-keep: 10 - -- property: - name: gitlab-properties - properties: - - gitlab: - connection: https://gitlab.kef-strass.com - - inject: - groovy-content: | - // overrides "SourceBranch" and "TargetBranch" parameters if - // gitlabSourceBranch or gitlabTargetBranch env vars are set - import hudson.model.* - def currentParamActions = currentBuild.getAction( - ParametersAction.class) - def currentParams = currentParamActions.getParameters() - List newParams = [] - def map = [:] - currentParams.each() { - if (it.name.equals('SourceBranch') && - binding.variables.containsKey('gitlabSourceBranch')) - { - def branch = binding.variables.gitlabSourceBranch - newParams << new StringParameterValue('SourceBranch', - branch) - map.SourceBranch = branch - } else if (it.name.equals('TargetBranch') && - binding.variables.containsKey('gitlabTargetBranch')) - { - def branch = binding.variables.gitlabTargetBranch - newParams << new StringParameterValue('TargetBranch', - branch) - map.TargetBranch = branch - } else { - newParams.add(it) - } - } - currentBuild.actions.remove(currentParamActions) - currentBuild.actions.add( - currentParamActions.createUpdated(newParams)) - return map - - -# ----- SCM ------------------------------------------------------------------- - -- scm: - name: scm-git - scm: - - git: - url: git@gitlab.kef-strass.com:fetzerch/weather-station.git - basedir: sources - submodule: - recursive: true - branches: - - origin/${SourceBranch} - merge: - branch: ${TargetBranch} - browser: gitlab - browser-url: https://gitlab.kef-strass.com/fetzerch/weather-station - - -# ----- Builder --------------------------------------------------------------- - -- builder: - name: build-linux-desktop - builders: - - shell: | - #!/bin/bash -eux - export TERM=xterm - cmake() { unbuffer /usr/bin/cmake "$@"; } - make() { /usr/bin/make -j$(nproc) VERBOSE=1 "$@"; } - - echo -e "\n----- CMake -----\n" - rm -rf $WORKSPACE/build-linux64 - mkdir $WORKSPACE/build-linux64 ; cd $WORKSPACE/build-linux64 - cmake -DCMAKE_BUILD_TYPE=Coverage \ - $WORKSPACE/sources - - echo -e "\n----- Compile -----\n" - make 2> >(tee gcc_stderr.log >&2) - - echo -e "\n----- Execute unit tests with valgrind -----\n" - valgrind --leak-check=full --track-origins=yes \ - --xml=yes --xml-file=tests/valgrind.xml \ - tests/tests -s -r junit -o tests/junit.xml || true - - echo -e "\n----- Build code coverage information -----\n" - make gcovr_to_cobertura - - echo -e "\n----- Build documentation -----\n" - make dox 2> >(tee doxygen_stderr.log >&2) - -- builder: - name: build-linux-desktop-scanbuild - builders: - - shell: | - #!/bin/bash -eu - export TERM=xterm - cmake() { unbuffer /usr/bin/cmake "$@"; } - make() { /usr/bin/make -j$(nproc) VERBOSE=1 "$@"; } - - echo -e "\n----- CMake -----\n" - rm -rf $WORKSPACE/build-scanbuild - mkdir $WORKSPACE/build-scanbuild ; cd $WORKSPACE/build-scanbuild - scan-build cmake \ - -DCMAKE_BUILD_TYPE=Debug \ - $WORKSPACE/sources - - echo "\n----- Analyze -----\n" - rm -rf $WORKSPACE/clangScanBuildReports - scan-build -v -v \ - -o $WORKSPACE/clangScanBuildReports \ - make 2> >(tee scan-build_stderr.log >&2) - -- builder: - name: build-linux-target - builders: - - shell: | - #!/bin/bash -eu - export TERM=xterm - cmake() {{ unbuffer /usr/bin/cmake "$@"; }} - make() {{ /usr/bin/make -j$(nproc) VERBOSE=1 "$@"; }} - - echo -e "\n----- cmake-avr -----\n" - CMAKE_AVR_URL=https://github.com/mkleemann/cmake-avr.git - if [ ! -e cmake-avr ]; then - git clone $CMAKE_AVR_URL $WORKSPACE/cmake-avr - fi - TOOLCHAIN_FILE=$WORKSPACE/cmake-avr/generic-gcc-avr.cmake - - echo -e "\n----- CMake -----\n" - rm -rf $WORKSPACE/build-{configuration} - mkdir $WORKSPACE/build-{configuration} - cd $WORKSPACE/build-{configuration} - cmake -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE \ - -DBUILD_DOCUMENTATION=OFF \ - -DTARGET_CONFIGURATION={configuration} \ - -DAVR_MCU={avr-mcu} \ - $WORKSPACE/sources - - echo -e "\n----- Compile -----\n" - make 2> >(tee gcc_stderr.log >&2) - -- builder: - name: build-linux-arduino-flash - builders: - - shell: | - #!/bin/bash -eu - DEVICE={device} - IMAGE="$WORKSPACE/sensors-atmega328p.hex" - - echo -e "\n----- Resetting USB port -----\n" - sudo /usr/local/bin/usbreset.sh "$DEVICE" - - if md5sum -c "$IMAGE.md5"; then - echo -e "\n----- Skipping Flashing -----\n" - else - echo -e "\n----- Flashing -----\n" - avrdude -v -c arduino -P "$DEVICE" -p atmega328p \ - -U "flash:w:$IMAGE:i" - md5sum "$IMAGE" > "$IMAGE.md5" - fi - -- builder: - name: build-linux-arduino-test - builders: - - shell: | - #!/bin/bash -eu - DEVICE={device} - - echo -e "\n----- Testing build -----\n" - rm -f "$WORKSPACE/testresults.log" - export PYTHONUNBUFFERED=1 - /home/pi/weather_station.py --serial-port="$DEVICE" \ - --num-read=3 | \ - tee "$WORKSPACE/testresults.log" - - echo -e "\n----- Verifying test results -----\n" - RESULT=0 - grep temperature "$WORKSPACE/testresults.log" || RESULT=$? - if [ $RESULT -ne 0 ]; then - echo "Test failed (temperature not found in testresults)" - wget -nc "${{JENKINS_URL}}jnlpJars/jenkins-cli.jar" - java -jar jenkins-cli.jar set-build-result unstable && exit 0 - fi - -- builder: - name: build-linux-arduino-longtest - builders: - - shell: | - #!/bin/bash -eu - DEVICE="{device}" - TIMEOUT="{timeout}" - - LOG="$WORKSPACE/testresults.log" - - echo -e "\n----- Testing build -----\n" - rm -f "$LOG" - export PYTHONUNBUFFERED=1 - /home/pi/weather_station.py --serial-port="$DEVICE" \ - --timeout="$TIMEOUT" \ - | tee "$LOG" - - echo -e "\n----- Verifying test results -----\n" - RECEIVED_MESSAGES=$(grep temperature "$LOG" | wc -l) - echo "Received messages" \ - > "$WORKSPACE/testresults.csv" - echo "$RECEIVED_MESSAGES" \ - >> "$WORKSPACE/testresults.csv" - - if [ $RECEIVED_MESSAGES -eq 0 ]; then - echo "Test failed (temperature not found in testresults)" - wget -nc "${{JENKINS_URL}}jnlpJars/jenkins-cli.jar" - java -jar jenkins-cli.jar set-build-result unstable && exit 0 - fi - -- builder: - name: build-python-check - builders: - - shell: | - #!/bin/bash -eu - export PY_COLORS=1 - - rm -rf $WORKSPACE/build-python - mkdir $WORKSPACE/build-python - cd $WORKSPACE/sources/tools - - for py in py27 py35 py36; do - tox -e $py -- --cache-clear \ - --junitxml=$WORKSPACE/build-python/$py-junit.xml \ - --cov-report=xml:$WORKSPACE/build-python/$py-coverage.xml \ - | tee $WORKSPACE/build-python/$py.log - done - - -# ----- Publisher ------------------------------------------------------------- - -- publisher: - name: publish-archive-avr - publishers: - - archive: - artifacts: '**/*.map,**/*.hex*,**/*.elf' - fingerprint: true - -- publisher: - name: publish-warnings - publishers: - - archive: - artifacts: 'build-*/*.log' - fingerprint: true - - warnings: - run-always: true - workspace-file-scanners: - - file-pattern: build-*/gcc_stderr.log - scanner: GNU C Compiler 4 (gcc) - - file-pattern: build-*/scan-build_stderr.log - scanner: Clang (LLVM based) - - file-pattern: build-*/doxygen_stderr.log - scanner: Doxygen - - file-pattern: build-*/py*-flake8.log - scanner: Pep8 - - file-pattern: build-*/py*-pylint.log - scanner: PyLint - total-thresholds: - unstable: - total-all: 0 - -- publisher: - name: publish-tests - publishers: - - archive: - artifacts: 'build-*/tests/*.xml' - fingerprint: true - - junit: - results: build-*/tests/junit.xml - test-stability: true - - cobertura: - report-file: build-*/tests/coverage.xml - fail-no-reports: true - targets: - - files: - failing: 10000000 - - line: - failing: 10000000 - - conditional: - failing: 10000000 - - valgrind: - pattern: build-*/tests/valgrind.xml - thresholds: - unstable: - total: 0 - fail-no-reports: true - fail-invalid-reports: true - -- publisher: - name: publish-tests-tools - publishers: - - archive: - artifacts: 'build-python/*.xml' - fingerprint: true - - junit: - results: build-python/*-junit.xml - test-stability: true - - cobertura: - report-file: build-python/*-coverage.xml - fail-no-reports: true - targets: - - files: - failing: 10000000 - - line: - failing: 10000000 - - conditional: - failing: 10000000 - - -# ----- Jobs ------------------------------------------------------------------ - -- job: - name: weather-station - project-type: multijob - parameters: - - gitlab-parameters - properties: - - gitlab-properties - - logrotate-property - - sidebar: - url: lastCompletedBuild/testReport - text: Test Result - icon: images/24x24/clipboard.png - - sidebar: - url: /job/weather-station-linux64/doxygen - text: DoxyGen HTML - icon: images/24x24/help.png - scm: - - scm-git - triggers: - - gitlab: - branch-filter-type: NameBasedFilter - exclude-branches: - - 'ci-image' - - 'ci-setup' - - 'gh-pages' - builders: - - shell: | - #!/bin/bash -eu - rm -rf $WORKSPACE/build-* - - multijob: - name: weather-station-build - condition: COMPLETED - projects: - - name: weather-station-linux64 - current-parameters: true - - name: weather-station-scanbuild - current-parameters: true - - name: weather-station-tools - current-parameters: true - - name: weather-station-arduino - current-parameters: true - - name: weather-station-atdemo - current-parameters: true - - multijob: - name: weather-station-test - condition: COMPLETED - projects: - - name: weather-station-arduino-flash - - copyartifact: - project: weather-station-linux64 - - copyartifact: - project: weather-station-scanbuild - optional: true - - copyartifact: - project: weather-station-tools - - copyartifact: - project: weather-station-arduino - - copyartifact: - project: weather-station-atdemo - publishers: - - archive: - artifacts: '**' - fingerprint: true - - publish-tests - - publish-tests-tools - - publish-warnings - - gitlab-notifier - -- job: - name: weather-station-linux64 - parameters: - - gitlab-parameters - properties: - - logrotate-property - scm: - - scm-git - builders: - - build-linux-desktop - publishers: - - doxygen: - doxyfile: build-linux64/Doxyfile - folder: build-linux64 - - publish-tests - - publish-warnings - -- job: - name: weather-station-scanbuild - parameters: - - gitlab-parameters - properties: - - logrotate-property - scm: - - scm-git - builders: - - build-linux-desktop-scanbuild - publishers: - - archive: - artifacts: clangScanBuildReports - allow-empty: true - fingerprint: true - - scan-build: - threshold: 0 - - publish-warnings - -- job: - name: weather-station-arduino - parameters: - - gitlab-parameters - properties: - - logrotate-property - scm: - - scm-git - builders: - - build-linux-target: - configuration: arduino - avr-mcu: atmega328p - publishers: - - publish-archive-avr - - publish-warnings - -- job: - name: weather-station-atdemo - parameters: - - gitlab-parameters - properties: - - logrotate-property - scm: - - scm-git - builders: - - build-linux-target: - configuration: atdemo - avr-mcu: atmega32 - publishers: - - publish-archive-avr - - publish-warnings - -- job: - name: weather-station-arduino-flash - disabled: true - node: arduino - concurrent: false - properties: - - logrotate-property - triggers: - - reverse: - jobs: weather-station-arduino - result: UNSTABLE - builders: - - copyartifact: - project: weather-station-arduino - filter: '**/*.hex' - flatten: true - - build-linux-arduino-flash: - device: /dev/arduino_uno_5543131303835151E052 - - build-linux-arduino-test: - device: /dev/arduino_uno_5543131303835151E052 - publishers: - - publish-warnings - -- job: - name: weather-station-arduino-flash-hourly - disabled: true - node: arduino - concurrent: false - properties: - - build-discarder: - num-to-keep: 100 - triggers: - - timed: '@hourly' - builders: - - copyartifact: - project: weather-station-arduino - filter: '**/*.hex' - flatten: true - - build-linux-arduino-flash: - device: /dev/arduino_uno_5543131303835151E052 - - build-linux-arduino-longtest: - device: /dev/arduino_uno_5543131303835151E052 - timeout: 600 - publishers: - - archive: - artifacts: '*.log,*.csv' - fingerprint: true - - plot: - - title: weather-station - yaxis: Number of measured values - group: weather-station - series: - - file: testresults.csv - format: csv - display-table: true - -- job: - name: weather-station-tools - parameters: - - gitlab-parameters - properties: - - logrotate-property - scm: - - scm-git - builders: - - build-python-check - publishers: - - publish-tests-tools - - publish-warnings diff --git a/tools/tox.ini b/tools/tox.ini index 69d5a4e..ead26bc 100644 --- a/tools/tox.ini +++ b/tools/tox.ini @@ -24,9 +24,6 @@ skipsdist = True [flake8] exclude = .git,.tox,.eggs,*lib/python*,venv*,.venv* -[tox:jenkins] -toxworkdir = {toxinidir}/../../tox - [pytest] python_files = *.py