container: Merge run commands #2472
Workflow file for this run
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
# Copyright 2020 ETH Zurich and University of Bologna. | |
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | |
# SPDX-License-Identifier: Apache-2.0 | |
# Run functional regression checks | |
name: ci | |
on: [push, pull_request] | |
jobs: | |
########################## | |
# Build Docker Container # | |
########################## | |
build-docker: | |
name: Deploy Docker image | |
runs-on: ubuntu-22.04 | |
if: > | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.repository | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
docker-images: false | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: GHCR Log-in | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max` | |
file: util/container/Dockerfile | |
push: true | |
tags: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }} | |
######## | |
# Docs # | |
######## | |
docs: | |
name: Build documentation | |
runs-on: ubuntu-22.04 | |
needs: build-docker | |
if: > | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.repository | |
container: | |
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build docs | |
run: make docs | |
##################### | |
# Python unit tests # | |
##################### | |
pytest: | |
name: Python unit tests | |
runs-on: ubuntu-22.04 | |
needs: build-docker | |
if: > | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.repository | |
container: | |
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run pytest | |
run: pytest | |
############################################## | |
# Simulate SW on Snitch Cluster w/ Verilator # | |
############################################## | |
sw-snitch-cluster-vlt: | |
name: Simulate SW on Snitch Cluster w/ Verilator | |
runs-on: ubuntu-22.04 | |
needs: build-docker | |
if: > | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.repository | |
container: | |
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Get Verilator simulation binary hash | |
id: verilator-hash | |
working-directory: target/snitch_cluster | |
# yamllint disable rule:line-length | |
run: | | |
wget https://raw.githubusercontent.com/colluca/list-make-prerequisites/main/list-make-prerequisites.py | |
chmod +x list-make-prerequisites.py | |
./list-make-prerequisites.py bin/snitch_cluster.vlt --recursive --hash --debug | |
VLT_HASH=$(./list-make-prerequisites.py bin/snitch_cluster.vlt --recursive --hash 2>/dev/null) | |
echo "VLT_HASH=$VLT_HASH" >> $GITHUB_ENV | |
# yamllint enable rule:line-length | |
- name: Set up cache for Verilator build | |
id: verilator-cache | |
uses: actions/cache@v3 | |
with: | |
path: target/snitch_cluster/bin | |
key: verilator-${{ env.VLT_HASH }} | |
restore-keys: | | |
verilator- | |
- name: Build Hardware | |
if: steps.verilator-cache.outputs.cache-hit != 'true' | |
working-directory: target/snitch_cluster | |
run: | | |
make CFG_OVERRIDE=cfg/github-ci.hjson VLT_JOBS=1 bin/snitch_cluster.vlt | |
- name: Build Software | |
working-directory: target/snitch_cluster | |
run: | | |
make CFG_OVERRIDE=cfg/github-ci.hjson sw | |
- name: Run Tests | |
working-directory: target/snitch_cluster | |
run: | | |
./util/run.py sw/run.yaml --simulator verilator -j | |
./util/run.py sw/fdiv.yaml --simulator verilator -j | |
- name: Annotate traces | |
working-directory: target/snitch_cluster | |
run: | | |
make SIM_DIR=./runs/simple annotate -j | |
######################################### | |
# Build SW on Snitch Cluster w/ Banshee # | |
######################################### | |
sw-snitch-cluster-banshee: | |
name: Simulate SW on Snitch Cluster w/ Banshee | |
runs-on: ubuntu-22.04 | |
needs: build-docker | |
if: > | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.repository | |
container: | |
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Build Software | |
run: | | |
bender vendor init | |
make -C target/snitch_cluster SELECT_RUNTIME=banshee sw | |
- name: Run Tests | |
env: | |
SNITCH_LOG: info | |
working-directory: target/snitch_cluster | |
run: | | |
./util/run.py sw/run.yaml --simulator banshee -j |