From 687e5954d382ffc55d7bcae0895ef5cfde43e0f1 Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Mon, 1 Aug 2022 02:10:19 +0200 Subject: [PATCH] ci/scripts: combine install_xc7 and install_ql into install Signed-off-by: Unai Martinez-Corral --- .github/scripts/install.sh | 135 +++++++++++++++++++++++++++++++++ .github/scripts/install_ql.sh | 82 -------------------- .github/scripts/install_xc7.sh | 77 ------------------- .github/workflows/Tests.yml | 10 +-- 4 files changed, 140 insertions(+), 164 deletions(-) create mode 100755 .github/scripts/install.sh delete mode 100755 .github/scripts/install_ql.sh delete mode 100755 .github/scripts/install_xc7.sh diff --git a/.github/scripts/install.sh b/.github/scripts/install.sh new file mode 100755 index 0000000000..3b2d0c08fa --- /dev/null +++ b/.github/scripts/install.sh @@ -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 "----------------------------------------" diff --git a/.github/scripts/install_ql.sh b/.github/scripts/install_ql.sh deleted file mode 100755 index 8b75ede973..0000000000 --- a/.github/scripts/install_ql.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash - -set -e - -INSTALL_DIR="$(pwd)/install" - -mkdir -p $INSTALL_DIR - -export CMAKE_FLAGS="-GNinja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DINSTALL_FAMILIES=qlf_k4n8,pp3" - -export FPGA_FAM=eos-s3 -export F4PGA_INSTALL_DIR="placeholder" -export F4PGA_SHARE_DIR=${INSTALL_DIR}/share/f4pga -export F4PGA_BIN_DIR=${INSTALL_DIR}/bin/ - -source $(dirname "$0")/setup-and-activate.sh - -echo "----------------------------------------" - -pushd build -make_target install "Installing quicklogic 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 - 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 - echo "----------------------------------------" - 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 - - for device in $(ls install/share/f4pga/arch) - do - # Prepare packages only for QL devices - tar -I "pixz" -cvf \ - symbiflow-arch-defs-install-ql-${GIT_HASH}.tar.xz \ - -C install share/f4pga/techmaps \ - share/f4pga/scripts \ - "$FPGA_FAM"_env - if [[ $device = ql* ]]; then - tar -I "pixz" -cvf symbiflow-arch-defs-$device-${GIT_HASH}.tar.xz -C install share/f4pga/arch/$device - fi - done - - rm -rf install -) -echo "----------------------------------------" diff --git a/.github/scripts/install_xc7.sh b/.github/scripts/install_xc7.sh deleted file mode 100755 index 44ceaa1310..0000000000 --- a/.github/scripts/install_xc7.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env bash - -INSTALL_DIR="$(pwd)/install" -mkdir -p $INSTALL_DIR - -export CMAKE_FLAGS="-GNinja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DINSTALL_FAMILIES=xc7" -source $(dirname "$0")/setup-and-activate.sh - -heading "Set environment variables for F4PGA CLI utils" -{ - export FPGA_FAM=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" -} - -echo "----------------------------------------" - -pushd build -make_target install "Running install tests (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 - ctest -R binary_toolchain_test_xc7* -j${MAX_CORES} - 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 - - 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 - rm -rf install -) -echo "----------------------------------------" diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index b85f20a3cd..6b502cc9b5 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -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 @@ -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