From e78d17b551e15a2efb6dc08ed33287770ad9ca52 Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Tue, 10 Sep 2024 12:04:06 +0200 Subject: [PATCH] Revert "ci: Use `build-docker` workflow as dependency for other workflows" This reverts commit 3ce30482a3765072701b0dfdcad9fdfd9e50905b. --- .github/workflows/build-docker.yml | 42 ---------------------- .github/workflows/ci.yml | 58 +++++++++++++++++++++++++----- .github/workflows/lint.yml | 41 +++++++++++++++++---- 3 files changed, 84 insertions(+), 57 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 6ece706ac..000000000 --- a/.github/workflows/build-docker.yml +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -name: build-docker -on: [push, pull_request] - -jobs: - - ########################## - # Build Docker Container # - ########################## - - build-docker: - name: Deploy Docker image - runs-on: ubuntu-22.04 - # Skip pull requests from internal contributors. - if: > - github.event_name != 'pull_request' || - github.event.pull_request.head.repo.full_name != github.repository - steps: - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@main - with: - docker-images: false - - 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/snitch_cluster:${{ github.ref_name }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b4d3ffde..07a0be0d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,13 +4,43 @@ # Run functional regression checks name: ci -on: - workflow_run: - workflows: [build-docker] - types: [completed] +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: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + docker-images: false + - 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/snitch_cluster:${{ github.ref_name }} + ######## # Docs # ######## @@ -18,9 +48,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/snitch_cluster:${{ github.ref_name }} - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v2 - name: Build docs @@ -33,9 +66,12 @@ jobs: pytest: name: Python unit tests 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/snitch_cluster:${{ github.ref_name }} - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v2 - name: Run pytest @@ -48,9 +84,12 @@ jobs: sw-snitch-cluster-vlt: name: Simulate SW on Snitch Cluster w/ Verilator 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/snitch_cluster:${{ github.ref_name }} - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v2 with: @@ -96,9 +135,12 @@ jobs: sw-snitch-cluster-banshee: name: Simulate SW on Snitch Cluster w/ Banshee 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/snitch_cluster:${{ github.ref_name }} - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 67518f30c..f36145f0b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,10 +4,7 @@ # Run all lint checks name: lint -on: - workflow_run: - workflows: [build-docker] - types: [completed] +on: [push, pull_request] jobs: @@ -17,6 +14,9 @@ jobs: 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 @@ -35,6 +35,9 @@ jobs: 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 @@ -45,13 +48,22 @@ jobs: sources-up-to-date: name: Check Sources Up-to-Date runs-on: ubuntu-22.04 - container: - image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }} - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository steps: - uses: actions/checkout@v4 with: submodules: true + - name: Install bender + uses: pulp-platform/pulp-actions/bender-install@v2 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + - name: Install pip dependencies + run: | + pip install . - name: Generate opcodes run: | ./util/generate-opcodes.sh @@ -70,6 +82,9 @@ jobs: 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 @@ -93,6 +108,9 @@ jobs: 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 @@ -105,6 +123,9 @@ jobs: ######################## python-lint: runs-on: ubuntu-latest + if: > + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name != github.repository name: Lint Python Sources steps: - name: Check out source repository @@ -126,6 +147,9 @@ jobs: clangfmt: name: Lint C/C++ 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: DoozyX/clang-format-lint-action@v0.18.1 @@ -139,6 +163,9 @@ jobs: 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