Newer
Older
pipeline {
agent any
string(name: 'FINN_CI_BRANCH', defaultValue: '', description: 'FINN branch to build')
string(name: 'VIVADO_PATH', defaultValue: '', description: 'Path to Vivado installation')
string(name: 'PYNQ_BOARD', defaultValue: 'Pynq-Z1', description: 'PYNQ board type')
string(name: 'PYNQ_IP', defaultValue: '', description: 'PYNQ board IP address')
string(name: 'PYNQ_USERNAME', defaultValue: 'xilinx', description: 'PYNQ board username')
string(name: 'PYNQ_PASSWORD', defaultValue: 'xilinx', description: 'PYNQ board password')
string(name: 'PYNQ_TARGET_DIR', defaultValue: '/home/xilinx/finn', description: 'PYNQ board target deployment directory')
string(name: 'NUM_DEFAULT_WORKERS', defaultValue: '1', description: 'Number of cores for parallel transformations')
// main test: everything except rtlsim and end2end tests, parallel run with xdist, no parallel transformations to save on memory
string(name: 'DOCKER_CMD_MAIN', defaultValue: """python setup.py test --addopts "-k 'not (rtlsim or end2end)' --dist=loadfile -n auto" """, description: 'Main test command')
// rtlsim tests: parallel run with pytest-parallel, no parallel transformations to save on memory
string(name: 'DOCKER_CMD_RTLSIM', defaultValue: """python setup.py test --addopts "-k rtlsim --workers auto" """, description: 'rtlsim test command')
// end2end tests: no parallel testing, use NUM_DEFAULT_WORKERS for parallel transformations
string(name: 'DOCKER_CMD_END2END', defaultValue: """python setup.py test --addopts "-k end2end" """, description: 'end2end test command')
DOCKER_TAG='finn_ci:$BUILD_ID'
DOCKER_INST_NAME='finn_ci_$BUILD_ID'
BUILD_PATH='/tmp/finn_ci_$BUILD_ID'
}
stages {
stage("Clone") {
steps {
git branch: "${params.FINN_CI_BRANCH}", url: 'https://github.com/Xilinx/finn.git'
}
}
stage('Build') {
steps {
sh """
docker build -t $DOCKER_TAG -f docker/Dockerfile.finn_ci \
--build-arg BUILD_PATH=$BUILD_PATH \
--build-arg FINN_CI_BRANCH=${params.FINN_CI_BRANCH} \
docker/
"""
}
}
--hostname $DOCKER_INST_NAME \
-v ${params.VIVADO_PATH}:${params.VIVADO_PATH}:ro \
-e NUM_DEFAULT_WORKERS=1 \
-e FINN_INST_NAME=$DOCKER_INST_NAME \
-e VIVADO_PATH=${params.VIVADO_PATH} \
-e PYNQ_BOARD=${params.PYNQ_BOARD} \
-e PYNQ_IP=${params.PYNQ_IP} \
-e PYNQ_USERNAME=${params.PYNQ_USERNAME} \
-e PYNQ_PASSWORD=${params.PYNQ_PASSWORD} \
-e PYNQ_TARGET_DIR=${params.PYNQ_TARGET_DIR} \
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
$DOCKER_TAG ${params.DOCKER_CMD_MAIN}
"""}
}
}
stage('test-rtlsim') {
steps {
catchError {
sh """
docker run --init \
--hostname $DOCKER_INST_NAME \
-v ${params.VIVADO_PATH}:${params.VIVADO_PATH}:ro \
-e NUM_DEFAULT_WORKERS=1 \
-e FINN_INST_NAME=$DOCKER_INST_NAME \
-e VIVADO_PATH=${params.VIVADO_PATH} \
-e PYNQ_BOARD=${params.PYNQ_BOARD} \
-e PYNQ_IP=${params.PYNQ_IP} \
-e PYNQ_USERNAME=${params.PYNQ_USERNAME} \
-e PYNQ_PASSWORD=${params.PYNQ_PASSWORD} \
-e PYNQ_TARGET_DIR=${params.PYNQ_TARGET_DIR} \
$DOCKER_TAG ${params.DOCKER_CMD_RTLSIM}
"""}
}
}
stage('test-end2end') {
steps {
catchError {
sh """
docker run --init \
--hostname $DOCKER_INST_NAME \
-v ${params.VIVADO_PATH}:${params.VIVADO_PATH}:ro \
-e NUM_DEFAULT_WORKERS=${params.NUM_DEFAULT_WORKERS} \
-e FINN_INST_NAME=$DOCKER_INST_NAME \
-e VIVADO_PATH=${params.VIVADO_PATH} \
-e PYNQ_BOARD=${params.PYNQ_BOARD} \
-e PYNQ_IP=${params.PYNQ_IP} \
-e PYNQ_USERNAME=${params.PYNQ_USERNAME} \
-e PYNQ_PASSWORD=${params.PYNQ_PASSWORD} \
-e PYNQ_TARGET_DIR=${params.PYNQ_TARGET_DIR} \
$DOCKER_TAG ${params.DOCKER_CMD_END2END}
""" }