Commit f2dab4e6 authored by Adam Wujek's avatar Adam Wujek

.gitlab-ci.yml: add build, deploy and release jobs

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 3465d9e5
# Author: Adam Wujek for CERN 2023
# Include file for publishing on EOS
include:
- project: 'be-cem-edl/evergreen/gitlab-ci'
ref: master
file:
- include/publish-gitlab-ci.yml
stages: # List of stages for jobs, and their order of execution
- build-sw
- build-hw
- deploy
- release
variables:
_BITSTREAM_DEST: $CI_PROJECT_DIR/$EDL_CI_EOS_OUTPUT_DIR/bitstream
_FIRMWARE_DEST: $CI_PROJECT_DIR/$EDL_CI_EOS_OUTPUT_DIR/firmware
_TOOLS_DEST: $CI_PROJECT_DIR/$EDL_CI_EOS_OUTPUT_DIR/tools
###############################################################################
build-wr2rf-tools:
stage: build-sw
script:
- |
# Test description
echo -e "\e[0Ksection_start:`date +%s`:job_description\r\e[0KJob description"
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
echo -e '\e[31m|\e[0m Compilation of wr2rf tools \e[31m|\e[0m'
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
while IFS= read -r line;
do
printf "\e[31m|\e[0m %-76s \e[31m|\e[0m\n" "$line"
done << EOF
This job does the following:
- compile wr2rf
- compile spi_echo
- compile libwr2rf.a
EOF
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
echo -e "\e[0Ksection_end:`date +%s`:job_description\r\e[0K"
- mkdir -p ~/.ssh/
- ssh-keyscan -t rsa cs-ccr-dev4 >> ~/.ssh/known_hosts
- echo "$KPASS" | kinit wrci@CERN.CH
- ./ci-scripts/build_wr2rf_tool.sh
- mkdir -p $_TOOLS_DEST/bin
- mkdir -p $_TOOLS_DEST/lib
- cp {wr2rf,spi_echo} $_TOOLS_DEST/bin
- cp libwr2rf.a $_TOOLS_DEST/lib
after_script:
- ssh wrci@cs-ccr-dev4 "rm -rf /user/wrci/ci-wr2rf/\"$CI_JOB_ID\""
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_ID"
when: always
paths:
- $_TOOLS_DEST/
###############################################################################
build-wrpc:
stage: build-sw
tags:
- nodocker
script:
- |
echo -e "\e[0Ksection_start:`date +%s`:job_description\r\e[0KJob description"
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
echo -e '\e[31m|\e[0m Compilation of wrpc-sw for wr2rf \e[31m|\e[0m'
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
echo -e "\e[0Ksection_end:`date +%s`:job_description\r\e[0K"
- ./ci-scripts/checkout-sw.sh dependencies/wrpc-sw
- echo "Building wrpc-sw ..."
- ./ci-scripts/build-sw.sh dependencies/wrpc-sw wr2rf
- mkdir -p $_FIRMWARE_DEST
- cp wrc.bram $_FIRMWARE_DEST
- cp wrc.mif $_FIRMWARE_DEST
- cp wrc.bin $_FIRMWARE_DEST
- cp wrc.elf $_FIRMWARE_DEST
- cp wrpc-sw_repo_ver.txt $_FIRMWARE_DEST
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_ID"
when: always
paths:
- $_FIRMWARE_DEST/
###############################################################################
build-wr2rf:
stage: build-hw
tags:
- nodocker
variables:
# Fetch submodules (https://docs.gitlab.com/ee/ci/git_submodules.html#use-git-submodules-in-cicd-jobs).
GIT_SUBMODULE_STRATEGY: normal
GIT_SUBMODULE_DEPTH: 1
EDL_CI_SYN_OUTPUT_DIR: $CI_PROJECT_DIR/$EDL_CI_EOS_OUTPUT_DIR/bitstreams
GIT_SSL_NO_VERIFY: 1
script:
- |
echo -e "\e[0Ksection_start:`date +%s`:job_description\r\e[0KJob description"
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
echo -e '\e[31m|\e[0m Synthesis of wr2rf \e[31m|\e[0m'
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
echo -e "\e[0Ksection_end:`date +%s`:job_description\r\e[0K"
- echo "Checking out..."
- ./ci-scripts/install-hdlmake.sh
- git config --global credential.https://gitlab.cern.ch.username wrci
- git config --global credential.https://gitlab.cern.ch.helper '!f() { test "$1" = get && echo "password=$KPASS"; }; f'
- ./ci-scripts/checkout.sh
- cp $_FIRMWARE_DEST/wrc.bram dependencies/wrpc-sw-file
- echo "Building..."
- ./ci-scripts/build-wr2rf.sh
- mkdir -p $_BITSTREAM_DEST
- cp wr2rf.tar.xz $_BITSTREAM_DEST/
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_ID"
when: always
paths:
- $_BITSTREAM_DEST/
- $_FIRMWARE_DEST/
- $_TOOLS_DEST/
###############################################################################
nfs_publish:
stage: deploy
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- |
# Test description
echo -e "\e[0Ksection_start:`date +%s`:job_description\r\e[0KJob description"
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
echo -e '\e[31m|\e[0m Deploy tools on NFS \e[31m|\e[0m'
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
while IFS= read -r line;
do
printf "\e[31m|\e[0m %-76s \e[31m|\e[0m\n" "$line"
done << EOF
This job deploys following on NFS (/acc/local/L867/drv/wr2rf/):
- bin/wr2rf
- bin/spi_echo
- lib/libwr2rf.a
EOF
echo -e "\e[31m+------------------------------------------------------------------------------+\e[0m"
echo -e "\e[0Ksection_end:`date +%s`:job_description\r\e[0K"
- |
if [[ ! $CI_COMMIT_REF_PROTECTED = "true" ]]
then
echo -e "\e[31mPlease protect the commit reference (branch/tag) and try again. Aborting...\e[0m"
exit 1
fi
- echo "$KPASS" | kinit wrci@CERN.CH
- tar xf $_BITSTREAM_DEST/wr2rf.tar.xz
- ssh -o StrictHostKeyChecking=no wrci@cs-ccr-dev4 "mkdir -p /acc/local/L867/drv/wr2rf/\"$CI_COMMIT_TAG\"/bitstream"
- scp -r "$_TOOLS_DEST"/* wrci@cs-ccr-dev4:/acc/local/L867/drv/wr2rf/"$CI_COMMIT_TAG"
- scp wr2rf_vme.bit wrci@cs-ccr-dev4:/acc/local/L867/drv/wr2rf/"$CI_COMMIT_TAG"/bitstream
###############################################################################
release-wr2rf:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "Create release"
- |
if [[ ! $CI_COMMIT_REF_PROTECTED = "true" ]]
then
echo -e "\e[31mPlease protect the commit reference (branch/tag) and try again. Aborting...\e[0m"
exit 1
fi
- ./ci-scripts/extract_changelog.sh CHANGELOG.rst CHANGELOG_release.rst
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: ./CHANGELOG_release.rst
name: 'Release $CI_COMMIT_TAG'
assets:
links:
- name: 'libwr2rf'
url: 'https://be-cem-edl.web.cern.ch/wr2rf-vme/$CI_COMMIT_TAG/tools/lib'
- name: 'CLI tools'
url: 'https://be-cem-edl.web.cern.ch/wr2rf-vme/$CI_COMMIT_TAG/tools/bin'
- name: 'WRPC firmware'
url: 'https://be-cem-edl.web.cern.ch/wr2rf-vme/$CI_COMMIT_TAG/firmware'
- name: 'Bitstream'
url: 'https://be-cem-edl.web.cern.ch/wr2rf-vme/$CI_COMMIT_TAG/bitstream'
..
SPDX-License-Identifier: CC-BY-SA-4.0+
SPDX-FileCopyrightText: 2019 CERN
==========
Change Log
==========
Format: `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_
Versioning: `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_
.. last_release_start::
Unreleased
==========
Fixed
-----
- [hdl] XXX
- [sw] YYY
.. last_release_end::
[v0.17] - 2023-01-12
====================
Added
-----
- general status register for VTU with start bits
- configOverride flag
- missIdle status
- missValid status
- start-as-stop flag
Changed
-------
- update of wrpc to v5
- update of RFNCO to 2.0.3
#!/bin/bash
set -e
#PATH=/opt/gnu/lm32-gcc-4.5.3/bin:$PATH
PATH=/opt/gnu/riscv-11.2/bin:$PATH
CALL_DIR=$PWD
if [ -z "$1" ]; then
echo "$0: Target not defined!"
exit 1
fi
if [ $# -ne 2 ]; then
echo "usage: $0 target"
exit 1
fi
echo "build wrpc-sw"
cd "$1"
# Create .config (using defaults)
make "$2"_defconfig
# Build.
# Need access to vmebridge for vuart tool.
make DEFCONFIG_NAME="$2"_defconfig SUPPORT_CERN_VMEBRIDGE=y VMEBRIDGE=/opt/libvme SHELL=/bin/bash -j4
# Copy result
cd $CALL_DIR
cp "$1"/wrc.bram .
cp "$1"/wrc.mif .
cp "$1"/wrc.bin .
cp "$1"/wrc.elf .
#!/bin/bash
LOG_FILE="$PWD"/build
# Needs Vivado > 2019.1
. /opt/Xilinx/Vivado/2019.2/settings64.sh
echo "Build wr2rf"
# Copy wrpc
#cp wrc.bram repos/wr2rf-vme/dependencies/wrpc-sw-file/wrc.bram
cd hdl/syn/wr2rf_vme
# Temporary fixes on generated wrapper
for f in nonIQModInterp2FIR/Vivado/nonIQModInterp2FIR.v; do
sed -i -e "s/_wrapper/_wrapper_unused/g" ../../../dependencies/$f
done
hdlmake 2>&1 | tee "${LOG_FILE}_hdlmake.log"
make files.tcl 2>&1 | tee "${LOG_FILE}_make_files.log"
vivado -mode tcl -source wr2rf_vme.tcl
git describe >> wr2rf_ver.txt
tar -cJf wr2rf.tar.xz *.rpt *.dcp *.bit *.bin wr2rf_ver.txt
cp wr2rf.tar.xz ../../..
#!/bin/bash
set -e
targ=cs-ccr-dev4
ssh wrci@${targ} "mkdir -p /user/wrci/ci-wr2rf/\"$CI_JOB_ID\""
# copy software directory
scp -r software wrci@${targ}:/user/wrci/ci-wr2rf/"$CI_JOB_ID"
ssh wrci@${targ} "\
cd /user/wrci/ci-wr2rf/\"$CI_JOB_ID\"/software/libwr2rf;\
make VMEBRIDGE=/acc/local/L867/drv/vmebus/current;\
"
# copy wr2rf tool and version information
scp wrci@${targ}:/user/wrci/ci-wr2rf/"$CI_JOB_ID"/software/libwr2rf/{wr2rf,libwr2rf.a,spi_echo} .
#!/bin/sh
set -e
# Avoid problems due to certificate
export GIT_SSL_NO_VERIFY=1
# Checkout
CALL_DIR=$PWD
cd $1
git submodule update --init
git describe --always --dirty > $CALL_DIR/wrpc-sw_repo_ver.txt
echo "Check-out complete."
#!/bin/sh
# Author Adam Wujek for CERN
#
# From file $1 save the text between ".. last_release_start::" and
# ".. last_release_end::" fo file $2
# Parameters:
# $1 - source filename
# $2 - destination filename
set -e
set -o pipefail
if [ $# -ne 2 ]; then
echo "$0: Not enough parameters!"
echo "usage: $0 src_file dest_file"
exit 1
fi
file_changelog="$1"
start_tag=".. last_release_start::"
end_tag=".. last_release_end::"
start_line=$(grep -n "$start_tag" "$file_changelog" | cut -d':' -f1)
end_line=$(grep -n "$end_tag" "$file_changelog" | cut -d':' -f1)
start_line=$((start_line + 1))
end_line=$((end_line - 1))
head -n $end_line $file_changelog | tail -n +$start_line > "$2"
#!/bin/sh
set -e
set -x
# Avoid problems due to certificate
export GIT_SSL_NO_VERIFY=1
# Checkout
rm -rf hdl-make
git clone -b develop https://ohwr.org/project/hdl-make.git
# Build/install
cd hdl-make; pip3 install -U .; cd ..
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment