Skip to content

Commit

Permalink
Merge pull request #2829 from antmicro/umarcor/install
Browse files Browse the repository at this point in the history
ci/scripts: combine install_xc7 and install_ql into install
  • Loading branch information
kgugala authored Aug 4, 2022
2 parents ff7b1c8 + 687e595 commit ee6c747
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 164 deletions.
135 changes: 135 additions & 0 deletions .github/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/usr/bin/env bash

set -e

INSTALL_DIR="$(pwd)/install"
mkdir -p $INSTALL_DIR

case "$1" in
eos-s3|ql) export FPGA_FAM=eos-s3 ;;
*) export FPGA_FAM=xc7 ;;
esac

echo "Set CMAKE_FLAGS"
case "$FPGA_FAM" in
xc7)
INSTALL_FAMILIES='xc7'
;;
eos-s3)
INSTALL_FAMILIES='qlf_k4n8,pp3'
;;
*)
echo "Unknown FPGA_FAM <$FPGA_FAM>!"
exit 1
;;
esac
export CMAKE_FLAGS="-GNinja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DINSTALL_FAMILIES=${INSTALL_FAMILIES}"

echo "Set environment variables for F4PGA CLI utils"
case "$FPGA_FAM" in
xc7)
export F4PGA_INSTALL_DIR="placeholder"
export F4PGA_BIN_DIR="$(cd $(dirname "$0"); pwd)/../../env/conda/envs/symbiflow_arch_def_base/bin"
# TODO: We should place the content in subdir F4PGA_FAM, to use the default in f4pga instead of overriding F4PGA_ENV_SHARE here.
export F4PGA_SHARE_DIR="$(cd $(dirname "$0"); pwd)/../../install/share/f4pga"
;;
eos-s3)
export F4PGA_INSTALL_DIR="placeholder"
export F4PGA_SHARE_DIR="${INSTALL_DIR}"/share/f4pga
export F4PGA_BIN_DIR="${INSTALL_DIR}"/bin/
;;
esac

source $(dirname "$0")/setup-and-activate.sh

echo "----------------------------------------"

pushd build
make_target install "Installing toolchain (make install)"
popd

cp \
packaging/"$FPGA_FAM"_environment.yml \
packaging/requirements.txt \
packaging/"$FPGA_FAM"_requirements.txt \
$INSTALL_DIR/

echo "----------------------------------------"

heading "Running installed toolchain tests"
pushd build
export VPR_NUM_WORKERS=${MAX_CORES}
export CTEST_OUTPUT_ON_FAILURE=1
case "$FPGA_FAM" in
xc7)
ctest -R binary_toolchain_test_xc7* -j${MAX_CORES}
;;
eos-s3)
heading "Testing installed toolchain on qlf_k4n8"
ctest -j${MAX_CORES} -R "quicklogic_toolchain_test_.*_qlf_k4n8" -VV
echo "----------------------------------------"
heading "Testing installed toolchain on ql_eos_s3"
ctest -j${MAX_CORES} -R "quicklogic_toolchain_test_.*_ql-eos-s3" -VV
;;
esac
popd
echo "----------------------------------------"

heading "Compressing install dir (creating packages)"
rm -rf build
# Remove symbolic links and copy content of the linked files
for file in $(find install -type l)
do cp --remove-destination $(readlink $file) $file
done

du -ah install
export GIT_HASH=$(git rev-parse --short HEAD)

pushd install
mkdir -p "$FPGA_FAM"_env
mv "$FPGA_FAM"_environment.yml \
requirements.txt \
"$FPGA_FAM"_requirements.txt \
"$FPGA_FAM"_env
popd

case "$FPGA_FAM" in
xc7)
tar -I "pixz" -cvf \
symbiflow-arch-defs-install-xc7-${GIT_HASH}.tar.xz \
-C install \
share/f4pga/techmaps \
share/f4pga/scripts \
"$FPGA_FAM"_env
tar -I "pixz" -cvf \
symbiflow-arch-defs-benchmarks-xc7-${GIT_HASH}.tar.xz \
-C install \
benchmarks
for device in $(ls install/share/f4pga/arch); do
if [[ $device = xc7* ]]; then
tar -I "pixz" -cvf \
symbiflow-arch-defs-$device-${GIT_HASH}.tar.xz \
-C install \
share/f4pga/arch/$device
fi
done
;;
eos-s3)
tar -I "pixz" -cvf \
symbiflow-arch-defs-install-ql-${GIT_HASH}.tar.xz \
-C install \
share/f4pga/techmaps \
share/f4pga/scripts \
"$FPGA_FAM"_env
for device in $(ls install/share/f4pga/arch); do
if [[ $device = ql* ]]; then
tar -I "pixz" -cvf \
symbiflow-arch-defs-$device-${GIT_HASH}.tar.xz \
-C install \
share/f4pga/arch/$device
fi
done
;;
esac
rm -rf install
echo "----------------------------------------"
82 changes: 0 additions & 82 deletions .github/scripts/install_ql.sh

This file was deleted.

77 changes: 0 additions & 77 deletions .github/scripts/install_xc7.sh

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ jobs:
strategy:
fail-fast: false
matrix:
install:
- install_xc7
- install_ql
fam:
- xc7
- ql

name: ${{ matrix.install }}
name: Install | ${{ matrix.fam }}

env:
MAX_CORES: 80
Expand All @@ -80,7 +80,7 @@ jobs:
submodules: recursive

- name: '🚧 Execute test script'
run: stdbuf -i0 -o0 -e0 ./.github/scripts/${{ matrix.install }}.sh
run: stdbuf -i0 -o0 -e0 ./.github/scripts/install.sh '${{ matrix.fam }}'

- name: '📤 Upload artifact: arch-defs packages'
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit ee6c747

Please sign in to comment.