-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
120 lines (111 loc) · 3.49 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
pipeline {
agent {
docker { image 'devops/fedora-avr-toolchain:latest' }
}
environment {
CMAKE_GENERATOR='Ninja'
WORKSPACE_BUILD_DIR = "build"
WORKSPACE_OUTPUT_DIR = "output"
}
parameters {
choice(
name: 'CMAKE_BUILD_TYPE',
choices: ['Release', 'Debug'],
description: 'Build type',
)
choice(
name: 'QEMU',
choices: ['OFF', 'On'],
description: 'Build for QEMU',
)
choice(
name: 'CMAKE_TOOLCHAIN_FILE',
choices: [
'cmake/avr6-atmega2560.cmake',
'cmake/avr5-atmega328p.cmake',
'cmake/avr5-atmega328pb.cmake',
'cmake/avr5-board-caniot-tiny.cmake',
'cmake/avr5-board-caniot-tiny-pb.cmake'
],
description: 'Toolchain file to use',
)
}
stages {
stage('Versions') {
steps {
// Print versions of tools
sh 'avr-gcc --version'
sh 'cmake --version'
sh 'ninja --version'
sh 'python3 --version'
sh 'qemu-system-avr --version'
}
}
stage('Create python virtual environment') {
steps {
withEnv(["HOME=${env.WORKSPACE}"]) {
sh 'python3 -m venv .venv'
sh 'source .venv/bin/activate'
sh 'pip install --user -r scripts/requirements.txt'
}
}
}
stage('Configure (cmake)') {
steps {
sh """
cmake -S . -B $WORKSPACE_BUILD_DIR \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=${params.CMAKE_TOOLCHAIN_FILE} \
-DCMAKE_GENERATOR=$CMAKE_GENERATOR \
-DQEMU=${params.QEMU} \
-DCMAKE_BUILD_TYPE=${params.CMAKE_BUILD_TYPE} \
"""
}
}
stage('Build (ninja)') {
steps {
sh "ninja -C $WORKSPACE_BUILD_DIR"
}
}
stage('Metrics') {
steps {
sh "scripts/metrics-collect.sh $WORKSPACE_BUILD_DIR $WORKSPACE_BUILD_DIR/metrics-exsizes.txt"
}
}
stage('Export output') {
steps {
sh "mkdir -p $WORKSPACE_OUTPUT_DIR"
sh "cp $WORKSPACE_BUILD_DIR/compile_commands.json $WORKSPACE_OUTPUT_DIR"
sh "cp $WORKSPACE_BUILD_DIR/metrics-exsizes.txt $WORKSPACE_OUTPUT_DIR"
dir("$WORKSPACE_BUILD_DIR") {
sh """
find examples -type f \\( \
-name '*.s' \
-o -name '*.txt' \
-o -name '*.out' \
-o -name '*.hex' \
-o -name '*.json' \
-o -name '*' -executable \
\\) -exec cp --parents {} ../$WORKSPACE_OUTPUT_DIR \\;
"""
}
}
}
}
post {
always {
dir("$WORKSPACE_BUILD_DIR") {
deleteDir()
}
}
success {
archiveArtifacts artifacts: "$WORKSPACE_OUTPUT_DIR/**", fingerprint: true
}
// failure {
// }
// unstable {
// }
// changed {
// }
}
}