Skip to content

Commit

Permalink
Add CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alex96295 authored Apr 4, 2023
1 parent cc77fc6 commit 944d87a
Show file tree
Hide file tree
Showing 13 changed files with 524 additions and 31 deletions.
15 changes: 15 additions & 0 deletions .github/license-checker-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"problemMatcher": [
{
"owner": "license-checker-matcher",
"pattern": [
{
"regexp": "^ERROR: (.+):(\\d+)(.*)$",
"file": 1,
"line": 2,
"message": 3
}
]
}
]
}
20 changes: 20 additions & 0 deletions .github/license-checker.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
{
// We cover ETH Zurich and lowRISC licenses and Apache 2.0 (mostly for SW)
// and Solderpad for the hardware.
licence:
'''
Copyright (\d{4}(-\d{4})?\s)?(ETH Zurich and University of Bologna|lowRISC contributors).
(Solderpad Hardware License, Version 0.51|Licensed under the Apache License, Version 2.0), see LICENSE for details.
SPDX-License-Identifier: (SHL-0.51|Apache-2.0)
''',
match_regex: 'true',
exclude_paths: [
# Exclude matchers
.github/*-matcher.json
# Exclude generated headers (no support for optional lines)
sw/include/regs/*.h
],
}
6 changes: 6 additions & 0 deletions .github/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
requests
hjson
mako
pyyaml
tabulate
yapf
11 changes: 11 additions & 0 deletions .github/verible.waiver
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2022 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Auto-generated configuration registers are waived
waive --rule=typedef-structs-unions --location="hw/regs/*"
waive --rule=line-length --location="hw/regs/*"
waive --rule=no-trailing-spaces --location="hw/regs/*"
waive --rule=parameter-name-style --location="hw/regs/*"
# Package contains long lines
waive --rule=line-length --location="hw/cheshire_pkg.sv"
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2022 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Author: Paul Scheffler <[email protected]>

name: build

on: [ push, pull_request, workflow_dispatch ]

jobs:

# TODO: somehow handle reproducible boot ROM builds
# TODO: migrate to and/or replicate on docker
build:
strategy:
matrix:
target: [hw, sw, sim]
fail-fast: false
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
-
name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: pip
-
name: Install Python requirements
run: pip install -r .github/requirements.txt
-
name: Install RISC-V GCC toolchain
run: |
curl -Ls -o riscv-gcc.tar.gz https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.01.31/riscv64-elf-ubuntu-20.04-nightly-2023.01.31-nightly.tar.gz
sudo mkdir -p /tools/riscv && sudo chmod 777 /tools/riscv
tar -C /tools/riscv -xf riscv-gcc.tar.gz --strip-components=1
rm riscv-gcc.tar.gz
echo "PATH=$PATH:/tools/riscv/bin" >> ${GITHUB_ENV}
-
name: Install Bender
run: |
sudo mkdir -p /tools/bender && sudo chmod 777 /tools/bender
cd /tools/bender && curl --proto '=https' --tlsv1.2 -sSf https://pulp-platform.github.io/bender/init | bash -s -- ${BENDER_VERSION}
echo "PATH=$PATH:/tools/bender" >> ${GITHUB_ENV}
env:
BENDER_VERSION: 0.27.0
-
name: Build target
run: |
bender checkout
make chs-${{ matrix.target }}-all
-
name: Check whether clean
run: git status && test -z "$(git status --porcelain --ignore-submodules)"
20 changes: 20 additions & 0 deletions .github/workflows/gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2022 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Author: Alessandro Ottaviano <[email protected]>

name: gitlab-ci

on: [ push, pull_request, workflow_dispatch ]

jobs:
gitlab-ci:
runs-on: ubuntu-latest
steps:
- name: Check Gitlab CI
uses: pulp-platform/pulp-actions/gitlab-ci@v1
with:
domain: iis-git.ee.ethz.ch
repo: github-mirror/carfield
token: ${{ secrets.GITLAB_TOKEN }}
55 changes: 55 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2022 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Author: Paul Scheffler <[email protected]>

name: lint

on: [ push, pull_request, workflow_dispatch ]

jobs:

lint-license:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
-
name: Install Python requirements
run: |
cd .github
pip install -r requirements.txt
-
name: Intall license linter
run: |
cd .github
git clone https://github.com/lowRISC/misc-linters.git
-
name: Check license
run: |
echo "::add-matcher::.github/license-checker-matcher.json"
bash -c "set -e; .github/misc-linters/licence-checker/licence-checker.py --config .github/license-checker.hjson"
echo "::remove-matcher owner=license-checker-matcher::"
lint-sv:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Run Verible
uses: chipsalliance/verible-linter-action@main
with:
paths: hw
extra_args: "--waiver_files .github/verible.waiver"
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_error: true
reviewdog_reporter: github-check
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.bender
cheshire
modelsim.ini
scripts/carfield_compile.tcl
tb/hyp_vip
transcript
work/
25 changes: 25 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2022 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Paul Scheffler <[email protected]>

# We initialize the nonfree repo, then spawn a sub-pipeline from it

stages:
- nonfree

init:
stage: nonfree
script: make nonfree-init
artifacts:
paths: [ nonfree/ci.yml ]

subpipe:
stage: nonfree
needs: [ init ]
trigger:
include:
- artifact: nonfree/ci.yml
job: init
strategy: depend
Loading

0 comments on commit 944d87a

Please sign in to comment.