Wip: Proposition of spike integration in the ci / cd pipeline #639
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: [ "main", "ci" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
Miralis: | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: --deny warnings | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # We fetch the whole git tree to be able to run tests on previous commits | |
ref: ${{ github.event.pull_request.head.sha }} # Ignore automatic merge commit | |
- uses: extractions/setup-just@v2 # Install `just` | |
- name: Setup Toolchain SPIKE | |
run: | | |
git clone https://github.com/riscv-software-src/riscv-isa-sim | |
cd riscv-isa-sim | |
sudo apt-get install device-tree-compiler libboost-regex-dev libboost-system-dev | |
mkdir build | |
cd build | |
sudo ../configure --prefix=$RISCV | |
sudo make | |
sudo make install | |
sudo apt-get update -y && sudo apt-get install -y git gcc make g++ device-tree-compiler | |
sudo apt-get install -y build-essential gcc g++ libstdc++6 | |
sudo apt-get install libboost-all-dev | |
wget https://polybox.ethz.ch/index.php/s/1cSWNGSLoZ8LR7V/download | |
export PATH="$pwd:$PATH" | |
ls | |
mv download spike | |
chmod 777 spike | |
./spike | |
- name: Download QEMU & setup Spike | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-system-riscv64 | |
echo "" | |
echo "QEMU version:" | |
qemu-system-riscv64 --version | |
wget https://polybox.ethz.ch/index.php/s/1cSWNGSLoZ8LR7V/download | |
export PATH="$pwd:$PATH" | |
./spike | |
- name: Test | |
# Specify shell to enforce fail fast behavior, see: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | |
shell: bash | |
run: | | |
# First we check if there are merge commits in the PR | |
echo "Checking that history is linear..." | |
if [ ! -z "$(git rev-list --min-parents=2 HEAD)" ]; then | |
echo "There are merge commits! Please rebase the PR to remove them" | |
false | |
fi | |
# List the biggest git objects | |
echo "Biggest git objects:" | |
git ls-tree --format="%(objectsize:padded) %(path)" -r HEAD | sort --key 1 --reverse | head -n 5 | |
# And here we check that no object is too big | |
biggest="$(git ls-tree --format="%(objectsize:padded)" -r HEAD | sort --reverse | head -n 1)" | |
if [ $biggest -gt "200000" ]; then | |
echo "It seems a big object was committed. Please remove any executable or binary blob." | |
echo "Object size: $biggest bytes" | |
fi | |
# Finally we run the tests for all commits in the PR | |
revisions=$(git rev-list origin/main..HEAD) | |
for commit in $revisions; do | |
echo "" | |
echo "// ———————————————————————————————— Checkout ———————————————————————————————— //" | |
echo "// Commit: $commit //" | |
echo "// —————————————————————————————————————————————————————————————————————————— //" | |
echo "" | |
git checkout $commit | |
just test | |
done | |