Skip to content

Extend CI matrix

Extend CI matrix #43

Workflow file for this run

name: run-tests
on:
push:
pull_request:
env:
TOOL_VERSION: d70ea67d
jobs:
build-spike:
uses: ./.github/workflows/build-spike.yml
test-pyflow:
runs-on: ubuntu-latest
needs: [ build-spike, generate-code ]
strategy:
fail-fast: false
matrix:
test:
- riscv_arithmetic_basic_test
# - riscv_rand_instr_test
# - riscv_jump_stress_test
# - riscv_loop_test
# - riscv_rand_jump_test
# - riscv_mmu_stress_test
# - riscv_no_fence_test
# - riscv_illegal_instr_test
# - riscv_ebreak_test
# - riscv_ebreak_debug_mode_test
# - riscv_full_interrupt_test
# - riscv_unaligned_load_store_test
# - riscv_non_compressed_instr_test
# - riscv_hint_instr_test
# - riscv_pmp_test
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get -qqy update && sudo apt-get -qqy install gcc-riscv64-linux-gnu git build-essential device-tree-compiler
- name: Setup python
# python dependencies cannot be properly downloaded with new versions of python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install python dependencies
run: python3 -m pip install -r requirements.txt
- name: Setup Cache Metadata
id: cache_metadata
run: |
date=$(date +"%Y_%m_%d")
time=$(date +"%Y%m%d_%H%M%S_%N")
cache_spike_restore_key=cache_spike_
cache_spike_key=${cache_spike_restore_key}d70ea67d_${date}
cache_code=cache_${{ matrix.test }}
files_hash=$(sha256sum **/*.sv **/*.py **/*.yml **/*.d | cut -d\ -f1 | sha256sum | cut -d\ -f1)
echo "cache_spike_restore_key=$cache_spike_restore_key" | tee -a "$GITHUB_ENV"
echo "cache_spike_key=$cache_spike_key" | tee -a "$GITHUB_ENV"
echo "cache_code=${cache_code}_${files_hash}" | tee -a "$GITHUB_ENV"
- name: Restore Spike cache
id: cache-spike-restore
uses: actions/cache/restore@v3
with:
path: |
/opt/spike
/opt/spike/.cache
key: ${{ env.cache_spike_key }}
restore-keys: ${{ env.cache_spike_restore_key }}
- name: Set variables
run: |
echo "RISCV_GCC=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
echo "RISCV_OBJCOPY=riscv64-linux-gnu-objcopy" >> $GITHUB_ENV
echo "SPIKE_PATH=/opt/spike/bin" >> $GITHUB_ENV
echo "PYTHONPATH=pygen" >> $GITHUB_ENV
- name: Cache Code Restore
uses: actions/cache/restore@v3
id: cache-code-restore
timeout-minutes: 60
with:
path: test/asm_test
key: ${{ env.cache_code }}
- name: Patch Tests
run: find test/asm_test -name "*.S" -exec python3 .github/scripts/code_fixup.py -i {} -o {} \;
- name: Run tests
run: |
set -eo pipefail
python3 run.py --simulator pyflow \
--test ${{ matrix.test }} --iss spike --iss_timeout 60 \
--start_seed 999 --iterations 1 --batch_size 1 \
--isa rv32imc --mabi ilp32 --steps gcc_compile,iss_sim -v -o test 2>&1 | tee test/generate.log
generate-code:
runs-on: [ self-hosted, Linux, X64, gcp-custom-runners ]
container: centos:8
strategy:
fail-fast: false
matrix:
test:
- riscv_arithmetic_basic_test
# - riscv_rand_instr_test
# - riscv_jump_stress_test
# - riscv_loop_test
# - riscv_rand_jump_test
# - riscv_mmu_stress_test
# - riscv_no_fence_test
# - riscv_illegal_instr_test
# - riscv_ebreak_test
# - riscv_ebreak_debug_mode_test
# - riscv_full_interrupt_test
# - riscv_unaligned_load_store_test
# - riscv_non_compressed_instr_test
# - riscv_hint_instr_test
# - riscv_pmp_test
env:
GHA_EXTERNAL_DISK: additional-tools
steps:
- uses: actions/checkout@v3
- name: Setup Cache Metadata
id: cache_metadata
run: |
cache_code=cache_${{ matrix.test }}
files_hash=$(sha256sum **/*.sv **/*.py **/*.yml **/*.d | cut -d\ -f1 | sha256sum | cut -d\ -f1)
echo "cache_code=${cache_code}_${files_hash}" | tee -a "$GITHUB_ENV"
- name: Cache Code
uses: actions/cache@v3
id: cache-code
timeout-minutes: 60
with:
path: test/asm_test
key: ${{ env.cache_code }}
- name: Prepare Environment
if: steps.cache-code.outputs.cache-hit != 'true'
run: _secret_environment
- name: Setup Python 3.9
if: steps.cache-code.outputs.cache-hit != 'true'
run: |
yum update -y
yum install -y python39
python3.9 -m pip install -r requirements.txt
- name: Generate Tests
if: steps.cache-code.outputs.cache-hit != 'true'
run: _secret_riscv
env:
RISCV_TEST: ${{ matrix.test }}
# test-riscv:
# name: Test riscv
# runs-on: [ self-hosted, Linux, X64, gcp-custom-runners ]
# # needs: [build-spike]
# needs: [ generate-code ]
# container: centos:8
# strategy:
# fail-fast: false
# matrix:
# test:
# - riscv_arithmetic_basic_test
# # - riscv_rand_instr_test
# # - riscv_jump_stress_test
# # - riscv_loop_test
# # - riscv_rand_jump_test
# # - riscv_mmu_stress_test
# # - riscv_no_fence_test
# # - riscv_illegal_instr_test
# # - riscv_ebreak_test
# # - riscv_ebreak_debug_mode_test
# # - riscv_full_interrupt_test
# # - riscv_unaligned_load_store_test
# # - riscv_non_compressed_instr_test
# # - riscv_hint_instr_test
# # - riscv_pmp_test
# env:
# GHA_EXTERNAL_DISK: additional-tools
# steps:
# - uses: actions/checkout@v3
# - name: Prepare Environment
# run: _secret_environment
# - name: Setup Python 3.9
# run: |
# yum update -y
# yum install -y epel-release
# yum install -y python39 gcc-riscv64-linux-gnu
# python3.9 -m pip install -r requirements.txt
# - name: Setup Cache Metadata
# id: cache_metadata
# run: |
# date=$(date +"%Y_%m_%d")
# time=$(date +"%Y%m%d_%H%M%S_%N")
# cache_spike_restore_key=cache_spike_
# cache_spike_key=${cache_spike_restore_key}d70ea67d_${date}
# cache_code=cache_${{ matrix.test }}
# files_hash=$(sha256sum **/*.sv **/*.py **/*.yml **/*.d | cut -d\ -f1 | sha256sum | cut -d\ -f1)
# echo "cache_spike_restore_key=$cache_spike_restore_key" | tee -a "$GITHUB_ENV"
# echo "cache_spike_key=$cache_spike_key" | tee -a "$GITHUB_ENV"
# echo "cache_code=${cache_code}_${files_hash}" | tee -a "$GITHUB_ENV"
# - name: Restore Spike cache
# id: cache-spike-restore
# uses: actions/cache/restore@v3
# with:
# path: |
# /opt/spike
# /opt/spike/.cache
# key: ${{ env.cache_spike_key }}
# restore-keys: ${{ env.cache_spike_restore_key }}
# - name: Cache Code Restore
# uses: actions/cache/restore@v3
# id: cache-code-restore
# timeout-minutes: 60
# with:
# path: test/asm_test
# key: ${{ env.cache_code }}
# - name: Set Variables
# run: |
# echo "SPIKE_PATH=/opt/spike/bin" >> $GITHUB_ENV
# echo "RISCV_GCC=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
# echo "RISCV_OBJCOPY=riscv64-linux-gnu-objcopy" >> $GITHUB_ENV
# echo "RISCV_DV_ROOT=$PWD" >> $GITHUB_ENV
# - name: Patch Tests
# run: find test/asm_test -name "*.S" -exec python3.9 .github/scripts/code_fixup.py -i {} -o {} \;
# - name: Run tests
# run: |
# set -eo pipefail
# python3 run.py --simulator pyflow \
# --test ${{ matrix.test }} --iss spike --iss_timeout 60 \
# --start_seed 999 --iterations 1 --batch_size 1 \
# --isa rv32imc --mabi ilp32 --steps gcc_compile,iss_sim -v -o test 2>&1 | tee -a test/generate.log
# - name: Upload logs
# uses: actions/upload-artifact@v3
# if: always()
# with:
# path: |
# test/asm_test/*.log
# test/*.log