diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh new file mode 100755 index 0000000..c89a127 --- /dev/null +++ b/.github/scripts/build.sh @@ -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; diff --git a/.github/scripts/common.sh b/.github/scripts/common.sh deleted file mode 100644 index 0439687..0000000 --- a/.github/scripts/common.sh +++ /dev/null @@ -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}" -} diff --git a/.github/scripts/git-check.sh b/.github/scripts/git-check.sh deleted file mode 100755 index 654eaf9..0000000 --- a/.github/scripts/git-check.sh +++ /dev/null @@ -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 diff --git a/.github/scripts/install-deps.sh b/.github/scripts/install-deps.sh new file mode 100755 index 0000000..00bb853 --- /dev/null +++ b/.github/scripts/install-deps.sh @@ -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 diff --git a/.github/scripts/install-toolchain.sh b/.github/scripts/install-toolchain.sh new file mode 100755 index 0000000..2aae055 --- /dev/null +++ b/.github/scripts/install-toolchain.sh @@ -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) diff --git a/.github/workflows/sphinx-tuttest.yml b/.github/workflows/sphinx-tuttest.yml new file mode 100644 index 0000000..2e705d5 --- /dev/null +++ b/.github/workflows/sphinx-tuttest.yml @@ -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}} diff --git a/.github/workflows/tuttest.yml b/.github/workflows/tuttest.yml deleted file mode 100644 index 416c674..0000000 --- a/.github/workflows/tuttest.yml +++ /dev/null @@ -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