update CI

This commit is contained in:
Robin Müller 2023-12-01 16:00:29 +01:00
parent 48b0362dc1
commit 0f3cf48c0e
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 88 additions and 51 deletions

View File

@ -6,10 +6,18 @@ RUN apt-get update
RUN apt-get --yes upgrade RUN apt-get --yes upgrade
# tzdata is a dependency, won't install otherwise # tzdata is a dependency, won't install otherwise
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get --yes install rsync
# set CROSS_CONTAINER_IN_CONTAINER to inform `cross` that it is executed from within a container # set CROSS_CONTAINER_IN_CONTAINER to inform `cross` that it is executed from within a container
ENV CROSS_CONTAINER_IN_CONTAINER=true ENV CROSS_CONTAINER_IN_CONTAINER=true
RUN rustup install nightly && \ RUN rustup install nightly && \
rustup target add thumbv7em-none-eabihf armv7-unknown-linux-gnueabihf && \ rustup target add thumbv7em-none-eabihf armv7-unknown-linux-gnueabihf && \
rustup component add rustfmt clippy rustup component add rustfmt clippy llvm-tools-preview
# SSH stuff to allow deployment to doc server
RUN adduser --uid 114 jenkins
# Add documentation server to known hosts
RUN echo "|1|/LzCV4BuTmTb2wKnD146l9fTKgQ=|NJJtVjvWbtRt8OYqFgcYRnMQyVw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts
RUN echo "|1|CcBvBc3EG03G+XM5rqRHs6gK/Gg=|oGeJQ+1I8NGI2THIkJsW92DpTzs= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts

123
automation/Jenkinsfile vendored
View File

@ -1,57 +1,80 @@
pipeline { pipeline {
agent { agent {
dockerfile { dockerfile {
dir 'automation' dir 'automation'
reuseNode true reuseNode true
} args '--network host'
} }
}
stages { stages {
stage('Rust Toolchain Info') { stage('Rust Toolchain Info') {
steps { steps {
sh 'rustc --version' sh 'rustc --version'
} }
} }
stage('Clippy') { stage('Clippy') {
steps { steps {
sh 'cargo clippy' sh 'cargo clippy'
} }
} }
stage('Docs') { stage('Docs') {
steps { steps {
sh 'cargo +nightly doc --all-features' sh 'cargo +nightly doc --all-features'
}
}
stage('Rustfmt') {
steps {
sh 'cargo fmt --all --check'
}
}
stage('Test') {
steps {
sh 'cargo test --all-features'
}
}
stage('Check with all features') {
steps {
sh 'cargo check --all-features'
}
}
stage('Check with no features') {
steps {
sh 'cargo check --no-default-features'
}
}
stage('Check Cross Embedded Bare Metal') {
steps {
sh 'cargo check --target thumbv7em-none-eabihf --no-default-features'
}
}
stage('Check Cross Embedded Linux') {
steps {
sh 'cargo check --target armv7-unknown-linux-gnueabihf'
}
} }
} }
stage('Rustfmt') {
steps {
sh 'cargo fmt --all --check'
}
}
stage('Test') {
steps {
sh 'cargo test --all-features'
}
}
stage('Check with all features') {
steps {
sh 'cargo check --all-features'
}
}
stage('Check with no features') {
steps {
sh 'cargo check --no-default-features'
}
}
stage('Check Cross Embedded Bare Metal') {
steps {
sh 'cargo check --target thumbv7em-none-eabihf --no-default-features'
}
}
stage('Check Cross Embedded Linux') {
steps {
sh 'cargo check --target armv7-unknown-linux-gnueabihf'
}
}
stage('Run test with Coverage') {
when {
anyOf {
branch 'main';
branch pattern: 'cov-deployment*'
}
}
steps {
script {
withEnv(['RUSTFLAGS=-Cinstrument-coverage', 'LLVM_PROFILE_FILE=target/coverage/%p-%m.profraw']) {
echo "Executing tests with coverage"
sh 'cargo test'
sh 'grcov . -s . --binary-path ./target/debug -t html --branch --ignore-not-existing -o ./target/debug/coverage/'
sshagent(credentials: ['documentation-buildfix']) {
// Deploy to Apache webserver
sh 'rsync -r --delete buildfix@documentation.irs.uni-stuttgart.de:/projects/spacepackets-rs/coverage/latest'
}
}
}
}
}
}
} }

View File

@ -1,12 +1,17 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import logging
import argparse import argparse
import webbrowser import webbrowser
_LOGGER = logging.getLogger()
def generate_cov_report(open_report: bool): def generate_cov_report(open_report: bool):
logging.basicConfig(level=logging.INFO)
os.environ["RUSTFLAGS"] = "-Cinstrument-coverage" os.environ["RUSTFLAGS"] = "-Cinstrument-coverage"
os.environ["LLVM_PROFILE_FILE"] = "target/coverage/%p-%m.profraw" os.environ["LLVM_PROFILE_FILE"] = "target/coverage/%p-%m.profraw"
_LOGGER.info("Executing tests with coverage")
os.system("cargo test") os.system("cargo test")
os.system( os.system(
"grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing " "grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing "
@ -15,6 +20,7 @@ def generate_cov_report(open_report: bool):
if open_report: if open_report:
coverage_report_path = os.path.abspath("./target/debug/coverage/index.html") coverage_report_path = os.path.abspath("./target/debug/coverage/index.html")
webbrowser.open_new_tab(coverage_report_path) webbrowser.open_new_tab(coverage_report_path)
_LOGGER.info("Done")
def main(): def main():