ci: rename workflow to 'Pipeline'; add job Example

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-02-27 15:27:49 +01:00
parent 410339e3bf
commit 0e490e9862
5 changed files with 158 additions and 47 deletions

15
.github/scripts/activate.sh vendored Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
F4PGA_FAM=${F4PGA_FAM:=xc7}
case "$F4PGA_FAM" in
xc7) F4PGA_DIR_ROOT='install';;
eos-s3) F4PGA_DIR_ROOT='quicklogic-arch-defs';;
esac
export PATH="$F4PGA_INSTALL_DIR/$F4PGA_FAM/$F4PGA_DIR_ROOT/bin:$PATH"
source "$F4PGA_INSTALL_DIR/$F4PGA_FAM/conda/etc/profile.d/conda.sh"
conda activate $F4PGA_FAM

44
.github/scripts/prepare_environment.sh vendored Executable file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env bash
echo '::group::Install dependencies'
sudo apt update -y
sudo apt install -y git wget xz-utils
echo '::endgroup::'
echo '::group::Clone f4pga-examples'
git clone --recurse-submodules https://github.com/chipsalliance/f4pga-examples
cd f4pga-examples
echo '::endgroup::'
F4PGA_FAM=${F4PGA_FAM:=xc7}
echo '::group::Install Miniconda3'
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O conda_installer.sh
F4PGA_INSTALL_DIR_FAM="$F4PGA_INSTALL_DIR/$F4PGA_FAM"
bash conda_installer.sh -u -b -p "$F4PGA_INSTALL_DIR_FAM"/conda
source "$F4PGA_INSTALL_DIR_FAM"/conda/etc/profile.d/conda.sh
echo '::endgroup::'
echo '::group::Create environment'
conda env create -f "$F4PGA_FAM"/environment.yml
echo '::endgroup::'
echo '::group::Install arch-defs'
case "$F4PGA_FAM" in
xc7)
mkdir -p "$F4PGA_INSTALL_DIR_FAM"/install
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/535/20220128-000432/symbiflow-arch-defs-install-5fa5e715.tar.xz | tar -xJC $F4PGA_INSTALL_DIR/xc7/install
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/535/20220128-000432/symbiflow-arch-defs-xc7a50t_test-5fa5e715.tar.xz | tar -xJC $F4PGA_INSTALL_DIR/xc7/install
;;
eos-s3)
wget -qO- https://storage.googleapis.com/symbiflow-arch-defs-install/quicklogic-arch-defs-63c3d8f9.tar.gz | tar -xz -C $F4PGA_INSTALL_DIR_FAM
;;
esac
echo '::endgroup::'

View File

@ -12,7 +12,7 @@ jobs:
Pipeline:
if: ${{ !(github.event_name != 'pull_request' && github.actor == 'dependabot[bot]') }}
uses: ./.github/workflows/Doc.yml
uses: ./.github/workflows/Pipeline.yml
Automerge:

View File

@ -1,46 +0,0 @@
name: Docs
on:
workflow_call:
jobs:
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 env
- name: 📓 Build the documentation
run: |
. ./env/conda/bin/activate f4pga-docs
make html
- name: '📤 Upload artifact: Sphinx HTML'
uses: actions/upload-artifact@v3
with:
name: Documentation-HTML
path: _build/html
- name: 🚀 Publish site to GitHub Pages
if: github.event_name != 'pull_request'
run: |
cd _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

98
.github/workflows/Pipeline.yml vendored Normal file
View File

@ -0,0 +1,98 @@
name: Pipeline
on:
workflow_call:
jobs:
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 env
- name: 📓 Build the documentation
run: |
. ./env/conda/bin/activate f4pga-docs
make html
- name: '📤 Upload artifact: Sphinx HTML'
uses: actions/upload-artifact@v3
with:
name: Documentation-HTML
path: _build/html
- name: 🚀 Publish site to GitHub Pages
if: github.event_name != 'pull_request'
run: |
cd _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
Example:
runs-on: ubuntu-latest
name: '🐍 Example'
strategy:
fail-fast: false
matrix:
include:
- { fam: xc7, example: counter_test }
- { fam: eos-s3, example: btn_counter }
env:
F4PGA_INSTALL_DIR: /opt/f4pga
F4PGA_FAM: ${{ matrix.fam }}
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v3
- name: '🔧 Prepare environment'
run: ./.github/scripts/prepare_environment.sh
- name: '🚧 Test make example'
run: |
. ./.github/scripts/activate.sh
export VPRPATH=$(f4pga-env bin)
cd f4pga-examples
cd ${{ matrix.fam }}
case '${{ matrix.fam }}' in
xc7) TARGET="arty_35" make -C counter_test;;
eos-s3) make -C btn_counter;;
esac
- name: '📤 Upload artifact: Arty 35 bitstream'
if: matrix.fam == 'xc7'
uses: actions/upload-artifact@v3
with:
name: arty_35-Bitstream
path: f4pga-examples/xc7/counter_test/build/arty_35/top.bit
if-no-files-found: error
- name: '📤 Upload artifact: QuickLogic bitstream'
if: matrix.fam == 'eos-s3'
uses: actions/upload-artifact@v3
with:
name: eos-s3-Bitstream
path: f4pga-examples/eos-s3/btn_counter/build/top.bit
if-no-files-found: error