ci: Adjust CI to sphinx-based documentation

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
This commit is contained in:
Filip Kokosinski 2020-12-08 13:36:23 +01:00 committed by Robert Winkler
parent 54c9beac6e
commit 0e4eeba99f
7 changed files with 142 additions and 129 deletions

42
.github/scripts/build.sh vendored Executable file
View File

@ -0,0 +1,42 @@
#!/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;

View File

@ -1,19 +0,0 @@
# Some colors, use it like following;
# echo -e "Hello ${YELLOW}yellow${NC}"
GRAY=' \033[0;30m'
RED=' \033[0;31m'
GREEN=' \033[0;32m'
YELLOW=' \033[0;33m'
PURPLE=' \033[0;35m'
NC='\033[0m' # No Color
SPACER="echo -e ${GRAY} - ${NC}"
function start_section() {
echo -e "${PURPLE}${1}${NC}: $2${NC}"
echo -e "${GRAY}-------------------------------------------------------------------${NC}"
}
function end_section() {
echo -e "${GRAY}-------------------------------------------------------------------${NC}"
}

View File

@ -1,27 +0,0 @@
set -e
source .github/scripts/common.sh
# Output any changes in the repository
# ------------------------------------------------------------------------
start_section git-status "Current git status"
git diff
$SPACER
git status
end_section git-status
# Check there are not changes in the repository
# ------------------------------------------------------------------------
start_section git-check "Checking git repository isn't dirty"
(
. "$(git --exec-path)/git-sh-setup"
require_clean_work_tree "continue" "Please run ``make README.rst`` to generate correct ``README.rst``."
)
end_section git-check

33
.github/scripts/install-deps.sh vendored Executable file
View File

@ -0,0 +1,33 @@
#!/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

11
.github/scripts/install-toolchain.sh vendored Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
fpga_fam=$1
# 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)

56
.github/workflows/sphinx-tuttest.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: doc-test
on: [push, pull_request]
jobs:
test-sphinx-docs:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
include:
- {fpga-fam: "eos-s3", os: "ubuntu", os-version: "xenial", example: "counter"}
- {fpga-fam: "eos-s3", os: "ubuntu", os-version: "bionic", example: "counter"}
- {fpga-fam: "eos-s3", os: "ubuntu", os-version: "focal", example: "counter"}
- {fpga-fam: "eos-s3", os: "centos", os-version: "7", example: "counter"}
- {fpga-fam: "eos-s3", os: "centos", os-version: "8", example: "counter"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "xenial", example: "counter"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "bionic", example: "counter"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "focal", example: "counter"}
- {fpga-fam: "xc7", os: "centos", os-version: "7", example: "counter"}
- {fpga-fam: "xc7", os: "centos", os-version: "8", example: "counter"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "xenial", example: "picosoc"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "bionic", example: "picosoc"}
- {fpga-fam: "xc7", os: "ubuntu", os-version: "focal", 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: "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"}
env:
LANG: "en_US.UTF-8"
DOCKER_NAME: test
steps:
- name: Setup repository
uses: actions/checkout@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}}
- name: Setup Conda environment
run: docker exec -t $DOCKER_NAME .github/scripts/install-toolchain.sh ${{matrix.fpga-fam}}
- name: Build examples
run: docker exec -t $DOCKER_NAME .github/scripts/build.sh ${{matrix.fpga-fam}} ${{matrix.example}}

View File

@ -1,83 +0,0 @@
name: tuttest
on: [push, pull_request]
jobs:
examples:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
include:
- {toolchain: "eos-s3", os: "ubuntu", os-version: "xenial", example: "eos-s3-counter"}
- {toolchain: "eos-s3", os: "ubuntu", os-version: "bionic", example: "eos-s3-counter"}
- {toolchain: "eos-s3", os: "ubuntu", os-version: "focal", example: "eos-s3-counter"}
- {toolchain: "eos-s3", os: "centos", os-version: "7", example: "eos-s3-counter"}
- {toolchain: "eos-s3", os: "centos", os-version: "8", example: "eos-s3-counter"}
- {toolchain: "xc7", os: "ubuntu", os-version: "xenial", example: "xc7-counter"}
- {toolchain: "xc7", os: "ubuntu", os-version: "bionic", example: "xc7-counter"}
- {toolchain: "xc7", os: "ubuntu", os-version: "focal", example: "xc7-counter"}
- {toolchain: "xc7", os: "centos", os-version: "7", example: "xc7-counter"}
- {toolchain: "xc7", os: "centos", os-version: "8", example: "xc7-counter"}
- {toolchain: "xc7", os: "ubuntu", os-version: "xenial", example: "xc7-picosoc"}
- {toolchain: "xc7", os: "ubuntu", os-version: "bionic", example: "xc7-picosoc"}
- {toolchain: "xc7", os: "ubuntu", os-version: "focal", example: "xc7-picosoc"}
- {toolchain: "xc7", os: "centos", os-version: "7", example: "xc7-picosoc"}
- {toolchain: "xc7", os: "centos", os-version: "8", example: "xc7-picosoc"}
- {toolchain: "xc7", os: "ubuntu", os-version: "xenial", example: "xc7-litex"}
- {toolchain: "xc7", os: "ubuntu", os-version: "bionic", example: "xc7-litex"}
- {toolchain: "xc7", os: "ubuntu", os-version: "focal", example: "xc7-litex"}
- {toolchain: "xc7", os: "centos", os-version: "7", example: "xc7-litex"}
- {toolchain: "xc7", os: "centos", os-version: "8", example: "xc7-litex"}
- {toolchain: "xc7", os: "ubuntu", os-version: "xenial", example: "xc7-linux"}
- {toolchain: "xc7", os: "ubuntu", os-version: "bionic", example: "xc7-linux"}
- {toolchain: "xc7", os: "ubuntu", os-version: "focal", example: "xc7-linux"}
- {toolchain: "xc7", os: "centos", os-version: "7", example: "xc7-linux"}
- {toolchain: "xc7", os: "centos", os-version: "8", example: "xc7-linux"}
env:
LANG: "en_US.UTF-8"
DOCKER_NAME: test
IN_DOCKER_EXEC: "docker exec -t test bash -ex -c"
steps:
- name: Prepare Repository
uses: actions/checkout@v2
- name: Set Up Python
uses: actions/setup-python@v2
- name: Install Prerequisites
run: |
sudo locale-gen $LANG
pip3 install git+https://github.com/antmicro/tuttest#egg=tuttest dataclasses
- name: Set Up Docker
run: |
docker create --name $DOCKER_NAME --env LANG="en_US.UTF-8" --env LANGUAGE="en_US" --env DEBIAN_FRONTEND="noninteractive" --env INSTALL_DIR=~/opt/symbiflow/ -v $PWD:$PWD --workdir $PWD --tty ${{matrix.os}}:${{matrix.os-version}}
docker start $DOCKER_NAME
- name: Test Main README.rst
run: |
rm README.rst && make README.rst && .github/scripts/git-check.sh
- name: (tuttest) Install SymbiFlow Toolchain
run: |
source .github/scripts/tuttest_exec.sh
tuttest_exec README.rst install-req-${{matrix.os}} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)"
tuttest_exec README.rst wget-conda | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)"
tuttest_exec ${{matrix.toolchain}}/README.rst ${{matrix.toolchain}}-setup-toolchain | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)"
- name: (tuttest) Test Example
run: |
source .github/scripts/tuttest_exec.sh
tuttest_exec ${{matrix.toolchain}}/README.rst ${{matrix.toolchain}}-prepare-env,${{matrix.example}} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)"
- uses: actions/upload-artifact@v2
with:
path: |
**/*.bit
!xc7/litex_demo/pythondata-cpu-microwatt/**/*.bit