Mockup self-hosted runners + Bugfix run-tests by init-submods

This commit is contained in:
abejgonzalez
2021-10-08 13:43:27 -07:00
committed by Ella Schwarz
parent 60ba6357a0
commit 797f85c8af
6 changed files with 48 additions and 127 deletions

View File

@@ -2,13 +2,6 @@ name: run-tests
description: 'Runs tests according to input parameters' description: 'Runs tests according to input parameters'
inputs: inputs:
<<<<<<< HEAD
=======
tools-version:
description: Which toolchain to build
required: false
default: 'riscv-tools'
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
group-key: group-key:
description: group key description: group key
required: true required: true
@@ -23,7 +16,6 @@ inputs:
runs: runs:
using: "composite" using: "composite"
steps: steps:
<<<<<<< HEAD
- name: Init submodules (since only the RTL is cached) - name: Init submodules (since only the RTL is cached)
run: ./scripts/init-submodules-no-riscv-tools.sh run: ./scripts/init-submodules-no-riscv-tools.sh
shell: bash shell: bash
@@ -37,13 +29,3 @@ runs:
- name: Run RTL tests - name: Run RTL tests
run: ./.github/scripts/${{ inputs.run-script }} ${{ inputs.project-key }} run: ./.github/scripts/${{ inputs.run-script }} ${{ inputs.project-key }}
shell: bash shell: bash
=======
- name: run rtl build script cache of chipyard root should have been loaded by prepare-rtl
run: |
export RISCV="/__w/chipyard/chipyard/riscv-tools-install"
export LD_LIBRARY_PATH="$RISCV/lib"
export PATH="$RISCV/bin:$PATH"
./.github/scripts/${{ inputs.run-script }} ${{ inputs.project-key }}
shell: bash
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions

View File

@@ -1,22 +1,5 @@
#!/bin/bash #!/bin/bash
copy () {
rsync -azp -e 'ssh' --exclude '.git' $1 $2
}
run () {
ssh -o "ServerAliveInterval=60" -o "StrictHostKeyChecking no" -t $SERVER $@
}
run_script () {
ssh -o "ServerAliveInterval=60" -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 "$2"
}
clean () {
# remove remote work dir
run "rm -rf $REMOTE_WORK_DIR"
}
# make parallelism # make parallelism
CI_MAKE_NPROC=4 CI_MAKE_NPROC=4
# chosen based on a 24c system shared with 1 other project # chosen based on a 24c system shared with 1 other project
@@ -33,10 +16,10 @@ CURRENT_BRANCH=$(git branch --show-current)
HOME=`pwd` HOME=`pwd`
REMOTE_PREFIX=$CI_DIR/${GITHUB_REPOSITORY#*/}-$CURRENT_BRANCH REMOTE_PREFIX=$CI_DIR/${GITHUB_REPOSITORY#*/}-$CURRENT_BRANCH
REMOTE_WORK_DIR=$REMOTE_PREFIX-$GITHUB_SHA-$GITHUB_JOB REMOTE_WORK_DIR=$GITHUB_WORKSPACE
REMOTE_RISCV_DIR=$REMOTE_WORK_DIR/riscv-tools-install REMOTE_RISCV_DIR=$GITHUB_WORKSPACE/riscv-tools-install
REMOTE_ESP_DIR=$REMOTE_WORK_DIR/esp-tools-install REMOTE_ESP_DIR=$GITHUB_WORKSPACE/esp-tools-install
REMOTE_CHIPYARD_DIR=$REMOTE_WORK_DIR/chipyard REMOTE_CHIPYARD_DIR=$GITHUB_WORKSPACE
REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verilator REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verilator
REMOTE_FIRESIM_DIR=$REMOTE_CHIPYARD_DIR/sims/firesim/sim REMOTE_FIRESIM_DIR=$REMOTE_CHIPYARD_DIR/sims/firesim/sim
REMOTE_FPGA_DIR=$REMOTE_CHIPYARD_DIR/fpga REMOTE_FPGA_DIR=$REMOTE_CHIPYARD_DIR/fpga

View File

@@ -17,45 +17,22 @@ source $SCRIPT_DIR/defaults.sh
# call clean on exit # call clean on exit
trap clean EXIT trap clean EXIT
cd $LOCAL_CHIPYARD_DIR cd $REMOTE_CHIPYARD_DIR
./scripts/init-submodules-no-riscv-tools.sh ./scripts/init-submodules-no-riscv-tools.sh
./scripts/init-fpga.sh ./scripts/init-fpga.sh
# replace the workspace dir with a local dir so you can copy around
sed -i -E 's/(workspace=).*(\/tools)/\1$PWD\2/g' .sbtopts
# set stricthostkeychecking to no (must happen before rsync)
run "echo \"Ping $SERVER\""
clean
# copy over riscv/esp-tools, and chipyard to remote
run "mkdir -p $REMOTE_CHIPYARD_DIR"
copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR
run "cp -r ~/.ivy2 $REMOTE_WORK_DIR"
run "cp -r ~/.sbt $REMOTE_WORK_DIR"
TOOLS_DIR=$REMOTE_RISCV_DIR TOOLS_DIR=$REMOTE_RISCV_DIR
LD_LIB_DIR=$REMOTE_RISCV_DIR/lib LD_LIB_DIR=$REMOTE_RISCV_DIR/lib
if [ $1 = "group-accels" ]; then if [ $1 = "group-accels" ]; then
export RISCV=$LOCAL_ESP_DIR export RISCV=$REMOTE_ESP_DIR
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib export LD_LIBRARY_PATH=$REMOTE_ESP_DIR/lib
export PATH=$RISCV/bin:$PATH export PATH=$RISCV/bin:$PATH
GEMMINI_SOFTWARE_DIR=$LOCAL_SIM_DIR/../../generators/gemmini/software/gemmini-rocc-tests GEMMINI_SOFTWARE_DIR=$REMOTE_CHIPYARD_DIR/generators/gemmini/software/gemmini-rocc-tests
cd $LOCAL_SIM_DIR/../../generators/gemmini/software cd $GEMMINI_SOFTWARE_DIR
git submodule update --init --recursive gemmini-rocc-tests git submodule update --init --recursive gemmini-rocc-tests
cd gemmini-rocc-tests cd gemmini-rocc-tests
./build.sh ./build.sh
TOOLS_DIR=$REMOTE_ESP_DIR
LD_LIB_DIR=$REMOTE_ESP_DIR/lib
run "mkdir -p $REMOTE_ESP_DIR"
copy $LOCAL_ESP_DIR/ $SERVER:$REMOTE_ESP_DIR
else
run "mkdir -p $REMOTE_RISCV_DIR"
copy $LOCAL_RISCV_DIR/ $SERVER:$REMOTE_RISCV_DIR
fi fi
# choose what make dir to use # choose what make dir to use
@@ -70,27 +47,20 @@ case $2 in
esac esac
# enter the verilator directory and build the specific config on remote server # enter the verilator directory and build the specific config on remote server
run "export RISCV=\"$TOOLS_DIR\"; \ export RISCV=$TOOLS_DIR
make -C $REMOTE_MAKE_DIR clean;" make -C $REMOTE_MAKE_DIR clean
read -a keys <<< ${grouping[$1]} read -a keys <<< ${grouping[$1]}
# need to set the PATH to use the new verilator (with the new verilator root) # need to set the PATH to use the new verilator (with the new verilator root)
for key in "${keys[@]}" for key in "${keys[@]}"
do do
run "export RISCV=\"$TOOLS_DIR\"; \ export RISCV=$TOOLS_DIR
export LD_LIBRARY_PATH=\"$LD_LIB_DIR\"; \ export LD_LIBRARY_PATH=$LD_LIB_DIR
export PATH=\"$REMOTE_VERILATOR_DIR/bin:\$PATH\"; \ export PATH=$REMOTE_VERILATOR_DIR/bin:$PATH
export VERILATOR_ROOT=\"$REMOTE_VERILATOR_DIR\"; \ export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR
export COURSIER_CACHE=\"$REMOTE_WORK_DIR/.coursier-cache\"; \ export COURSIER_CACHE=$REMOTE_WORK_DIR/.coursier-cache
make -j$REMOTE_MAKE_NPROC -C $REMOTE_MAKE_DIR FIRRTL_LOGLEVEL=info JAVA_TOOL_OPTIONS=\"$REMOTE_JAVA_OPTS\" SBT_OPTS=\"$REMOTE_SBT_OPTS\" ${mapping[$key]}" make -j$REMOTE_MAKE_NPROC -C $REMOTE_MAKE_DIR FIRRTL_LOGLEVEL=info JAVA_OPTS=$REMOTE_JAVA_OPTS SBT_OPTS=$REMOTE_SBT_OPTS ${mapping[$key]}
done done
run "rm -rf $REMOTE_CHIPYARD_DIR/project" rm -rf $REMOTE_CHIPYARD_DIR/project
# choose to copy back results
if [ $2 = "sim" ]; then
# copy back the final build
mkdir -p $LOCAL_CHIPYARD_DIR
copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR
fi

View File

@@ -10,16 +10,14 @@ SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh source $SCRIPT_DIR/defaults.sh
# clean older directories (delete prior directories related to this branch also) # clean older directories (delete prior directories related to this branch also)
run_script $LOCAL_CHIPYARD_DIR/.github/scripts/clean-old-files.sh $CI_DIR
run "rm -rf $REMOTE_PREFIX*"
# set stricthostkeychecking to no (must happen before rsync) $SCRIPT_DIR/clean-old-files.sh $CI_DIR
run "echo \"Ping $SERVER\"" rm -rf $REMOTE_PREFIX*
run "git clone http://git.veripool.org/git/verilator $REMOTE_VERILATOR_DIR; \ git clone http://git.veripool.org/git/verilator $REMOTE_VERILATOR_DIR
cd $REMOTE_VERILATOR_DIR; \ cd $REMOTE_VERILATOR_DIR
git checkout $VERILATOR_VERSION; \ git checkout $VERILATOR_VERSION
autoconf; \ autoconf
export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR; \ export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR
./configure; \ ./configure
make -j$REMOTE_MAKE_NPROC;" make -j$REMOTE_MAKE_NPROC

View File

@@ -13,50 +13,36 @@ source $SCRIPT_DIR/defaults.sh
# call clean on exit # call clean on exit
trap clean EXIT trap clean EXIT
export RISCV="$REMOTE_RISCV_DIR"
export LD_LIBRARY_PATH="$RISCV/lib"
export PATH="$RISCV/bin:$PATH"
# Directory locations for handling firesim-local installations of libelf/libdwarf # Directory locations for handling firesim-local installations of libelf/libdwarf
# This would generally be handled by build-setup.sh/firesim-setup.sh # This would generally be handled by build-setup.sh/firesim-setup.sh
firesim_sysroot=lib-install firesim_sysroot=lib-install
local_firesim_sysroot=$LOCAL_FIRESIM_DIR/$firesim_sysroot
remote_firesim_sysroot=$REMOTE_FIRESIM_DIR/$firesim_sysroot remote_firesim_sysroot=$REMOTE_FIRESIM_DIR/$firesim_sysroot
cd $LOCAL_CHIPYARD_DIR cd $REMOTE_CHIPYARD_DIR
./scripts/init-submodules-no-riscv-tools.sh ./scripts/init-submodules-no-riscv-tools.sh
cd $LOCAL_CHIPYARD_DIR/sims/firesim/sim/firesim-lib/src/main/cc/lib cd $REMOTE_CHIPYARD_DIR/sims/firesim/sim/firesim-lib/src/main/cc/lib
git submodule update --init elfutils libdwarf git submodule update --init elfutils libdwarf
cd $LOCAL_CHIPYARD_DIR/sims/firesim cd $REMOTE_CHIPYARD_DIR/sims/firesim
mkdir -p $local_firesim_sysroot mkdir -p $remote_firesim_sysroot
./scripts/build-libelf.sh $local_firesim_sysroot ./scripts/build-libelf.sh $remote_firesim_sysroot
./scripts/build-libdwarf.sh $local_firesim_sysroot ./scripts/build-libdwarf.sh $remote_firesim_sysroot
cd $LOCAL_CHIPYARD_DIR cd $REMOTE_CHIPYARD_DIR
# replace the workspace dir with a local dir so you can copy around make -C $REMOTE_CHIPYARD_DIR/tools/dromajo/dromajo-src/src
sed -i -E 's/(workspace=).*(\/tools)/\1$PWD\2/g' .sbtopts
make -C $LOCAL_CHIPYARD_DIR/tools/dromajo/dromajo-src/src
# set stricthostkeychecking to no (must happen before rsync)
run "echo \"Ping $SERVER\""
clean
# copy over riscv/esp-tools, and chipyard to remote
run "mkdir -p $REMOTE_CHIPYARD_DIR"
run "mkdir -p $REMOTE_RISCV_DIR"
copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR
copy $LOCAL_RISCV_DIR/ $SERVER:$REMOTE_RISCV_DIR
run "cp -r ~/.ivy2 $REMOTE_WORK_DIR"
run "cp -r ~/.sbt $REMOTE_WORK_DIR"
TOOLS_DIR=$REMOTE_RISCV_DIR TOOLS_DIR=$REMOTE_RISCV_DIR
LD_LIB_DIR=$remote_firesim_sysroot/lib:$REMOTE_RISCV_DIR/lib LD_LIB_DIR=$remote_firesim_sysroot/lib:$REMOTE_RISCV_DIR/lib
# Run Firesim Scala Tests # Run Firesim Scala Tests
run "export RISCV=\"$TOOLS_DIR\"; \ export RISCV=$TOOLS_DIR
export LD_LIBRARY_PATH=\"$LD_LIB_DIR\"; \ export LD_LIBRARY_PATH=$LD_LIB_DIR
export FIRESIM_ENV_SOURCED=1; \ export FIRESIM_ENV_SOURCED=1;
export PATH=\"$REMOTE_VERILATOR_DIR/bin:\$PATH\"; \ export PATH=$REMOTE_VERILATOR_DIR/bin:$PATH
export VERILATOR_ROOT=\"$REMOTE_VERILATOR_DIR\"; \ export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR
export COURSIER_CACHE=\"$REMOTE_WORK_DIR/.coursier-cache\"; \ export COURSIER_CACHE=$REMOTE_WORK_DIR/.coursier-cache
make -C $REMOTE_FIRESIM_DIR JAVA_TOOL_OPTIONS=\"$REMOTE_JAVA_OPTS\" SBT_OPTS=\"$REMOTE_SBT_OPTS\" testOnly ${mapping[$1]}" make -C $REMOTE_FIRESIM_DIR JAVA_OPTS=$REMOTE_JAVA_OPTS SBT_OPTS=$REMOTE_SBT_OPTS testOnly ${mapping[$1]}

View File

@@ -20,6 +20,7 @@ jobs:
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
<<<<<<< HEAD
commit-on-master-check: commit-on-master-check:
name: commit-on-master-check name: commit-on-master-check
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -137,6 +138,7 @@ jobs:
run: .github/scripts/remote-install-verilator.sh run: .github/scripts/remote-install-verilator.sh
- uses: ./.github/actions/job-end - uses: ./.github/actions/job-end
<<<<<<< HEAD
# Sentinel job to simplify how we specify which that basic setup is complete # Sentinel job to simplify how we specify which that basic setup is complete
# #
# When adding new prep jobs, please add them to `needs` below # When adding new prep jobs, please add them to `needs` below