ci: Extract tuttest runs from docker

Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
This commit is contained in:
Robert Winkler 2020-12-10 14:49:18 +01:00
parent c9a5d6fdec
commit f579ebfb8d
9 changed files with 148 additions and 109 deletions

81
.github/scripts/build-examples.sh vendored Executable file
View file

@ -0,0 +1,81 @@
#!/bin/bash
set -e
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source ${CURRENT_DIR}/common.sh
# -- validate input ----------------------------------------------------------
function help() {
echo
echo "Build examples from the repository"
echo
echo "Syntax: $0 fpga_family [examples]..."
echo "Arguments:"
echo " fpga_family - A supported FPGA family"
echo " examples - A name of an available example"
echo
}
if [[ ! $# -ge 1 ]]; then
echo "Invalid number of arguments!"
help
exit 1
fi
# -- tuttest -----------------------------------------------------------------
fpga_family=$1
shift
examples="$@"
if [ "$fpga_family" == "xc7" -a -z "$examples" ]; then
examples="counter picosoc litex_linux"
elif [ "$fpga_family" == "eos-s3" -a -z "$examples" ]; then
examples="counter"
fi
# activate conda and enter example dir
tuttest_exec docs/building-examples.rst export-install-dir
tuttest_exec docs/building-examples.rst fpga-fam-$fpga_family
tuttest_exec docs/building-examples.rst conda-prep-env
tuttest_exec docs/building-examples.rst conda-act-env
tuttest_exec docs/building-examples.rst enter-dir-$fpga_family
# Xilinx 7-Series examples
if [ "$fpga_family" = "xc7" ]; then
for example in $examples; do
case $example in
"counter")
tuttest_exec xc7/counter_test/README.rst example-counter-*-group
;;
"picosoc")
tuttest_exec xc7/picosoc_demo/README.rst example-picosoc-*-group
;;
"litex_linux")
tuttest_exec xc7/linux_litex_demo/README.rst example-litex-deps
tuttest_exec xc7/linux_litex_demo/README.rst example-litex-*-group
;;
*)
echo "ERROR: Unknown example name: $example"
exit 1
;;
esac
done
# QuickLogic EOS-S3 examples
elif [ "$fpga_family" = "eos-s3" ]; then
for example in $examples; do
case $example in
"counter")
tuttest eos-s3/btn_counter/README.rst eos-s3-counter
;;
*)
echo "ERROR: Unknown example name: $example"
exit 1
;;
esac
done
else
echo "ERROR: Unknown fpga_family: $fpga_family"
fi

View file

@ -1,42 +0,0 @@
#!/bin/bash
set -e
fpga_fam=$1
shift
# select particular example for xc7
examples="$@"
if [ "$fpga_fam" == "xc7" -a -z "$examples" ] ; then
examples="counter picosoc linux_litex"
fi;
# activate conda and enter example dir
eval $(tuttest docs/building-examples.rst export-install-dir 2>&1)
eval $(tuttest docs/building-examples.rst fpga-fam-$fpga_fam 2>&1)
eval $(tuttest docs/building-examples.rst conda-prep-env 2>&1)
eval $(tuttest docs/building-examples.rst conda-act-env 2>&1)
eval $(tuttest docs/building-examples.rst enter-dir-$fpga_fam 2>&1)
if [ "$fpga_fam" = "xc7" ]; then
# Xilinx 7-Series examples
for example in $examples; do
case $example in
"counter")
eval $(tuttest counter_test/README.rst example-counter-a35t-group 2>&1)
eval $(tuttest counter_test/README.rst example-counter-a100t-group 2>&1)
eval $(tuttest counter_test/README.rst example-counter-basys3-group 2>&1)
;;
"picosoc")
eval $(tuttest picosoc_demo/README.rst example-picosoc-basys3-group 2>&1)
;;
"linux_litex")
eval $(tuttest linux_litex_demo/README.rst example-litex-deps 2>&1)
eval $(tuttest linux_litex_demo/README.rst example-litex-a35t-group 2>&1)
eval $(tuttest linux_litex_demo/README.rst example-litex-a100t-group 2>&1)
;;
esac
done
else
# QuickLogic EOS-S3 examples
eval $(tuttest btn_counter/README.rst eos-s3-counter 2>&1)
fi;

15
.github/scripts/common.sh vendored Normal file
View file

@ -0,0 +1,15 @@
#!/bin/bash
function tuttest_exec() {
cat << EOF
echo
echo "==================================================================== "
echo "OUTPUT : tuttest $@"
echo "EXECUTED COMMAND:"
echo
echo '$(tuttest $@)'
echo "-------------------------------------------------------------------- "
echo
EOF
tuttest "$@"
}

View file

@ -1,33 +0,0 @@
#!/bin/bash
set -e
distro=$1
distro_ver=$2
# install required packages
if [ "$distro" == "ubuntu" ]; then
apt update -y
apt install -y git wget
# if running on xenial, install newer python version from ppa
if [ "$distro_ver" == "xenial" ]; then
apt install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
apt update -y
apt install -y python3.6 python3.6-dev python3.6-venv
update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
update-alternatives --set python /usr/bin/python3.6
wget https://bootstrap.pypa.io/get-pip.py
python3.6 get-pip.py
else
apt install -y python3-pip python3-setuptools
fi
else
yum update -y
yum install -y python3-pip python3-setuptools git wget which
fi
# install python deps
pip3 install dataclasses
pip3 install git+https://github.com/antmicro/tuttest

View file

@ -1,11 +1,37 @@
#!/bin/bash
set -e
fpga_fam=$1
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source ${CURRENT_DIR}/common.sh
# create conda env
eval $(tuttest docs/getting-symbiflow.rst wget-conda 2>&1)
eval $(tuttest docs/getting-symbiflow.rst conda-install-dir 2>&1)
eval $(tuttest docs/getting-symbiflow.rst fpga-fam-$fpga_fam 2>&1)
eval $(tuttest docs/getting-symbiflow.rst conda-setup 2>&1)
eval $(tuttest docs/getting-symbiflow.rst download-arch-def-$fpga_fam 2>&1)
# -- validate input -----------------------------------------------------------
function help() {
echo
echo "Install the SymbiFlow toolchain as described in the sphinx documentation"
echo
echo "Syntax: $0 fpga_family os"
echo "Arguments:"
echo " fpga_family - A supported FPGA family"
echo " os - A supported operating system"
echo
}
if [[ ! $# -eq 2 ]]; then
echo "ERROR: Invalid number of arguments"
help
exit 1
fi
# -- tuttest ------------------------------------------------------------------
fpga_family=$1
os=$2
tuttest_exec docs/getting-symbiflow.rst install-reqs-$os
tuttest_exec docs/getting-symbiflow.rst wget-conda
tuttest_exec docs/getting-symbiflow.rst conda-install-dir
tuttest_exec docs/getting-symbiflow.rst fpga-fam-$fpga_family
tuttest_exec docs/getting-symbiflow.rst conda-setup
tuttest_exec docs/getting-symbiflow.rst download-arch-def-$fpga_family

View file

@ -1,13 +0,0 @@
#!/bin/bash
function tuttest_exec () {
echo " ==================================================================== " 1>&2
echo " CMD : tuttest $@ " 1>&2
echo " OUTPUT: " 1>&2
echo "" 1>&2
echo "$(tuttest $@)" 1>&2
echo " -------------------------------------------------------------------- " 1>&2
echo "" 1>&2
tuttest "$@"
}

View file

@ -27,36 +27,41 @@ jobs:
- {fpga-fam: "xc7", os: "centos", os-version: "7", example: "picosoc"}
- {fpga-fam: "xc7", os: "centos", os-version: "8", example: "picosoc"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "xenial", example: "linux_litex"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "bionic", example: "linux_litex"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "eoan", example: "linux_litex"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "focal", example: "linux_litex"}
- {fpga-fam: "xc7", os: "centos", os-version: "7", example: "linux_litex"}
- {fpga-fam: "xc7", os: "centos", os-version: "8", example: "linux_litex"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "xenial", example: "litex_linux"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "bionic", example: "litex_linux"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "focal", example: "litex_linux"}
- {fpga-fam: "xc7", os: "centos", os-version: "7", example: "litex_linux"}
- {fpga-fam: "xc7", os: "centos", os-version: "8", example: "litex_linux"}
env:
LANG: "en_US.UTF-8"
DOCKER_NAME: test
IN_DOCKER_EXEC: "docker exec -t test bash -e -c"
steps:
- name: Setup repository
uses: actions/checkout@v2
- name: Set Up Python
uses: actions/setup-python@v2
- name: Setup Docker
run: |
docker create --name $DOCKER_NAME -v $PWD:$PWD --workdir $PWD --tty ${{matrix.os}}:${{matrix.os-version}}
docker start $DOCKER_NAME
- name: Install tuttest
run: docker exec -t $DOCKER_NAME .github/scripts/install-deps.sh ${{matrix.os}} ${{matrix.os-version}}
run: |
sudo locale-gen $LANG
pip3 install git+https://github.com/antmicro/tuttest#egg=tuttest
- name: Setup Conda environment
run: docker exec -t $DOCKER_NAME .github/scripts/install-toolchain.sh ${{matrix.fpga-fam}}
- name: Install SymbiFlow toolchain
run: bash .github/scripts/install-toolchain.sh ${{matrix.fpga-fam}} ${{matrix.os}} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)"
- name: Build examples
run: docker exec -t $DOCKER_NAME .github/scripts/build.sh ${{matrix.fpga-fam}} ${{matrix.example}}
run: bash .github/scripts/build-examples.sh ${{matrix.fpga-fam}} ${{matrix.example}} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)"
- uses: actions/upload-artifact@v2
with:
name: symbiFlow-examples_bitstreams
name: symbiflow-examples-bitstreams
path: |
**/*.bit

View file

@ -56,8 +56,8 @@ html_theme_options = {
'nav_title': project,
'color_primary': 'deep-purple',
'color_accent': 'purple',
'repo_name': "antmicro/symbiflow-examples",
'repo_url': 'https://github.com/antmicro/symbiflow-examples',
'repo_name': "symbiflow/symbiflow-examples",
'repo_url': 'https://github.com/symbiflow/symbiflow-examples',
'globaltoc_depth': 2,
'globaltoc_collapse': True
}

View file

@ -1,7 +1,7 @@
Welcome to SymbiFlow examples!
==============================
This guide explains how to get started with SymbiFlow and build example designs from the `SymbiFlow Examples <https://github.com/antmicro/symbiflow-examples>`_ GitHub repository. It currently focuses on two FPGA families:
This guide explains how to get started with SymbiFlow and build example designs from the `SymbiFlow Examples <https://github.com/symbiflow/symbiflow-examples>`_ GitHub repository. It currently focuses on two FPGA families:
- Artix-7 from Xilinx,
- EOS S3 from QuickLogic.