Skip to content

Commit

Permalink
ci: Add first github and gitlab CI checks
Browse files Browse the repository at this point in the history
  • Loading branch information
GiannaP committed Jul 31, 2023
1 parent 44a3ca9 commit dd96777
Show file tree
Hide file tree
Showing 6 changed files with 539 additions and 1 deletion.
123 changes: 123 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# 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:

########
# Docs #
########

# docs:
# name: Build documentation
# runs-on: ubuntu-22.04
# container:
# image: ghcr.io/pulp-platform/snitch_cluster
# steps:
# - uses: actions/checkout@v2
# - name: Build docs
# run: mkdocs build

######################################
# Simulate SW on Occamy w/ Verilator #
######################################

sw-occamy-vlt:
name: Simulate SW on Occamy w/ Verilator
runs-on: ubuntu-22.04
container:
image: ghcr.io/pulp-platform/snitch_cluster
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
# - name: Build MUSL dependency
# run: |
# cd sw/deps
# mkdir install
# cd musl
# CC=$LLVM_BINROOT/clang ./configure --disable-shared \
# --prefix=../install/ --enable-wrapper=all \
# CFLAGS="-mcpu=snitch -menable-experimental-extensions"
# make -j4
# make install
# cd ../../../
- name: Build Software
run: |
make -C target/sim sw
- name: Build Hardware
run: |
make -C target/sim bin/occamy.vlt
# - name: Run Unit Tests
# working-directory: target/sim
# run: |-
# ./sw/tests/run.py sw/tests/passing-apps.list --simulator verilator \
# 2>&1 | tee tests.log
# - name: Run Test Applications
# working-directory: target/sim
# env:
# SNITCH_LOG: info
# run: |-
# ./sw/apps/run.py sw/apps/passing-apps.list --simulator verilator \
# 2>&1 | tee apps.log
# - name: Check Unit Tests
# working-directory: target/sim
# run: |-
# grep -zoP 'All tests passed' tests.log
# - name: Check Test Applications
# working-directory: target/sim
# run: |-
# grep -zoP 'All tests passed' apps.log

############################################
# Build SW on Snitch Cluster w/ Banshee #
############################################

# sw-snitch-cluster-banshee:
# name: Simulate SW on Snitch Cluster w/ Banshee
# runs-on: ubuntu-22.04
# container:
# image: ghcr.io/pulp-platform/snitch_cluster
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: 'recursive'
# - name: Build MUSL dependency
# run: |
# cd sw/deps
# mkdir install
# cd musl
# CC=$LLVM_BINROOT/clang ./configure --disable-shared \
# --prefix=../install/ --enable-wrapper=all \
# CFLAGS="-mcpu=snitch -menable-experimental-extensions"
# make -j4
# make install
# cd ../../../
# - name: Build Software
# run: |
# make -C target/snitch_cluster SELECT_RUNTIME=banshee sw
# - name: Run Unit Tests
# working-directory: target/snitch_cluster
# env:
# SNITCH_LOG: info
# run: |-
# ./sw/tests/run.py sw/tests/banshee-apps.list --simulator banshee \
# 2>&1 | tee tests.log
# - name: Run Test Applications
# working-directory: target/snitch_cluster
# env:
# SNITCH_LOG: info
# run: |-
# ./sw/apps/run.py sw/apps/passing-apps.list --simulator banshee \
# 2>&1 | tee apps.log
# - name: Check Unit Tests
# working-directory: target/snitch_cluster
# run: |-
# grep -zoP 'All tests passed' tests.log
# - name: Check Test Applications
# working-directory: target/snitch_cluster
# run: |-
# grep -zoP 'All tests passed' apps.log
27 changes: 27 additions & 0 deletions .github/workflows/gitlab-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2023 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Some CI tests run on our GitLab servers due to licenses and tools
name: gitlab-ci
on: [push, pull_request, workflow_dispatch]
jobs:
gitlab-ci:
name: Internal Gitlab CI
runs-on: ubuntu-22.04
steps:
- name: Check Gitlab CI
uses: pulp-platform/pulp-actions/gitlab-ci@v2.1.0
# Skip on forks or pull requests from forks due to missing secrets.
if:
# yamllint disable rule:line-length
github.repository == 'pulp-platform/occamy' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
# yamllint enable rule:line-length
with:
domain: iis-git.ee.ethz.ch
repo: github-mirror/occamy
token: ${{ secrets.GITLAB_TOKEN }}
poll-period: 20
poll-count: 1000
retry-count: 100
retry-period: 50
118 changes: 118 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Copyright 2023 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 all lint checks
name: lint
on: [push, pull_request]

jobs:

################
# Verible Lint #
################
verible-lint:
name: Lint Verilog sources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chipsalliance/verible-linter-action@main
with:
paths: |
./hw
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_error: true
reviewdog_reporter: github-check
extra_args: "--waiver_files util/lint/waiver.verible"
verible_version: "v0.0-3318-g8d254167"

#####################
# Vendor Up-to-Date #
#####################
bender-vendor-up-to-date:
name: Check bender vendor up-to-date
runs-on: ubuntu-latest
steps:
- name: Check bender vendor up-to-date
uses: pulp-platform/pulp-actions/bender-vendor-up-to-date@v2.1.0

#################
# Check License #
#################
license-lint:
name: Check License headers
runs-on: ubuntu-latest
steps:
- name: Check License
uses: pulp-platform/pulp-actions/lint-license@v2.1.0
with:
patches: 0001-Allow-hash-comments-in-assembly.patch
# We cover ETH Zurich and lowRISC licenses and Apache 2.0
# (mostly for SW) and Solderpad for the hardware.
# yamllint disable rule:line-length
license: |
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)
# yamllint enable rule:line-length
match_regex: true
exclude_paths: |
sw/snRuntime/src/omp/interface.h
hw/vendor/openhwgroup_cva6
util/solder/solder.*.tpl
##################
# Lint YML Files #
##################
yaml-lint:
name: Lint YAML Sources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
with:
config_file: util/lint/.yamllint.yml

########################
# Check Python Sources #
########################
python-lint:
runs-on: ubuntu-latest
name: Lint Python Sources
steps:
- name: Check out source repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
max-line-length: "100"

######################
# Clang-Format Check #
######################
# Check C/C++ files for correct formatting.
clangfmt:
name: Lint C/C++ Sources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.16.2
with:
clangFormatVersion: 10

######################
# Lint Editor Config #
######################
# Detect trailing whitespaces, missing new lines and wrong file encodings.
editorconfig-lint:
name: Lint Editorconfig
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
Loading

0 comments on commit dd96777

Please sign in to comment.