Skip to content

Commit

Permalink
Add regression CI (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordancarlin authored Oct 31, 2024
1 parent 1b2d006 commit 7c0d57b
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/regression-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
##################################
# install.yml
# [email protected] October 2024
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
#
# GitHub Action to create and cache the tools needed for regression for Wally.
##################################

name: Cache Regression Tools

# Run on PR that modifies the installation scripts, weekly, or manually
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # Run at 12:00 AM UTC on Sundays

# Use bash shell with extra GitHub Actions options for all jobs
defaults:
run:
shell: bash

jobs:
regression_tools:
name: Cache Regression Tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clone Necessary Submodules
run: |
git config --global --add safe.directory '*'
git submodule update --init addins/riscv-arch-test addins/verilog-ethernet
- name: free up storage
run: ./.github/cli-space-cleanup.sh
- name: Install
run: |
sudo ./bin/wally-tool-chain-install.sh --clean
source setup.sh
cd $RISCV
sudo rm -rf buildroot cad logs
cd ..
tar cJvf ${{ github.workspace }}/riscv.xz riscv
# Set cache keys based on date
- name: Get Date
id: get-date
run: echo "date=$(/bin/date -u "+%Y-%U")" >> $GITHUB_OUTPUT
- name: Cache tools
uses: actions/cache@v2
with:
key: riscv-${{ steps.get-date.outputs.date }}
path: riscv.xz
113 changes: 113 additions & 0 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
##################################
# regression.yml
# [email protected] October 2024
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
#
# GitHub Action to run regression on changes to CVW.
##################################

name: Regression Test

on:
workflow_dispatch:
# push:
# branches:
# - main
# pull_request:
# branches:
# - main

jobs:
regression:
runs-on: ubuntu-latest

steps:
# Checkout repo
- uses: actions/checkout@v4
- name: Clone Necessary Submodules
run: |
git config --global --add safe.directory '*'
git submodule update --init addins/riscv-arch-test addins/verilog-ethernet
# Use cached tools from the past week
- name: Get Date
id: get-date
run: echo "date=$(/bin/date -u "+%Y-%U")" >> $GITHUB_OUTPUT
- name: Restore cached tools
id: restore-tools
uses: actions/cache/restore@v4
with:
path: /opt
key: riscv-${{ steps.get-date.outputs.date }}
fail-on-cache-miss: true
- name: Extract tools
if: steps.restore-tools.outputs.cache-hit == 'true'
run: |
cd /opt
tar xJf riscv.xz
rm -f riscv.xz
# Use prebuilt tests if tests have not changed, otherwise build tests
- name: Check test hash
run: |
TEST_HASH=${{ hashFiles('tests')}}_${{ hashFiles('addins/riscv-arch-test')}}
echo "TEST_HASH=$TEST_HASH" >> "$GITHUB_ENV"
- name: Restore cached tests if match
id: restore-tests
uses: actions/cache/restore@v4
with:
path: "${{ github.workspace }}/tests.xz"
key: tests-${{ env.TEST_HASH }}
- name: Extract tests
if: steps.restore-tests.outputs.cache-hit == 'true'
run: |
rm -rf tests
tar xJf tests.xz
rm -f tests.xz
- name: Make tests
if: steps.restore-tests.outputs.cache-hit != 'true'
run: |
source setup.sh
cd tests && make riscof --jobs $(nproc --ignore 1)
cd riscof && rm -rf sail_cSim spike
cd work
find . -name \dut -type d -exec rm -r {} +
find . -name \*.log -type f -delete
find . -name \*.objdump -type f -delete
cd ../..
tar cJvf tests.xz tests
- name: Save cached tests
if: steps.restore-tests.outputs.cache-hit != 'true'
id: save-tests
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/tests.xz
key: ${{ steps.restore-tests.outputs.cache-primary-key }}

# # Use cached verilator from the past week
# - name: Restore cached verilator
# uses: actions/cache/restore@v4
# with:
# path: /opt/riscv
# key: verilator-${{ steps.get-date.outputs.date }}
# fail-on-cache-miss: true

# # Restore linux testvectors
# - name: Restore cached linux testvectors
# uses: actions/cache/restore@v4
# with:
# path: /opt/riscv/linux-testvectors
# key: linux-${{ steps.get-date.outputs.date }}
# fail-on-cache-miss: true

# Run regression
- name: Run regression
run: |
source setup.sh
regression-wally
- name: Upload regression logs
uses: actions/upload-artifact@v4
if: always()
with:
name: regression-logs
path: ${{ github.workspace }}/sim/verilator/logs/
7 changes: 5 additions & 2 deletions tests/riscof/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ wally_workdir := $(work)/wally-riscv-arch-test
current_dir := $(shell pwd)

# General make rules
.PHONY: all riscv-arch-test wally-riscv-arch-test quad64 clean
all: riscv-arch-test wally-riscv-arch-test
.PHONY: all riscv-arch-test wally-riscv-arch-test quad64 finish clean
all: riscv-arch-test wally-riscv-arch-test finish
riscv-arch-test: arch32e arch32 arch64
wally-riscv-arch-test: wally32 wally64

Expand All @@ -38,6 +38,9 @@ quad64: config64.ini $(wally_dir)/riscv-test-suite/rv64i_m/Q/riscv-ctg/tests | $
riscof run --work-dir=$(work_dir)/$@ --config=$< --suite=$(wally_dir)/riscv-test-suite/rv64i_m/Q/riscv-ctg/tests/ --env=$(wally_dir)/riscv-test-suite/env
$(MAKE) -f makefile-memfile WORKDIR=$(work_dir)/$@

finish:
rm -rf $(work_dir)

clean:
rm -f config??*.ini
rm -rf $(work_dir)
Expand Down

0 comments on commit 7c0d57b

Please sign in to comment.