Skip to content

Commit

Permalink
workflows: build and run CI for CoupledL2 scenario (#8)
Browse files Browse the repository at this point in the history
* workflows: added surrounding build CI

* scripts: wrapped runner for verilator executable

* Bump CoupledL2

* README: update README with CI badge
  • Loading branch information
Kumonda221-CrO3 authored May 30, 2024
1 parent 798d1fe commit 4992c86
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 4 deletions.
201 changes: 201 additions & 0 deletions .github/workflows/scenario-CoupledL2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
name: scenario-CoupledL2

on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'

env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}
INSTALL_DIR: ${{ github.workspace }}/install

defaults:
run:
shell: bash
working-directory: repo

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_reqeust' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:

prebuild-ootb-coupledL2:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
name: Pre-Build | OOTB CoupledL2
env:
COUPLEDL2_ARCHIVE: coupledL2-${{ github.sha }}.tar.gz

steps:

- name: Checkout
uses: actions/checkout@v4
with:
path: repo
submodules: recursive

- name: Setup Scala
uses: olafurpg/setup-scala@v10

- name: Setup Mill
run: |
sh -c "curl -L https://github.com/com-lihaoyi/mill/releases/download/0.11.1/0.11.1 > /usr/local/bin/mill && chmod +x /usr/local/bin/mill"
- name: Compile
run: |
make coupledL2-compile
- name: Build verilog
run: |
make coupledL2-verilog-test-top-l2l3l2
- name: Tar up repository
working-directory: ${{ github.workspace }}
run: tar -zcf ${{ env.COUPLEDL2_ARCHIVE }} repo/dut/CoupledL2/build

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}/${{ env.COUPLEDL2_ARCHIVE }}
name: ${{ env.COUPLEDL2_ARCHIVE }}

build:
needs: prebuild-ootb-coupledL2
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-22.04, compiler: { cc: clang-16, cxx: clang++-16 } }
- { os: ubuntu-22.04, compiler: { cc: gcc, cxx: g++ } }
- { os: ubuntu-20.04, compiler: { cc: clang-16, cxx: clang++-16 } }
runs-on: ${{ matrix.os }}
name: Build | ${{ matrix.os }} | ${{ matrix.compiler.cc }}
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ${{ matrix.os }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
COUPLEDL2_ARCHIVE: coupledL2-${{ github.sha }}.tar.gz
TLTEST_ARCHIVE: tl-test-new-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
steps:

- name: Checkout
uses: actions/checkout@v4
with:
path: repo

- name: Setup Clang 16
if: matrix.compiler.cc == 'clang-16'
working-directory: ${{ github.workspace }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 16
- name: Setup Verilator
working-directory: ${{ github.workspace }}
run: |
sudo apt-get install -y git help2man perl python3 make autoconf g++ flex bison clang
sudo apt-get install -y libfl2 # Ubuntu only (ignore if gives error)
sudo apt-get install -y libfl-dev # Ubuntu only (ignore if gives error)
sudo apt-get install -y zlib1g zlib1g-dev # Ubuntu only (ignore if gives error)
git clone https://github.com/verilator/verilator
unset VERILATOR_ROOT
cd verilator
git checkout v5.020
autoconf
./configure CC=${{ matrix.compiler.cc }} CXX=${{ matrix.compiler.cxx }} LINK=${{ matrix.compiler.cxx }}
make -j4
sudo make install
verilator --version
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.COUPLEDL2_ARCHIVE }}
path: ${{ github.workspace }}

- name: Unpack artifact
working-directory: ${{ github.workspace }}
run: tar -zxf ${{ env.COUPLEDL2_ARCHIVE }}

- name: Verilate CoupledL2
run: |
make THREADS_BUILD=4 coupledL2-verilate
- name: Configurate TL-Test-New for CoupledL2
run: |
make THREADS_BUILD=4 tltest-config-coupledL2-test-l2l3l2
- name: Build TL-Test-New for CoupledL2
run: |
make THREADS_BUILD=4 tltest-build-all
- name: Tar up repository
working-directory: ${{ github.workspace }}
run: tar -zcf ${{ env.TLTEST_ARCHIVE }} repo/main/build repo/configs repo/scripts repo/Makefile

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}/${{ env.TLTEST_ARCHIVE }}
name: ${{ env.TLTEST_ARCHIVE }}

run:
needs: build
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-22.04, compiler: { cc: clang-16, cxx: clang++-16 } }
- { os: ubuntu-22.04, compiler: { cc: gcc, cxx: g++ } }
- { os: ubuntu-20.04, compiler: { cc: clang-16, cxx: clang++-16 } }
runs-on: ${{ matrix.os }}
name: Run | ${{ matrix.os }} | ${{ matrix.compiler.cc }}
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ${{ matrix.os }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
TLTEST_ARCHIVE: tl-test-new-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
RUN_ARCHIVE: tl-test-new-run-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
steps:

- name: Setup Clang 16
if: matrix.compiler.cc == 'clang-16'
working-directory: ${{ github.workspace }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 16
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.TLTEST_ARCHIVE }}
path: ${{ github.workspace }}

- name: Unpack artifact
working-directory: ${{ github.workspace }}
run: tar -zxf ${{ env.TLTEST_ARCHIVE }}

- name: Run TL-Test-New for CoupledL2
run: |
make run
# - name: Tar up repository
# working-directory: ${{ github.workspace }}
# run: tar -zcf ${{ env.RUN_ARCHIVE }} repo

# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# path: ${{ github.workspace }}/${{ env.RUN_ARCHIVE }}
# name: ${{ env.RUN_ARCHIVE }}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ run: FORCE tltest-config-postbuild
@cp ./main/build/tltest_v3lt ./run/
@cp ./main/build/tltest_portgen.so ./run/
@cp ./main/build/tltest.ini ./run/
@cd ./run && ./tltest_v3lt 2>&1 | tee tltest_v3lt.log
@bash ./scripts/run_v3lt.sh

run-with-portgen: FORCE tltest-config-postbuild tltest-portgen
@rm -rf ./run
@mkdir ./run
@cp ./main/build/tltest_v3lt ./run/
@cp ./main/build/tltest_portgen.so ./run/
@cp ./main/build/tltest.ini ./run/
@cd ./run && ./tltest_v3lt 2>&1 | tee tltest_v3lt.log
@bash ./scripts/run_v3lt.sh


clean: coupledL2-verilate-clean coupledL2-verilog-clean tltest-clean
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# TL-Test-New

[![scenario-CoupledL2](https://github.com/OpenXiangShan/tl-test-new/actions/workflows/scenario-CoupledL2.yml/badge.svg?branch=master)](https://github.com/OpenXiangShan/tl-test-new/actions/workflows/scenario-CoupledL2.yml)

> TL-Test-New
> The **Unified TileLink Memory Subsystem Tester for XiangShan**
>
Expand All @@ -15,7 +17,6 @@
> ██║ ███████╗ ██║ ███████╗███████║ ██║ ██║ ╚████║███████╗╚███╔███╔╝
> ╚═╝ ╚══════╝ ╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═══╝╚══════╝ ╚══╝╚══╝
> ```
>  
Expand Down
9 changes: 9 additions & 0 deletions scripts/run_v3lt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
cd ./run && ./tltest_v3lt 2>&1 | tee tltest_v3lt.log
exit ${PIPESTATUS[0]}

# NOTICE:
# * Wrap executable with piped tee to save log.
# * Keep the logging procedure simple for now, sophisticated implementation
# might be available in future.
#

0 comments on commit 4992c86

Please sign in to comment.