From b74ba10f5d40585a44844d1da05bb89445f56384 Mon Sep 17 00:00:00 2001 From: Luca Colagrande Date: Thu, 3 Oct 2024 19:44:20 +0200 Subject: [PATCH] ci: Update after snitch_cluster#192 --- .github/workflows/build-docker.yml | 32 ------------- .github/workflows/ci.yml | 75 ++++++++++++++++++++++++++++-- .github/workflows/gitlab-ci.yaml | 8 ++-- .github/workflows/lint.yml | 48 ++++++++++--------- 4 files changed, 100 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/build-docker.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml deleted file mode 100644 index 48527c45e..000000000 --- a/.github/workflows/build-docker.yml +++ /dev/null @@ -1,32 +0,0 @@ -# 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 - -# Build Docker image and publish to pulp-platform's GHCR. -name: build-docker -on: - push: - branches: [main] - 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:${{ github.ref_name }} - build-args: |- - SNITCH_LLVM_VERSION=latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0986815b0..8c378c78d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,37 @@ name: ci on: [push, pull_request] jobs: + ########################## + # Build Docker Container # + ########################## + + build-docker: + name: Deploy Docker image + runs-on: ubuntu-22.04 + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - name: GHCR Log-in + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + cache-from: type=gha + cache-to: type=gha,mode=max` + file: util/container/Dockerfile + push: true + tags: ghcr.io/pulp-platform/occamy:${{ github.ref_name }} + build-args: |- + SNITCH_LLVM_VERSION=latest + ######## # Docs # ######## @@ -14,8 +45,12 @@ jobs: docs: name: Build documentation runs-on: ubuntu-22.04 + needs: build-docker + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository container: - image: ghcr.io/pulp-platform/occamy:main + image: ghcr.io/pulp-platform/occamy:${{ github.ref_name }} steps: - uses: actions/checkout@v2 - name: Build docs @@ -23,6 +58,31 @@ jobs: bender checkout mkdocs build + ###################### + # Clang-Format Check # + ###################### + + clangfmt: + name: Lint C/C++ Sources + runs-on: ubuntu-22.04 + needs: build-docker + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository + container: + image: ghcr.io/pulp-platform/occamy:${{ github.ref_name }} + steps: + - name: Check out source repository + uses: actions/checkout@v2 + # Re-use .clang-format from Snitch cluster + - name: Get snitch_cluster dependency + run: | + bender checkout + - name: Lint C sources + uses: DoozyX/clang-format-lint-action@v0.16.2 + with: + clangFormatVersion: 10 + ####################### # Build SW for Occamy # ####################### @@ -30,8 +90,12 @@ jobs: occamy-sw: name: Build SW for Occamy runs-on: ubuntu-22.04 + needs: build-docker + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository container: - image: ghcr.io/pulp-platform/occamy:main + image: ghcr.io/pulp-platform/occamy:${{ github.ref_name }} steps: - uses: actions/checkout@v2 with: @@ -39,7 +103,6 @@ jobs: - name: Build Software run: | bender checkout - pip install deps/snitch_cluster make -C target/sim sw ############################### @@ -49,8 +112,12 @@ jobs: occamy-rtl: name: Generate Occamy RTL sources runs-on: ubuntu-22.04 + needs: build-docker + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository container: - image: ghcr.io/pulp-platform/occamy:main + image: ghcr.io/pulp-platform/occamy:${{ github.ref_name }} steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/gitlab-ci.yaml b/.github/workflows/gitlab-ci.yaml index c2a2649c6..87e0cd80d 100644 --- a/.github/workflows/gitlab-ci.yaml +++ b/.github/workflows/gitlab-ci.yaml @@ -13,10 +13,10 @@ jobs: - 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 + if: > + github.repository == 'pulp-platform/snitch_cluster' && + (github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name == github.repository) with: domain: iis-git.ee.ethz.ch repo: github-mirror/occamy diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d4d4f6940..4e56e98b5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,9 +11,13 @@ jobs: ################ # Verible Lint # ################ + verible-lint: name: Lint Verilog sources runs-on: ubuntu-latest + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository steps: - uses: actions/checkout@v3 - uses: chipsalliance/verible-linter-action@main @@ -31,9 +35,13 @@ jobs: ##################### # Vendor Up-to-Date # ##################### + bender-vendor-up-to-date: name: Check bender vendor up-to-date runs-on: ubuntu-latest + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository steps: - name: Check bender vendor up-to-date uses: pulp-platform/pulp-actions/bender-vendor-up-to-date@v2.1.0 @@ -41,9 +49,13 @@ jobs: ################# # Check License # ################# + license-lint: name: Check License headers runs-on: ubuntu-latest + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository steps: - name: Check License uses: pulp-platform/pulp-actions/lint-license@v2.1.0 @@ -67,9 +79,13 @@ jobs: ################## # Lint YML Files # ################## + yaml-lint: name: Lint YAML Sources runs-on: ubuntu-latest + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository steps: - uses: actions/checkout@v3 - name: yaml-lint @@ -80,9 +96,13 @@ jobs: ######################## # Check Python Sources # ######################## + python-lint: - runs-on: ubuntu-latest name: Lint Python Sources + runs-on: ubuntu-latest + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository steps: - name: Check out source repository uses: actions/checkout@v3 @@ -95,34 +115,16 @@ jobs: 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 - container: - image: ghcr.io/pulp-platform/occamy:main - steps: - - name: Check out source repository - uses: actions/checkout@v2 - # Re-use .clang-format from Snitch cluster - - name: Get snitch_cluster dependency - run: | - bender update - - name: Lint C sources - 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 + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository steps: - uses: actions/checkout@v3 - uses: editorconfig-checker/action-editorconfig-checker@main