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 Aug 3, 2023
1 parent 44a3ca9 commit 15f5809
Show file tree
Hide file tree
Showing 19 changed files with 768 additions and 30 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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

# Build Docker image and publish to pulp-platform's GHCR.
name: build-docker
on:
push:
branches: [ci-setup]
workflow_dispatch:
jobs:
build-docker:
name: Deploy Docker image
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- name: GHCR Log-in
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: util/container/Dockerfile
push: true
tags: ghcr.io/pulp-platform/occamy:latest
build-args: |-
SNITCH_LLVM_VERSION=latest
126 changes: 126 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# 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/occamy
# 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/occamy
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: Get Bender dependencies
run: |
bender
- 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/occamy
# 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/[email protected]
# 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/[email protected]

#################
# Check License #
#################
license-lint:
name: Check License headers
runs-on: ubuntu-latest
steps:
- name: Check License
uses: pulp-platform/pulp-actions/[email protected]
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/[email protected]
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 15f5809

Please sign in to comment.