From ab114e74ffd3cd40de577ed4039e7cda07591b81 Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Wed, 26 Jul 2023 03:44:44 +0200 Subject: [PATCH] ci: use f4pga container instead of installing in each run Signed-off-by: Unai Martinez-Corral --- .github/scripts/activate.sh | 25 --------- .github/scripts/prepare_environment.sh | 73 -------------------------- .github/workflows/pipeline.yml | 20 +++---- examples/pwm/Makefile | 4 +- 4 files changed, 12 insertions(+), 110 deletions(-) delete mode 100755 .github/scripts/activate.sh delete mode 100755 .github/scripts/prepare_environment.sh diff --git a/.github/scripts/activate.sh b/.github/scripts/activate.sh deleted file mode 100755 index 2be0c05b..00000000 --- a/.github/scripts/activate.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 - -# Copyright (C) 2022 Antmicro -# SPDX-License-Identifier: Apache-2.0 - - -source "${F4PGA_INSTALL_DIR}/${FPGA_FAM}/conda/etc/profile.d/conda.sh" -conda activate $FPGA_FAM -export F4PGA_SHARE_DIR=${F4PGA_INSTALL_DIR_FAM}/share/f4pga diff --git a/.github/scripts/prepare_environment.sh b/.github/scripts/prepare_environment.sh deleted file mode 100755 index b87cd86f..00000000 --- a/.github/scripts/prepare_environment.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/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 - -# Copyright (C) 2022 Antmicro -# SPDX-License-Identifier: Apache-2.0 - -set -e - -echo '::group::Environment variables' - -echo "FPGA_FAM: $FPGA_FAM" -echo "F4PGA_INSTALL_DIR: $F4PGA_INSTALL_DIR" -echo "F4PGA_INSTALL_DIR_FAM: $F4PGA_INSTALL_DIR_FAM" - -echo '::endgroup::' - - -echo '::group::Install Miniconda3' - -wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O conda_installer.sh - -bash conda_installer.sh -u -b -p "${F4PGA_INSTALL_DIR_FAM}"/conda -rm conda_installer.sh -source "${F4PGA_INSTALL_DIR_FAM}"/conda/etc/profile.d/conda.sh - -echo '::endgroup::' - - -echo '::group::Install arch-defs' - -mkdir -p "$F4PGA_INSTALL_DIR_FAM" - -F4PGA_TIMESTAMP='20220907-210059' -F4PGA_HASH='66a976d' - -case "$FPGA_FAM" in - xc7) PACKAGES='install-xc7 xc7z010_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 -done - -rm -vrf $F4PGA_INSTALL_DIR_FAM/share/f4pga/scripts - -echo '::endgroup::' - - -echo '::group::Create environment' - -conda env create -f $F4PGA_INSTALL_DIR_FAM/"$FPGA_FAM"_env/"$FPGA_FAM"_environment.yml - -echo '::endgroup::' diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index bbe2225e..e136f135 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -51,17 +51,17 @@ jobs: - name: Build example PWM setup run: | - export FPGA_FAM="xc7" - export F4PGA_INSTALL_DIR="${HOME}/opt/f4pga" - export F4PGA_INSTALL_DIR_FAM="${F4PGA_INSTALL_DIR}/${FPGA_FAM}" - ./.github/scripts/prepare_environment.sh - source .github/scripts/activate.sh - pip3 install https://github.com/chipsalliance/f4pga/archive/main.zip#subdirectory=f4pga - cd examples/pwm - tuttest README.md build | bash - - cd - - cp examples/pwm/build/project_1_0/zynq-symbiflow/project_top.bit ./top.bit + make generate copy_sources + + docker run --rm -i -v $(pwd):/wrk -w /wrk \ + gcr.io/hdl-containers/conda/f4pga/xc7/z010 \ + bash -le <<'EOF' + pip3 install edalize==0.4.0 fusesoc==1.12.0 + make zvb + EOF + + cp build/project_1_0/zynq-symbiflow/project_top.bit ../../top.bit - name: Store bit uses: actions/upload-artifact@v3 diff --git a/examples/pwm/Makefile b/examples/pwm/Makefile index 5bb39b8a..2b39d5a3 100644 --- a/examples/pwm/Makefile +++ b/examples/pwm/Makefile @@ -1,6 +1,6 @@ # Copyright (C) 2021 Antmicro # SPDX-License-Identifier: Apache-2.0 -all: zvb +all: generate copy_sources zvb build: mkdir build @@ -15,7 +15,7 @@ copy_sources: build cp -rf sources/ build/ cp -rf ipcores/* build/ -zvb: generate copy_sources +zvb: fusesoc --cores-root build run --tool=symbiflow --build --target zynq project_1 zvb_vivado: generate copy_sources