2022-03-19 23:36:21 -04:00
|
|
|
# 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
|
|
|
|
|
2022-02-27 09:27:49 -05:00
|
|
|
name: Pipeline
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
2022-04-23 20:38:17 -04:00
|
|
|
|
2022-05-24 08:53:47 -04:00
|
|
|
License-check:
|
|
|
|
name: Check license headers
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
2022-08-14 22:47:52 -04:00
|
|
|
- name: 🧰 Checkout
|
|
|
|
uses: actions/checkout@v3
|
2022-05-24 08:53:47 -04:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Check Licenses
|
|
|
|
uses: SymbiFlow/actions/checks@main
|
|
|
|
|
|
|
|
|
2022-08-14 22:47:52 -04:00
|
|
|
Format:
|
|
|
|
name: '🐍 Format'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: 🧰 Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: 🐍 Setup Python
|
2022-08-21 22:20:38 -04:00
|
|
|
uses: actions/setup-python@v4
|
2022-08-14 22:47:52 -04:00
|
|
|
with:
|
|
|
|
python-version: '3.10'
|
|
|
|
|
|
|
|
- name: 🔧 Install dependencies
|
|
|
|
run: python -m pip install -r test/requirements.txt
|
|
|
|
|
|
|
|
- name: 🚦 Check if Python sources follow code formatting standards
|
|
|
|
run: python -m black --check f4pga
|
|
|
|
|
|
|
|
|
2022-02-27 09:27:49 -05:00
|
|
|
Docs:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: '📓 Docs'
|
|
|
|
steps:
|
|
|
|
|
2022-04-23 20:38:17 -04:00
|
|
|
- name: 🧰 Checkout
|
2022-02-27 09:27:49 -05:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: 🛠️ Setup environment
|
|
|
|
run: |
|
|
|
|
sudo apt update -qq
|
|
|
|
sudo apt install -y make
|
2022-03-08 20:11:44 -05:00
|
|
|
make -C docs env
|
2022-02-27 09:27:49 -05:00
|
|
|
|
|
|
|
- name: 📓 Build the documentation
|
|
|
|
run: |
|
2022-03-08 20:11:44 -05:00
|
|
|
. ./docs/env/conda/bin/activate f4pga-docs
|
|
|
|
make -C docs html
|
2022-02-27 09:27:49 -05:00
|
|
|
|
|
|
|
- name: '📤 Upload artifact: Sphinx HTML'
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: Documentation-HTML
|
2022-03-08 20:11:44 -05:00
|
|
|
path: docs/_build/html
|
2022-02-27 09:27:49 -05:00
|
|
|
|
|
|
|
- name: 🚀 Publish site to GitHub Pages
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
run: |
|
2022-03-08 20:11:44 -05:00
|
|
|
cd docs/_build/html
|
2022-02-27 09:27:49 -05:00
|
|
|
touch .nojekyll
|
|
|
|
git init
|
2022-03-08 20:11:44 -05:00
|
|
|
cp ../../../.git/config ./.git/config
|
2022-02-27 09:27:49 -05:00
|
|
|
git add .
|
|
|
|
git config --local user.email "BuildTheDocs@GitHubActions"
|
|
|
|
git config --local user.name "GitHub Actions"
|
|
|
|
git commit -a -m "update ${{ github.sha }}"
|
|
|
|
git push -u origin +HEAD:gh-pages
|
|
|
|
|
|
|
|
|
2022-08-01 19:58:18 -04:00
|
|
|
Install:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: 🐍 Install f4pga (pip zipfile)
|
|
|
|
run: pip3 install https://github.com/"$GITHUB_REPOSITORY"/archive/"$GITHUB_REF".zip#subdirectory=f4pga
|
|
|
|
|
|
|
|
|
2022-07-31 07:50:23 -04:00
|
|
|
Builds:
|
2022-02-27 09:27:49 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-07-31 07:50:23 -04:00
|
|
|
flow:
|
|
|
|
- SymbiFlow
|
|
|
|
- F4PGA
|
|
|
|
fam:
|
|
|
|
- xc7
|
|
|
|
- eos-s3
|
|
|
|
name: '🚦 ${{ matrix.flow }} | ${{ matrix.fam }}'
|
2022-02-27 09:27:49 -05:00
|
|
|
env:
|
|
|
|
F4PGA_INSTALL_DIR: /opt/f4pga
|
2022-06-08 05:04:27 -04:00
|
|
|
FPGA_FAM: ${{ matrix.fam }}
|
2022-02-27 09:27:49 -05:00
|
|
|
|
|
|
|
steps:
|
|
|
|
|
2022-04-23 20:38:17 -04:00
|
|
|
- name: 🧰 Checkout
|
2022-02-27 09:27:49 -05:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2022-04-23 20:38:17 -04:00
|
|
|
- name: 🔧 Prepare environment
|
2022-08-06 08:56:58 -04:00
|
|
|
run: ./scripts/prepare_environment.sh
|
2022-02-27 09:27:49 -05:00
|
|
|
|
2022-04-23 20:38:17 -04:00
|
|
|
- name: 🐍 Install f4pga (pip)
|
2022-03-19 22:59:49 -04:00
|
|
|
run: |
|
2022-08-06 08:56:58 -04:00
|
|
|
. ./scripts/activate.sh
|
2022-03-19 22:59:49 -04:00
|
|
|
cd f4pga
|
2022-05-12 13:53:05 -04:00
|
|
|
pip install .
|
2022-03-19 22:59:49 -04:00
|
|
|
cd ..
|
|
|
|
|
2022-08-03 22:23:37 -04:00
|
|
|
- name: 🛠️ Clone f4pga-examples
|
|
|
|
run: git clone --recurse-submodules https://github.com/chipsalliance/f4pga-examples
|
|
|
|
|
2022-07-31 07:50:23 -04:00
|
|
|
# F4PGA
|
|
|
|
|
|
|
|
- name: 🚧 [F4PGA] Test f4pga build
|
|
|
|
if: matrix.flow == 'F4PGA'
|
|
|
|
run: |
|
2022-08-06 08:56:58 -04:00
|
|
|
. ./scripts/activate.sh
|
2022-08-03 22:23:37 -04:00
|
|
|
cd f4pga-examples/${{ matrix.fam }}
|
|
|
|
f4pga -vv build --flow ../../.github/${{ matrix.fam }}_test.json
|
2022-07-31 07:50:23 -04:00
|
|
|
|
2022-07-31 07:55:02 -04:00
|
|
|
- name: '📤 Upload artifact: ${{ matrix.fam }} bitstream'
|
|
|
|
if: matrix.flow == 'F4PGA'
|
2022-07-31 07:50:23 -04:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2022-07-31 07:55:02 -04:00
|
|
|
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
|
2022-08-03 22:23:37 -04:00
|
|
|
path: f4pga-examples/${{ matrix.fam }}/build/top.bit
|
2022-07-31 07:50:23 -04:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
# SymbiFlow
|
|
|
|
|
|
|
|
- name: 🚧 [SymbiFlow] Test make example
|
|
|
|
if: matrix.flow == 'SymbiFlow'
|
2022-02-27 09:27:49 -05:00
|
|
|
run: |
|
2022-08-06 08:56:58 -04:00
|
|
|
. ./scripts/activate.sh
|
2022-08-03 22:23:37 -04:00
|
|
|
cd f4pga-examples/${{ matrix.fam }}
|
2022-08-01 21:02:26 -04:00
|
|
|
export F4PGA_USE_DEPRECATED=true
|
2022-02-27 09:27:49 -05:00
|
|
|
case '${{ matrix.fam }}' in
|
2022-08-01 21:02:26 -04:00
|
|
|
xc7) TARGET="arty_35" make -C counter_test;;
|
2022-02-27 09:27:49 -05:00
|
|
|
eos-s3) make -C btn_counter;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
- name: '📤 Upload artifact: Arty 35 bitstream'
|
2022-07-31 07:55:02 -04:00
|
|
|
if: matrix.flow == 'SymbiFlow' && matrix.fam == 'xc7'
|
2022-02-27 09:27:49 -05:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2022-07-31 07:55:02 -04:00
|
|
|
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
|
|
|
|
path: f4pga-examples/${{ matrix.fam }}/counter_test/build/arty_35/top.bit
|
2022-02-27 09:27:49 -05:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
- name: '📤 Upload artifact: QuickLogic bitstream'
|
2022-07-31 07:55:02 -04:00
|
|
|
if: matrix.flow == 'SymbiFlow' && matrix.fam == 'eos-s3'
|
2022-02-27 09:27:49 -05:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2022-07-31 07:55:02 -04:00
|
|
|
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
|
|
|
|
path: f4pga-examples/${{ matrix.fam }}/btn_counter/build/top.bit
|
2022-02-27 09:27:49 -05:00
|
|
|
if-no-files-found: error
|
2022-04-23 20:38:17 -04:00
|
|
|
|
2022-07-20 11:59:28 -04:00
|
|
|
Lattice:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: '🚦 Lattice | ice40'
|
|
|
|
env:
|
|
|
|
F4PGA_INSTALL_DIR: /usr/local
|
|
|
|
FPGA_FAM: ice40
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: 🧰 Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: 🛠️ Clone fomu-workshop
|
|
|
|
run: git clone https://github.com/im-tomu/fomu-workshop
|
|
|
|
|
|
|
|
- name: 🚧 [F4PGA] Test f4pga build
|
|
|
|
run: |
|
|
|
|
cat > ice40-test.sh <<'EOF'
|
|
|
|
set -e
|
|
|
|
apt-get update -qq
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends python3-pip git
|
|
|
|
|
|
|
|
pip install ./f4pga
|
|
|
|
|
|
|
|
cd fomu-workshop/hdl/verilog/blink
|
|
|
|
f4pga -vv build --flow ../../../../.github/ice40_test.json
|
|
|
|
EOF
|
|
|
|
|
|
|
|
docker run --rm -i \
|
|
|
|
-v $(pwd):/wrk -w /wrk \
|
|
|
|
-e FPGA_FAM=ice40 \
|
|
|
|
gcr.io/hdl-containers/impl/icestorm \
|
|
|
|
bash -le /wrk/ice40-test.sh
|
|
|
|
|
|
|
|
- name: '📤 Upload artifact: ice40 bitstream'
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: Lattice-ice40-Bitstream
|
|
|
|
path: fomu-workshop/hdl/verilog/blink/build/top.bit
|
|
|
|
if-no-files-found: error
|
|
|
|
|
2022-04-23 20:38:17 -04:00
|
|
|
|
2022-07-31 07:50:23 -04:00
|
|
|
Python-Tests:
|
2022-04-23 20:38:17 -04:00
|
|
|
runs-on: ubuntu-latest
|
2022-07-31 07:50:23 -04:00
|
|
|
name: '🐍 Python Tests'
|
2022-04-23 20:38:17 -04:00
|
|
|
env:
|
|
|
|
F4PGA_INSTALL_DIR: /opt/f4pga
|
2022-06-08 05:04:27 -04:00
|
|
|
FPGA_FAM: xc7
|
2022-04-23 20:38:17 -04:00
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: 🧰 Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: 🔧 Prepare environment
|
2022-08-06 08:56:58 -04:00
|
|
|
run: ./scripts/prepare_environment.sh
|
2022-04-23 20:38:17 -04:00
|
|
|
|
|
|
|
- name: 🐍 Install f4pga (pip)
|
|
|
|
run: |
|
2022-08-06 08:56:58 -04:00
|
|
|
. ./scripts/activate.sh
|
2022-04-23 20:38:17 -04:00
|
|
|
cd f4pga
|
2022-07-12 09:21:17 -04:00
|
|
|
pip install .
|
2022-04-23 20:38:17 -04:00
|
|
|
cd ..
|
|
|
|
|
2022-07-31 07:50:23 -04:00
|
|
|
- name: 🚦 Test Python wrappers
|
2022-04-23 20:38:17 -04:00
|
|
|
run: |
|
2022-08-06 08:56:58 -04:00
|
|
|
. ./scripts/activate.sh
|
2022-07-31 07:50:23 -04:00
|
|
|
pip3 install -r ./test/requirements.txt
|
|
|
|
pytest --verbose --capture=no -rA --color=yes test/
|
2022-04-23 20:38:17 -04:00
|
|
|
|
|
|
|
|
2022-03-03 18:15:32 -05:00
|
|
|
PYTHONPATH:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: '🐍 PYTHONPATH'
|
|
|
|
env:
|
|
|
|
F4PGA_INSTALL_DIR: /opt/f4pga
|
2022-06-08 05:04:27 -04:00
|
|
|
FPGA_FAM: xc7
|
2022-03-03 18:15:32 -05:00
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: 🧰 Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: 🚧 Test pyF4PGA (PYTHONPATH)
|
2022-04-23 20:38:17 -04:00
|
|
|
run: |
|
2022-09-28 19:47:51 -04:00
|
|
|
PYTHONPATH=$(pwd) python3 -m f4pga
|
|
|
|
PYTHONPATH=$(pwd) python3 -m f4pga -h
|