Update toolchain #9
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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
- 'feature/**' | |
pull_request: | |
branches: | |
- master | |
- 'feature/**' | |
workflow_dispatch: | |
jobs: | |
build-core: | |
name: Synthesize full core | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Coreblocks dependencies | |
run: | | |
python3 -m venv venv | |
. venv/bin/activate | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -r requirements.txt | |
- name: Generate Verilog | |
run: | | |
. venv/bin/activate | |
PYTHONHASHSEED=0 TRANSACTRON_VERBOSE=1 ./scripts/gen_verilog.py --verbose --config full | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "verilog-full-core" | |
path: | | |
core.v | |
core.v.json | |
build-riscof-tests: | |
name: Build regression tests (riscv-arch-test) | |
runs-on: ubuntu-latest | |
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2024.12.07 | |
timeout-minutes: 10 | |
env: | |
PYENV_ROOT: "/root/.pyenv" | |
LC_ALL: "C.UTF8" | |
LANG: "C.UTF8" | |
defaults: | |
run: | |
working-directory: test/external/riscof/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get submodules HEAD hash | |
working-directory: . | |
run: | | |
# ownership workaround | |
git config --global --add safe.directory /__w/coreblocks/coreblocks | |
# paths in command are relative! | |
git submodule > .gitmodules-hash | |
- name: Cache compiled and reference riscv-arch-test | |
id: cache-riscv-arch-test | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-riscv-arch-test | |
with: | |
path: | | |
test/external/riscof/riscv-arch-test/**/*.elf | |
test/external/riscof/riscof_work/**/*.signature | |
test/external/riscof/**/*Makefile* | |
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles( | |
'**/test/external/riscof/coreblocks/**', | |
'**/test/external/riscof/spike_simple/**', | |
'**/test/external/riscof/config.ini', | |
'**/.gitmodules-hash', | |
'**/docker/riscv-toolchain.Dockerfile', | |
'**/.github/workflows/main.yml' | |
) }} | |
lookup-only: true | |
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }} | |
name: Checkout with submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }} | |
name: Setup PATH | |
run: echo "/.pyenv/bin" >> $GITHUB_PATH | |
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }} | |
name: Setup pyenv python | |
run: | | |
eval "$(pyenv init --path)" | |
pyenv global 3.6.15 | |
. /venv3.6/bin/activate | |
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }} | |
name: Setup arch test suite | |
run: | | |
. /venv3.6/bin/activate | |
riscof testlist --config=config.ini --suite=riscv-arch-test/riscv-test-suite/ --env=riscv-arch-test/riscv-test-suite/env | |
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }} | |
name: Build and run tests on reference and generate Makefiles | |
run: | | |
. /venv3.6/bin/activate | |
riscof run --config=config.ini --suite=riscv-arch-test/riscv-test-suite/ --env=riscv-arch-test/riscv-test-suite/env | |
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }} | |
name: Build tests for Coreblocks | |
run: | | |
MAKEFILE_PATH=riscof_work/Makefile.build-DUT-coreblocks ../../../ci/riscof_run_makefile.sh | |
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }} | |
name: Upload compiled and reference tests artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "riscof-tests" | |
path: | | |
test/external/riscof/riscv-arch-test/**/*.elf | |
test/external/riscof/riscof_work/**/*.signature | |
test/external/riscof/**/*Makefile* | |
run-riscof-tests: | |
name: Run regression tests (riscv-arch-test) | |
runs-on: ubuntu-latest | |
container: ghcr.io/kuznia-rdzeni/verilator:v5.008-2023.11.19_v | |
needs: [ build-riscof-tests, build-core ] | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get submodules HEAD hash | |
run: | | |
git config --global --add safe.directory /__w/coreblocks/coreblocks | |
git submodule > .gitmodules-hash | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Coreblocks dependencies | |
run: | | |
python3 -m venv venv | |
. venv/bin/activate | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -r requirements-dev.txt | |
- uses: actions/download-artifact@v4 | |
name: Download full verilog core | |
with: | |
name: "verilog-full-core" | |
path: . | |
- uses: actions/cache@v4 | |
name: Download tests from cache | |
env: | |
cache-name: cache-riscv-arch-test | |
with: | |
path: | | |
test/external/riscof/riscv-arch-test/**/*.elf | |
test/external/riscof/riscof_work/**/*.signature | |
test/external/riscof/**/*Makefile* | |
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles( | |
'**/test/external/riscof/coreblocks/**', | |
'**/test/external/riscof/spike_simple/**', | |
'**/test/external/riscof/config.ini', | |
'**/.gitmodules-hash', | |
'**/docker/riscv-toolchain.Dockerfile', | |
'**/.github/workflows/main.yml' | |
) }} | |
fail-on-cache-miss: true | |
- name: Run tests on Coreblocks | |
run: | | |
. venv/bin/activate | |
MAKEFILE_PATH=test/external/riscof/riscof_work/Makefile.run-DUT-coreblocks NPROC=1 ./ci/riscof_run_makefile.sh | |
- name: Compare signatures (test results) | |
run: MAKEFILE_PATH=test/external/riscof/riscof_work/Makefile.run-DUT-coreblocks ./ci/riscof_compare.sh | |
build-regression-tests: | |
name: Build regression tests (riscv-tests) | |
runs-on: ubuntu-latest | |
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2024.12.07 | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get submodules HEAD hash | |
run: | | |
git config --global --add safe.directory /__w/coreblocks/coreblocks | |
git submodule > .gitmodules-hash | |
- name: Cache regression-tests | |
id: cache-regression | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-regression-tests | |
with: | |
path: test/external/riscv-tests/test-* | |
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles( | |
'**/test/external/riscv-tests/environment/custom/**', | |
'**/test/external/riscv-tests/Makefile', | |
'**/.gitmodules-hash', | |
'**/docker/riscv-toolchain.Dockerfile', | |
'**/.github/workflows/main.yml' | |
) }} | |
lookup-only: true | |
- if: ${{ steps.cache-regression.outputs.cache-hit != 'true' }} | |
name: Checkout with submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- if: ${{ steps.cache-regression.outputs.cache-hit != 'true' }} | |
run: cd test/external/riscv-tests && make | |
- if: ${{ steps.cache-regression.outputs.cache-hit != 'true' }} | |
name: Upload riscv-tests | |
uses: actions/upload-artifact@v4 | |
with: | |
path: test/external/riscv-tests | |
run-regression-tests: | |
name: Run regression tests (riscv-tests) | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
container: ghcr.io/kuznia-rdzeni/verilator:v5.008-2023.11.19_v | |
needs: [ build-regression-tests, build-core ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get submodules HEAD hash | |
run: | | |
git config --global --add safe.directory /__w/coreblocks/coreblocks | |
git submodule > .gitmodules-hash | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python3 -m venv venv | |
. venv/bin/activate | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -r requirements-dev.txt | |
- uses: actions/download-artifact@v4 | |
name: Download full verilog core | |
with: | |
name: "verilog-full-core" | |
path: . | |
- uses: actions/cache@v4 | |
name: Download tests from cache | |
env: | |
cache-name: cache-regression-tests | |
with: | |
path: test/external/riscv-tests/test-* | |
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles( | |
'**/test/external/riscv-tests/environment/custom/**', | |
'**/test/external/riscv-tests/Makefile', | |
'**/.gitmodules-hash', | |
'**/docker/riscv-toolchain.Dockerfile', | |
'**/.github/workflows/main.yml' | |
) }} | |
fail-on-cache-miss: true | |
- name: Run tests | |
run: | | |
. venv/bin/activate | |
scripts/run_tests.py -a regression | |
- name: Check regression with pysim | |
run: | | |
. venv/bin/activate | |
./scripts/run_tests.py -c 1 -a -b pysim regression | |
unit-test: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements.txt | |
requirements-dev.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install -r requirements-dev.txt | |
sudo apt-get install -y binutils-riscv64-unknown-elf | |
- name: Run tests | |
run: ./scripts/run_tests.py -v | |
- name: Check traces and profiles | |
run: ./scripts/run_tests.py -t -p -c 1 TestCore | |
- name: Check listing tests | |
run: ./scripts/run_tests.py -l | |
lint: | |
name: Check code formatting and typing | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements.txt | |
requirements-dev.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install -r requirements-dev.txt | |
- name: Check format | |
run: ./scripts/lint.sh check_format | |
- name: Check types | |
run: ./scripts/lint.sh check_types |