f4pga/.github/workflows/Pipeline.yml

217 lines
5.6 KiB
YAML
Raw Normal View History

# 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
name: Pipeline
on:
workflow_call:
jobs:
License-check:
name: Check license headers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Check Licenses
uses: SymbiFlow/actions/checks@main
Docs:
runs-on: ubuntu-latest
name: '📓 Docs'
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: 🛠️ Setup environment
run: |
sudo apt update -qq
sudo apt install -y make
make -C docs env
- name: 📓 Build the documentation
run: |
. ./docs/env/conda/bin/activate f4pga-docs
make -C docs html
- name: '📤 Upload artifact: Sphinx HTML'
uses: actions/upload-artifact@v3
with:
name: Documentation-HTML
path: docs/_build/html
- name: 🚀 Publish site to GitHub Pages
if: github.event_name != 'pull_request'
run: |
cd docs/_build/html
touch .nojekyll
git init
cp ../../../.git/config ./.git/config
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
Builds:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flow:
- SymbiFlow
- F4PGA
fam:
- xc7
- eos-s3
name: '🚦 ${{ matrix.flow }} | ${{ matrix.fam }}'
env:
F4PGA_INSTALL_DIR: /opt/f4pga
FPGA_FAM: ${{ matrix.fam }}
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
- name: 🔧 Prepare environment
run: ./.github/scripts/prepare_environment.sh
- name: 🐍 Install f4pga (pip)
run: |
. ./.github/scripts/activate.sh
cd f4pga
pip install .
cd ..
# F4PGA
- name: 🚧 [F4PGA] Test f4pga build
if: matrix.flow == 'F4PGA'
run: |
. ./.github/scripts/activate.sh
cd f4pga-examples
f4pga build --flow ../.github/${{ matrix.fam }}_test.json
- name: '📤 Upload artifact: ${{ matrix.fam }} bitstream'
if: matrix.flow == 'F4PGA'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
path: f4pga-examples/build/${{ matrix.fam }}/top.bit
if-no-files-found: error
# SymbiFlow
- name: 🚧 [SymbiFlow] Test f4pga-env
if: matrix.flow == 'SymbiFlow'
run: |
. ./.github/scripts/activate.sh
echo "F4PGA_BIN_DIR=$(f4pga-env bin)" >> "$GITHUB_ENV"
echo "F4PGA_SHARE_DIR=$(f4pga-env share)" >> "$GITHUB_ENV"
- name: 🚧 [SymbiFlow] Test make example
if: matrix.flow == 'SymbiFlow'
run: |
. ./.github/scripts/activate.sh
export VPRPATH=$(f4pga-env bin)
cd f4pga-examples
cd ${{ matrix.fam }}
case '${{ matrix.fam }}' in
xc7) TARGET="arty_35" F4PGA_USE_DEPRECATED=true make -C counter_test;;
eos-s3) make -C btn_counter;;
esac
- name: '📤 Upload artifact: Arty 35 bitstream'
if: matrix.flow == 'SymbiFlow' && matrix.fam == 'xc7'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
path: f4pga-examples/${{ matrix.fam }}/counter_test/build/arty_35/top.bit
if-no-files-found: error
- name: '📤 Upload artifact: QuickLogic bitstream'
if: matrix.flow == 'SymbiFlow' && matrix.fam == 'eos-s3'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
path: f4pga-examples/${{ matrix.fam }}/btn_counter/build/top.bit
if-no-files-found: error
Python-Tests:
runs-on: ubuntu-latest
name: '🐍 Python Tests'
env:
F4PGA_INSTALL_DIR: /opt/f4pga
FPGA_FAM: xc7
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
- name: 🔧 Prepare environment
run: ./.github/scripts/prepare_environment.sh
- name: 🐍 Install f4pga (pip)
run: |
. ./.github/scripts/activate.sh
cd f4pga
pip install .
cd ..
- name: 🚦 Test Python wrappers
run: |
. ./.github/scripts/activate.sh
pip3 install -r ./test/requirements.txt
pytest --verbose --capture=no -rA --color=yes test/
PYTHONPATH:
runs-on: ubuntu-latest
name: '🐍 PYTHONPATH'
env:
F4PGA_INSTALL_DIR: /opt/f4pga
FPGA_FAM: xc7
steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
- name: 🚧 Test pyF4PGA (PYTHONPATH)
run: |
PYTHONPATH=$(pwd) python3 f4pga/__init__.py
PYTHONPATH=$(pwd) python3 f4pga/__init__.py -h