diff --git a/.ci.yml b/.ci.yml index 885f67a9..e7ed10fd 100644 --- a/.ci.yml +++ b/.ci.yml @@ -12,7 +12,7 @@ build: - pip3 install -r docs/requirements.txt script: - cd docs - - echo -en "\nhtml_js_files = [ '`dirname $CI_FULL_PROJECT_URL`/annotant/docs/annotant.js' ]" >> source/conf.py + - echo -en "\nhtml_js_files = [ '$ANNOTANT' ]" >> source/conf.py - make html latexpdf - cp build/latex/*.pdf build/html/ - tar cf ../$CI_DOCS_ARCHIVE -C build/html/ . diff --git a/.github/scripts/activate.sh b/.github/scripts/activate.sh deleted file mode 100755 index 2be0c05b..00000000 --- a/.github/scripts/activate.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2020-2022 F4PGA Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -# Copyright (C) 2022 Antmicro -# SPDX-License-Identifier: Apache-2.0 - - -source "${F4PGA_INSTALL_DIR}/${FPGA_FAM}/conda/etc/profile.d/conda.sh" -conda activate $FPGA_FAM -export F4PGA_SHARE_DIR=${F4PGA_INSTALL_DIR_FAM}/share/f4pga diff --git a/.github/scripts/latex.sh b/.github/scripts/latex.sh index a132a42d..5eac1f44 100755 --- a/.github/scripts/latex.sh +++ b/.github/scripts/latex.sh @@ -2,15 +2,9 @@ set -e -apt-get update -qq -DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ - python3-pip \ - python3-setuptools \ - python3-wheel - cd $(dirname $0)/../../docs -pip3 install --user -r requirements.txt +pip3 install -r requirements.txt cd build/latex LATEXMKOPTS='-interaction=nonstopmode' make diff --git a/.github/scripts/prepare_environment.sh b/.github/scripts/prepare_environment.sh deleted file mode 100755 index b87cd86f..00000000 --- a/.github/scripts/prepare_environment.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2020-2022 F4PGA Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -# Copyright (C) 2022 Antmicro -# SPDX-License-Identifier: Apache-2.0 - -set -e - -echo '::group::Environment variables' - -echo "FPGA_FAM: $FPGA_FAM" -echo "F4PGA_INSTALL_DIR: $F4PGA_INSTALL_DIR" -echo "F4PGA_INSTALL_DIR_FAM: $F4PGA_INSTALL_DIR_FAM" - -echo '::endgroup::' - - -echo '::group::Install Miniconda3' - -wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O conda_installer.sh - -bash conda_installer.sh -u -b -p "${F4PGA_INSTALL_DIR_FAM}"/conda -rm conda_installer.sh -source "${F4PGA_INSTALL_DIR_FAM}"/conda/etc/profile.d/conda.sh - -echo '::endgroup::' - - -echo '::group::Install arch-defs' - -mkdir -p "$F4PGA_INSTALL_DIR_FAM" - -F4PGA_TIMESTAMP='20220907-210059' -F4PGA_HASH='66a976d' - -case "$FPGA_FAM" in - xc7) PACKAGES='install-xc7 xc7z010_test';; - eos-s3) PACKAGES='install-ql ql-eos-s3_wlcsp';; - *) - echo "Unknowd FPGA_FAM <${FPGA_FAM}>!" - exit 1 -esac - -for PKG in $PACKAGES; do - wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/${F4PGA_TIMESTAMP}/symbiflow-arch-defs-${PKG}-${F4PGA_HASH}.tar.xz \ - | tar -xJC $F4PGA_INSTALL_DIR_FAM -done - -rm -vrf $F4PGA_INSTALL_DIR_FAM/share/f4pga/scripts - -echo '::endgroup::' - - -echo '::group::Create environment' - -conda env create -f $F4PGA_INSTALL_DIR_FAM/"$FPGA_FAM"_env/"$FPGA_FAM"_environment.yml - -echo '::endgroup::' diff --git a/.github/scripts/sphinx.sh b/.github/scripts/sphinx.sh index c631ed0a..e5f578b4 100755 --- a/.github/scripts/sphinx.sh +++ b/.github/scripts/sphinx.sh @@ -4,6 +4,6 @@ set -e cd $(dirname $0)/../../docs -pip3 install --user -r requirements.txt +pip3 install -r requirements.txt make html latex diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 332e5f90..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Python package - -on: [pull_request, push] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install requirements - run: | - sudo apt-get update - sudo apt-get install -y antlr4 libantlr4-runtime-dev python3-dev yosys - python3 -m pip install --upgrade pip - python3 -m pip install setuptools flake8 pytest wheel - python3 -m pip install git+https://github.com/antmicro/tuttest - - - name: Set up F4PGA - run: | - export FPGA_FAM="xc7" - export F4PGA_INSTALL_DIR="${HOME}/opt/f4pga" - export F4PGA_INSTALL_DIR_FAM="${F4PGA_INSTALL_DIR}/${FPGA_FAM}" - ./.github/scripts/prepare_environment.sh - source .github/scripts/activate.sh - pip3 install https://github.com/chipsalliance/f4pga/archive/main.zip#subdirectory=f4pga - - - name: Lint with flake8 - run: | - flake8 fpga_topwrap --count --show-source --statistics - - - name: Build - run: | - tuttest README.md | bash - - - - name: Test with pytest - run: | - pytest - - - name: Generate sources for example HDMI setup - run: | - cd examples/hdmi - tuttest README.md generate | bash - - cd - - - - name: Build example PWM setup - run: | - export FPGA_FAM="xc7" - export F4PGA_INSTALL_DIR="${HOME}/opt/f4pga" - export F4PGA_INSTALL_DIR_FAM="${F4PGA_INSTALL_DIR}/${FPGA_FAM}" - source .github/scripts/activate.sh - cd examples/pwm - tuttest README.md build | bash - - cd - - cp examples/pwm/build/project_1_0/zynq-symbiflow/project_top.bit ./top.bit - - - name: Store bit - uses: actions/upload-artifact@v3 - with: - name: top.bit - path: top.bit diff --git a/.github/workflows/ghpages.yml b/.github/workflows/ghpages.yml deleted file mode 100644 index 063265d7..00000000 --- a/.github/workflows/ghpages.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: GH Pages - -on: - pull_request: - push: - branches: - - main - -jobs: - docs-generation: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - uses: docker://btdi/sphinx:min - with: - args: ./.github/scripts/sphinx.sh - - - uses: docker://btdi/latex - with: - args: ./.github/scripts/latex.sh - - - name: 'Upload artifact: Sphinx HTML and PDF' - uses: actions/upload-artifact@v3 - with: - name: Documentation - path: docs/build/html - - - name: Deploy to Github Pages - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' - run: | - sudo chown -R $(whoami) docs - cd docs/build/html - touch .nojekyll - git init - cp ../../../.git/config ./.git/config - git add . - git config --local user.email "push@gha" - git config --local user.name "GHA" - git commit -am "update ${{ github.sha }}" - git push -u origin +HEAD:gh-pages - rm -rf .git diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 00000000..0f539ccc --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,135 @@ +name: Pipeline + + +on: [pull_request, push, workflow_dispatch] + + +jobs: + + + Tests: + + runs-on: ubuntu-latest + name: "Test Python ${{ matrix.python-version }}" + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dev requirements + run: | + sudo apt-get update -qq + sudo apt-get install -y \ + antlr4 \ + libantlr4-runtime-dev \ + python3-dev \ + yosys + python3 -m pip install --upgrade pip wheel setuptools + python3 -m pip install -r dev.requirements.txt + python3 -m pip install git+https://github.com/antmicro/tuttest + + - name: Lint with flake8 + run: flake8 fpga_topwrap --count --show-source --statistics + + - name: Build + run: tuttest README.md | bash - + + - name: Test with pytest + run: pytest + + + Examples: + + runs-on: ubuntu-latest + name: 'Example ${{ matrix.example }}' + strategy: + fail-fast: false + matrix: + example: + - HDMI + - PWM + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install tuttest and fpga-topwrap + run: | + python3 -m pip install git+https://github.com/antmicro/tuttest + tuttest README.md | bash - + + - name: Generate sources for example HDMI setup + if: matrix.example == 'HDMI' + run: | + cd examples/hdmi + tuttest README.md generate | bash - + cd - + + - name: Generate sources for and build example PWM setup + if: matrix.example == 'PWM' + run: | + cd examples/pwm + make generate copy_sources + cd - + + docker run --rm -i -v $(pwd):/wrk -w /wrk \ + gcr.io/hdl-containers/conda/f4pga/xc7/z010 \ + bash -le <<'EOF' + pip3 install -r impl.requirements.txt + cd examples/pwm + make zvb + EOF + + cp examples/pwm/build/project_1_0/zynq-symbiflow/project_top.bit top.bit + + - uses: actions/upload-artifact@v3 + if: matrix.example == 'PWM' + with: + name: top.bit + path: top.bit + + + Docs: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: docker://btdi/sphinx:min + with: + args: ./.github/scripts/sphinx.sh + + - uses: docker://btdi/latex + with: + args: ./.github/scripts/latex.sh + + - name: 'Upload artifact: Sphinx HTML and PDF' + uses: actions/upload-artifact@v3 + with: + name: Documentation + path: docs/build/html + + - name: Deploy to Github Pages + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + run: | + sudo chown -R $(whoami) docs + cd docs/build/html + touch .nojekyll + git init + cp ../../../.git/config ./.git/config + git add . + git config --local user.email "push@gha" + git config --local user.name "GHA" + git commit -am "update ${{ github.sha }}" + git push -u origin +HEAD:gh-pages + rm -rf .git diff --git a/dev.requirements.txt b/dev.requirements.txt new file mode 100644 index 00000000..28ecacab --- /dev/null +++ b/dev.requirements.txt @@ -0,0 +1,2 @@ +flake8 +pytest diff --git a/docs/source/index.md b/docs/source/index.md index 4e5bc658..38e75c6c 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -4,22 +4,13 @@ :maxdepth: 2 introduction - getting_started - description_files - cli - pipeline_manager - wrapper_port - ipwrapper - ipconnect - helpers - fusesoc ``` diff --git a/examples/pwm/Makefile b/examples/pwm/Makefile index 5bb39b8a..2b39d5a3 100644 --- a/examples/pwm/Makefile +++ b/examples/pwm/Makefile @@ -1,6 +1,6 @@ # Copyright (C) 2021 Antmicro # SPDX-License-Identifier: Apache-2.0 -all: zvb +all: generate copy_sources zvb build: mkdir build @@ -15,7 +15,7 @@ copy_sources: build cp -rf sources/ build/ cp -rf ipcores/* build/ -zvb: generate copy_sources +zvb: fusesoc --cores-root build run --tool=symbiflow --build --target zynq project_1 zvb_vivado: generate copy_sources diff --git a/impl.requirements.txt b/impl.requirements.txt new file mode 100644 index 00000000..f4cb0921 --- /dev/null +++ b/impl.requirements.txt @@ -0,0 +1,2 @@ +edalize==0.4.0 +fusesoc==1.12.0 diff --git a/requirements.txt b/requirements.txt index 6c67f932..2fc1fb90 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ PyYaml click amaranth-yosys -edalize==0.4.0 -fusesoc==1.12.0 git+https://github.com/amaranth-lang/amaranth wasmtime==1.0.1 numexpr hdlConvertor git+https://github.com/antmicro/kenning-pipeline-manager-backend-communication.git + +-r impl.requirements.txt diff --git a/setup.py b/setup.py index fb05cd29..52050bab 100644 --- a/setup.py +++ b/setup.py @@ -22,8 +22,6 @@ 'PyYAML', 'click', 'amaranth-yosys', - 'edalize==0.4.0', - 'fusesoc==1.12.0', 'amaranth @ git+https://github.com/amaranth-lang/amaranth', 'wasmtime==1.0.1', 'numexpr',