ci/scripts: add envvars.sh; move f4pga-env stuff out from prepare_environment
Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
parent
158b7b8a38
commit
e1e9e61b82
|
@ -18,11 +18,5 @@
|
|||
|
||||
set -e
|
||||
|
||||
FPGA_FAM=${FPGA_FAM:=xc7}
|
||||
|
||||
F4PGA_DIR_ROOT='install'
|
||||
|
||||
export PATH="$F4PGA_INSTALL_DIR/$FPGA_FAM/$F4PGA_DIR_ROOT/bin:$PATH"
|
||||
source "$F4PGA_INSTALL_DIR/$FPGA_FAM/conda/etc/profile.d/conda.sh"
|
||||
|
||||
source "${F4PGA_INSTALL_DIR}/${FPGA_FAM}/conda/etc/profile.d/conda.sh"
|
||||
conda activate $FPGA_FAM
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/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
|
||||
|
||||
FPGA_FAM="${FPGA_FAM:=xc7}"
|
||||
F4PGA_INSTALL_DIR="${F4PGA_INSTALL_DIR:=/opt/f4pga}"
|
||||
F4PGA_DIR_ROOT="${F4PGA_DIR_ROOT:=install}"
|
||||
F4PGA_INSTALL_DIR_FAM_ROOT="${F4PGA_INSTALL_DIR}/${FPGA_FAM}/${F4PGA_DIR_ROOT}"
|
||||
|
||||
echo "FPGA_FAM: $FPGA_FAM"
|
||||
echo "F4PGA_INSTALL_DIR: $F4PGA_INSTALL_DIR"
|
||||
echo "F4PGA_DIR_ROOT: $F4PGA_DIR_ROOT"
|
||||
echo "F4PGA_INSTALL_DIR_FAM_ROOT: $F4PGA_INSTALL_DIR_FAM_ROOT"
|
|
@ -18,59 +18,57 @@
|
|||
|
||||
set -e
|
||||
|
||||
|
||||
echo '::group::Install dependencies'
|
||||
|
||||
sudo apt update -y
|
||||
sudo apt install -y git wget xz-utils
|
||||
|
||||
echo '::endgroup::'
|
||||
|
||||
|
||||
echo '::group::Environment variables'
|
||||
|
||||
source $(dirname "$0")/envvars.sh
|
||||
|
||||
echo '::endgroup::'
|
||||
|
||||
FPGA_FAM=${FPGA_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/$FPGA_FAM"
|
||||
bash conda_installer.sh -u -b -p "${F4PGA_INSTALL_DIR}/${FPGA_FAM}"/conda
|
||||
source "${F4PGA_INSTALL_DIR}/${FPGA_FAM}"/conda/etc/profile.d/conda.sh
|
||||
|
||||
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::Install arch-defs'
|
||||
mkdir -p "$F4PGA_INSTALL_DIR_FAM"/install
|
||||
|
||||
mkdir -p "$F4PGA_INSTALL_DIR_FAM_ROOT"
|
||||
|
||||
F4PGA_TIMESTAMP='20220802-192547'
|
||||
F4PGA_HASH='b120b1f'
|
||||
|
||||
case "$FPGA_FAM" in
|
||||
xc7)
|
||||
F4PGA_TIMESTAMP='20220802-192547'
|
||||
F4PGA_HASH='b120b1f'
|
||||
for PKG in install-xc7 xc7a50t_test; 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/install
|
||||
done
|
||||
;;
|
||||
eos-s3)
|
||||
F4PGA_TIMESTAMP='20220802-192547'
|
||||
F4PGA_HASH='b120b1f'
|
||||
for PKG in install-ql ql-eos-s3_wlcsp; 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/install
|
||||
done
|
||||
;;
|
||||
xc7) PACKAGES='install-xc7 xc7a50t_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_ROOT
|
||||
done
|
||||
|
||||
echo '::endgroup::'
|
||||
|
||||
|
||||
echo '::group::Create environment'
|
||||
conda env create -f $F4PGA_INSTALL_DIR_FAM/install/"$FPGA_FAM"_env/"$FPGA_FAM"_environment.yml
|
||||
|
||||
conda env create -f $F4PGA_INSTALL_DIR_FAM_ROOT/"$FPGA_FAM"_env/"$FPGA_FAM"_environment.yml
|
||||
|
||||
echo '::endgroup::'
|
||||
|
||||
|
||||
echo '::group::Add f4pga-env'
|
||||
|
||||
F4PGA_DIR_ROOT='install'
|
||||
|
||||
F4PGA_DIR_BIN="$F4PGA_INSTALL_DIR_FAM/$F4PGA_DIR_ROOT"/bin/
|
||||
mkdir -p "$F4PGA_DIR_BIN"
|
||||
cp $(dirname "$0")/../../f4pga-env "$F4PGA_DIR_BIN"
|
||||
echo '::endgroup::'
|
||||
|
||||
|
||||
cd "$F4PGA_DIR_BIN"
|
||||
ls -lah
|
||||
|
||||
|
|
|
@ -141,20 +141,15 @@ jobs:
|
|||
|
||||
# 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/envvars.sh
|
||||
. ./.github/scripts/activate.sh
|
||||
|
||||
export VPRPATH=$(f4pga-env bin)
|
||||
export F4PGA_BIN_DIR="$F4PGA_INSTALL_DIR_FAM_ROOT"/bin/
|
||||
export F4PGA_SHARE_DIR="$F4PGA_INSTALL_DIR_FAM_ROOT"/share/f4pga
|
||||
export VPRPATH=$F4PGA_BIN_DIR
|
||||
|
||||
echo '::group::Clone f4pga-examples'
|
||||
git clone --recurse-submodules https://github.com/chipsalliance/f4pga-examples
|
||||
|
@ -234,3 +229,42 @@ jobs:
|
|||
run: |
|
||||
PYTHONPATH=$(pwd) python3 f4pga/__init__.py
|
||||
PYTHONPATH=$(pwd) python3 f4pga/__init__.py -h
|
||||
|
||||
|
||||
f4pga-env:
|
||||
runs-on: ubuntu-latest
|
||||
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-env
|
||||
run: |
|
||||
cd ./.github/scripts
|
||||
. ./envvars.sh
|
||||
export PATH="${F4PGA_INSTALL_DIR_FAM_ROOT}/bin:$PATH"
|
||||
. ./activate.sh
|
||||
|
||||
F4PGA_DIR_BIN="$F4PGA_INSTALL_DIR_FAM_ROOT"/bin/
|
||||
mkdir -p "$F4PGA_DIR_BIN"
|
||||
cp f4pga-env "$F4PGA_DIR_BIN"
|
||||
|
||||
cd "$F4PGA_DIR_BIN"
|
||||
ls -lah
|
||||
|
||||
- name: 🚧 Test f4pga-env
|
||||
run: |
|
||||
. ./.github/scripts/activate.sh
|
||||
|
||||
echo "F4PGA_BIN_DIR=$(f4pga-env bin)" >> "$GITHUB_ENV"
|
||||
echo "F4PGA_SHARE_DIR=$(f4pga-env share)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: 🚧 env
|
||||
run: env
|
||||
|
|
Loading…
Reference in New Issue