Skip to content

Commit

Permalink
ci: parallelize run jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
cfuguet authored Oct 29, 2024
1 parent a287173 commit 9df7e23
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 57 deletions.
114 changes: 114 additions & 0 deletions .github/actions/run_sequence/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
##
# Copyright 2023,2024 Cesar Fuguet
#
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
#
# Licensed under the Solderpad Hardware License v 2.1 (the “License”); you
# may not use this file except in compliance with the License, or, at your
# option, the Apache License version 2.0. You may obtain a copy of the
# License at
#
# https://solderpad.org/licenses/SHL-2.1/
#
# Unless required by applicable law or agreed to in writing, any work
# 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.
##
##
# Author : Cesar Fuguet
# Date : October, 2024
# Description: GitHub Action to run a given test sequence on the Verilator TB
##
name: 'Run sequence'
inputs:
seqname:
description: 'Name of the test sequence'
required: true
default: 'random'

ntrans:
description: 'Number of transactions in the sequence'
required: true
default: '5000'

ntests:
description: 'Number of separate tests'
required: true
default: '32'

runs:
using: "composite"
steps:
# Install Dependencies
- name: Install Dependencies
shell: bash
run: |
./.github/scripts/install_deps_ubuntu.sh
- name: Cache SystemC
id: cache-systemc
uses: actions/cache@v4
with:
path: build/systemc-3.0.1
fail-on-cache-miss: true
key: ${{ runner.os }}-build-systemc-${{ hashFiles('.github/scripts/install_systemc.sh') }}

- name: Cache Verilator
id: cache-verilator
uses: actions/cache@v4
with:
path: build/verilator-v5.028
fail-on-cache-miss: true
key: ${{ runner.os }}-build-verilator-${{ hashFiles('.github/scripts/install_verilator.sh') }}

# Verilate the HPDcache RTL sources and build the testbench
- name: Verilate the HPDcache RTL
id: verilate
shell: bash
run: |
. .github/scripts/env.sh
cd rtl/tb
make verilate
- name: Archive Verilate log
if: ${{ failure () && steps.verilate.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: verilate-${{ inputs.seqname }}_${{ inputs.ntrans }}_${{ inputs.ntests }}-log
path: rtl/tb/build/verilate.log

- name: Build SystemC testbench
id: build-tb
shell: bash
run: |
. .github/scripts/env.sh
cd rtl/tb
make build -j${PARALLEL_JOBS}
- name: Archive SystemC build log
if: ${{ failure () && steps.build-tb.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: build-${{ inputs.seqname }}_${{ inputs.ntrans }}_${{ inputs.ntests }}-log
path: rtl/tb/build/build.log

# Run the test sequence
- name: Run the random test sequence (short)
id: run-tb
shell: bash
run: |
. .github/scripts/env.sh
cd rtl/tb
make nonregression \
SEQUENCE=${{ inputs.seqname }} \
NTESTS=${{ inputs.ntests }} \
NTRANSACTIONS=${{ inputs.ntrans }}
- name: Archive nonregression logs
if: ${{ failure () && steps.run-tb.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: run-${{ inputs.seqname }}_${{ inputs.ntrans }}_${{ inputs.ntests }}-log
path: rtl/tb/logs
93 changes: 36 additions & 57 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,18 @@ on:
- 'LICENSE'

jobs:
build-and-run:
name: build-and-run
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master


# Install Dependencies
- name: Install Dependencies
shell: bash
run: |
./.github/scripts/install_deps_ubuntu.sh
# Install SystemC
- name: Cache SystemC
id: cache-systemc
Expand All @@ -66,7 +64,6 @@ jobs:
. .github/scripts/env.sh
./.github/scripts/install_systemc.sh
# Install Verilator
- name: Cache Verilator
id: cache-verilator
Expand All @@ -82,63 +79,45 @@ jobs:
./.github/scripts/install_verilator.sh
# Verilate the HPDcache RTL sources and build the testbench
- name: Verilate the HPDcache RTL
id: verilate
shell: bash
run: |
. .github/scripts/env.sh
cd rtl/tb
make verilate
# Run the tests
run_random_short:
runs-on: ubuntu-latest
name: run_random_short
needs: build
steps:
- uses: actions/checkout@master

- name: Archive Verilate log
if: ${{ failure () && steps.verilate.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
- id: run_random_short_sequence
uses: ./.github/actions/run_sequence
with:
name: verilate-log
path: rtl/tb/build/verilate.log
seqname: 'random'
ntrans: '5000'
ntests: '64'

- name: Build SystemC testbench
id: build-tb
shell: bash
run: |
. .github/scripts/env.sh
cd rtl/tb
make build -j${PARALLEL_JOBS}
run_random_long:
runs-on: ubuntu-latest
name: run_random_long
needs: build
steps:
- uses: actions/checkout@master

- name: Archive SystemC build log
if: ${{ failure () && steps.build-tb.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
- id: run_random_long_sequence
uses: ./.github/actions/run_sequence
with:
name: build-log
path: rtl/tb/build/build.log
seqname: 'random'
ntrans: '50000'
ntests: '16'

run_single_addr:
runs-on: ubuntu-latest
name: run_single_addr
needs: build
steps:
- uses: actions/checkout@master

# Run the tests
- name: Run the random test sequence (short)
shell: bash
run: |
. .github/scripts/env.sh
cd rtl/tb
make nonregression SEQUENCE=random NTESTS=128 NTRANSACTIONS=5000
- name: Run the random test sequence (long)
shell: bash
run: |
. .github/scripts/env.sh
cd rtl/tb
make nonregression SEQUENCE=random NTESTS=16 NTRANSACTIONS=100000
- name: Run the single addr test sequence
shell: bash
run: |
. .github/scripts/env.sh
cd rtl/tb
make nonregression SEQUENCE=single_addr NTESTS=64 NTRANSACTIONS=5000
- name: Archive nonregression logs
if: ${{ failure () }}
uses: actions/upload-artifact@v4
- id: run_single_addr_sequence
uses: ./.github/actions/run_sequence
with:
name: run-log
path: rtl/tb/logs
seqname: 'single_addr'
ntrans: '20000'
ntests: '16'

0 comments on commit 9df7e23

Please sign in to comment.