mirror of
https://github.com/chipsalliance/f4pga-examples.git
synced 2025-01-03 03:43:38 -05:00
ci: Extract tuttest runs from docker
Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
This commit is contained in:
parent
c9a5d6fdec
commit
f579ebfb8d
9 changed files with 148 additions and 109 deletions
81
.github/scripts/build-examples.sh
vendored
Executable file
81
.github/scripts/build-examples.sh
vendored
Executable 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
|
42
.github/scripts/build.sh
vendored
42
.github/scripts/build.sh
vendored
|
@ -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
15
.github/scripts/common.sh
vendored
Normal 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 "$@"
|
||||||
|
}
|
33
.github/scripts/install-deps.sh
vendored
33
.github/scripts/install-deps.sh
vendored
|
@ -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
|
|
40
.github/scripts/install-toolchain.sh
vendored
40
.github/scripts/install-toolchain.sh
vendored
|
@ -1,11 +1,37 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
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
|
# -- validate input -----------------------------------------------------------
|
||||||
eval $(tuttest docs/getting-symbiflow.rst wget-conda 2>&1)
|
|
||||||
eval $(tuttest docs/getting-symbiflow.rst conda-install-dir 2>&1)
|
function help() {
|
||||||
eval $(tuttest docs/getting-symbiflow.rst fpga-fam-$fpga_fam 2>&1)
|
echo
|
||||||
eval $(tuttest docs/getting-symbiflow.rst conda-setup 2>&1)
|
echo "Install the SymbiFlow toolchain as described in the sphinx documentation"
|
||||||
eval $(tuttest docs/getting-symbiflow.rst download-arch-def-$fpga_fam 2>&1)
|
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
|
||||||
|
|
13
.github/scripts/tuttest_exec.sh
vendored
13
.github/scripts/tuttest_exec.sh
vendored
|
@ -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 "$@"
|
|
||||||
}
|
|
27
.github/workflows/sphinx-tuttest.yml
vendored
27
.github/workflows/sphinx-tuttest.yml
vendored
|
@ -27,36 +27,41 @@ jobs:
|
||||||
- {fpga-fam: "xc7", os: "centos", os-version: "7", example: "picosoc"}
|
- {fpga-fam: "xc7", os: "centos", os-version: "7", example: "picosoc"}
|
||||||
- {fpga-fam: "xc7", os: "centos", os-version: "8", 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: "xenial", example: "litex_linux"}
|
||||||
- {fpga-fam: "xc7", os: "ubuntu", os-version: "bionic", example: "linux_litex"}
|
- {fpga-fam: "xc7", os: "ubuntu", os-version: "bionic", example: "litex_linux"}
|
||||||
- {fpga-fam: "xc7", os: "ubuntu", os-version: "eoan", example: "linux_litex"}
|
- {fpga-fam: "xc7", os: "ubuntu", os-version: "focal", example: "litex_linux"}
|
||||||
- {fpga-fam: "xc7", os: "ubuntu", os-version: "focal", example: "linux_litex"}
|
- {fpga-fam: "xc7", os: "centos", os-version: "7", example: "litex_linux"}
|
||||||
- {fpga-fam: "xc7", os: "centos", os-version: "7", example: "linux_litex"}
|
- {fpga-fam: "xc7", os: "centos", os-version: "8", example: "litex_linux"}
|
||||||
- {fpga-fam: "xc7", os: "centos", os-version: "8", example: "linux_litex"}
|
|
||||||
env:
|
env:
|
||||||
LANG: "en_US.UTF-8"
|
LANG: "en_US.UTF-8"
|
||||||
DOCKER_NAME: test
|
DOCKER_NAME: test
|
||||||
|
IN_DOCKER_EXEC: "docker exec -t test bash -e -c"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup repository
|
- name: Setup repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set Up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
|
||||||
- name: Setup Docker
|
- name: Setup Docker
|
||||||
run: |
|
run: |
|
||||||
docker create --name $DOCKER_NAME -v $PWD:$PWD --workdir $PWD --tty ${{matrix.os}}:${{matrix.os-version}}
|
docker create --name $DOCKER_NAME -v $PWD:$PWD --workdir $PWD --tty ${{matrix.os}}:${{matrix.os-version}}
|
||||||
docker start $DOCKER_NAME
|
docker start $DOCKER_NAME
|
||||||
|
|
||||||
- name: Install tuttest
|
- 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
|
- name: Install SymbiFlow toolchain
|
||||||
run: docker exec -t $DOCKER_NAME .github/scripts/install-toolchain.sh ${{matrix.fpga-fam}}
|
run: bash .github/scripts/install-toolchain.sh ${{matrix.fpga-fam}} ${{matrix.os}} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)"
|
||||||
|
|
||||||
- name: Build examples
|
- 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
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: symbiFlow-examples_bitstreams
|
name: symbiflow-examples-bitstreams
|
||||||
path: |
|
path: |
|
||||||
**/*.bit
|
**/*.bit
|
||||||
|
|
|
@ -56,8 +56,8 @@ html_theme_options = {
|
||||||
'nav_title': project,
|
'nav_title': project,
|
||||||
'color_primary': 'deep-purple',
|
'color_primary': 'deep-purple',
|
||||||
'color_accent': 'purple',
|
'color_accent': 'purple',
|
||||||
'repo_name': "antmicro/symbiflow-examples",
|
'repo_name': "symbiflow/symbiflow-examples",
|
||||||
'repo_url': 'https://github.com/antmicro/symbiflow-examples',
|
'repo_url': 'https://github.com/symbiflow/symbiflow-examples',
|
||||||
'globaltoc_depth': 2,
|
'globaltoc_depth': 2,
|
||||||
'globaltoc_collapse': True
|
'globaltoc_collapse': True
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Welcome to SymbiFlow examples!
|
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,
|
- Artix-7 from Xilinx,
|
||||||
- EOS S3 from QuickLogic.
|
- EOS S3 from QuickLogic.
|
||||||
|
|
Loading…
Reference in a new issue