CI: Improve and cleanup (#6448)

Chores:
- Remove ci-ccache-maint. This has never been useful and is just cruft.
- Remove then unused CI_COMMIT
- Change job names so they come out nicer in the web views
- Make os-name input to reusable-build always explicit

Improvements:
- Have at most build-test job in progress per branch
- Cancel in-progress build-test jobs on PRs
- In forks (that is, not on 'verilator/verilator'), cancel any
  in-progress build-test jobs on push to the branch
This commit is contained in:
Geza Lore 2025-09-17 21:41:29 +02:00 committed by GitHub
parent 1432bb8889
commit 0e2f0381d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 27 additions and 60 deletions

View File

@ -22,16 +22,18 @@ defaults:
working-directory: repo
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: true
# At most 1 job per branch. Auto cancel on pull requests and on all forks
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'verilator/verilator' }}
jobs:
build-2404-gcc:
name: Build-Ubuntu
name: Build | ${{ matrix.os }} | ${{ matrix.cc }}${{ matrix.asan && ' | asan' || '' }}
uses: ./.github/workflows/reusable-build.yml
with:
os: ${{ matrix.os }}
os-name: linux
cc: ${{ matrix.cc }}
asan: ${{ matrix.asan }}
strategy:
@ -41,10 +43,11 @@ jobs:
- {os: ubuntu-24.04, cc: gcc, asan: 0}
build-2404-clang:
name: Build-Ubuntu
name: Build | ${{ matrix.os }} | ${{ matrix.cc }}${{ matrix.asan && ' | asan' || '' }}
uses: ./.github/workflows/reusable-build.yml
with:
os: ${{ matrix.os }}
os-name: linux
cc: ${{ matrix.cc }}
asan: ${{ matrix.asan }}
strategy:
@ -54,10 +57,11 @@ jobs:
- {os: ubuntu-24.04, cc: clang, asan: 1}
build-2204-gcc:
name: Build-Ubuntu
name: Build | ${{ matrix.os }} | ${{ matrix.cc }}${{ matrix.asan && ' | asan' || '' }}
uses: ./.github/workflows/reusable-build.yml
with:
os: ${{ matrix.os }}
os-name: linux
cc: ${{ matrix.cc }}
asan: ${{ matrix.asan }}
strategy:
@ -67,10 +71,11 @@ jobs:
- {os: ubuntu-22.04, cc: gcc, asan: 0}
build-2204-clang:
name: Build-Ubuntu
name: Build | ${{ matrix.os }} | ${{ matrix.cc }}${{ matrix.asan && ' | asan' || '' }}
uses: ./.github/workflows/reusable-build.yml
with:
os: ${{ matrix.os }}
os-name: linux
cc: ${{ matrix.cc }}
asan: ${{ matrix.asan }}
strategy:
@ -80,7 +85,7 @@ jobs:
- {os: ubuntu-22.04, cc: clang, asan: 0}
build-osx-gcc:
name: Build-OSX
name: Build | ${{ matrix.os }} | ${{ matrix.cc }}${{ matrix.asan && ' | asan' || '' }}
uses: ./.github/workflows/reusable-build.yml
with:
os: ${{ matrix.os }}
@ -94,7 +99,7 @@ jobs:
- {os: macos-15, cc: gcc, asan: 0}
build-osx-clang:
name: Build-OSX
name: Build | ${{ matrix.os }} | ${{ matrix.cc }}${{ matrix.asan && ' | asan' || '' }}
uses: ./.github/workflows/reusable-build.yml
with:
os: ${{ matrix.os }}
@ -108,7 +113,7 @@ jobs:
- {os: macos-15, cc: clang, asan: 0}
build-windows:
name: Build-Windows
name: Build | ${{ matrix.os }} | ${{ matrix.cc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@ -117,7 +122,6 @@ jobs:
- {os: windows-2025, cc: msvc}
env:
CI_OS_NAME: win
CI_COMMIT: ${{ github.sha }}
CCACHE_COMPRESS: 1
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_LIMIT_MULTIPLE: 0.95
@ -145,7 +149,7 @@ jobs:
name: verilator-win.zip
test-2404-gcc:
name: Test | ${{ matrix.os }} | ${{ matrix.cc }}
name: Test | ${{ matrix.os }} | ${{ matrix.cc }} | ${{ matrix.reloc && 'reloc | ' || '' }} ${{ matrix.suite }}
needs: build-2404-gcc
uses: ./.github/workflows/reusable-test.yml
with:
@ -167,7 +171,7 @@ jobs:
- {os: ubuntu-24.04, cc: gcc, reloc: 0, suite: vltmt-2}
test-2404-clang:
name: Test | ${{ matrix.os }} | ${{ matrix.cc }}
name: Test | ${{ matrix.os }} | ${{ matrix.cc }} | ${{ matrix.reloc && 'reloc | ' || '' }} ${{ matrix.suite }}
needs: build-2404-clang
uses: ./.github/workflows/reusable-test.yml
with:
@ -189,7 +193,7 @@ jobs:
- {os: ubuntu-24.04, cc: clang, reloc: 0, suite: vltmt-2}
test-2204-gcc:
name: Test | ${{ matrix.os }} | ${{ matrix.cc }}
name: Test | ${{ matrix.os }} | ${{ matrix.cc }} | ${{ matrix.reloc && 'reloc | ' || '' }} ${{ matrix.suite }}
needs: build-2204-gcc
uses: ./.github/workflows/reusable-test.yml
with:
@ -211,7 +215,7 @@ jobs:
- {os: ubuntu-22.04, cc: gcc, reloc: 0, suite: vltmt-2}
test-2204-clang:
name: Test | ${{ matrix.os }} | ${{ matrix.cc }}
name: Test | ${{ matrix.os }} | ${{ matrix.cc }} | ${{ matrix.reloc && 'reloc | ' || '' }} ${{ matrix.suite }}
needs: build-2204-clang
uses: ./.github/workflows/reusable-test.yml
with:

View File

@ -14,7 +14,6 @@ permissions:
env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}
COVERAGE: 1
VERILATOR_ARCHIVE: verilator-coverage-${{ github.sha }}.tar.gz

View File

@ -7,10 +7,7 @@ on:
push:
branches-ignore:
- 'dependabot/**' # Avoid duplicates: only run the PR, not the push
pull_request_target:
workflow_dispatch:
permissions:
contents: write
jobs:
format:
runs-on: ubuntu-24.04

View File

@ -10,20 +10,18 @@ on:
os: # e.g. ubuntu-24.04
required: true
type: string
cc: # gcc or clang
cc: # 'clang' or 'gcc'
required: true
type: string
os-name:
required: false
os-name: # 'linux' or 'osx'
required: true
type: string
default: linux
asan:
required: true
type: number
env:
CI_OS_NAME: ${{ inputs.os-name }}
CI_COMMIT: ${{ github.sha }}
CCACHE_COMPRESS: 1
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_LIMIT_MULTIPLE: 0.95
@ -39,7 +37,7 @@ jobs:
build:
runs-on: ${{ inputs.os }}
name: Sub-build | ${{ inputs.os }} | ${{ inputs.cc }}
name: Build
env:
CI_ASAN: ${{ inputs.asan }}
CI_BUILD_STAGE_NAME: build

View File

@ -9,7 +9,6 @@ on:
env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ubuntu-22.04
CCACHE_COMPRESS: 1

View File

@ -22,7 +22,6 @@ on:
env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}
CCACHE_COMPRESS: 1
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_LIMIT_MULTIPLE: 0.95
@ -38,7 +37,7 @@ jobs:
test:
runs-on: ${{ inputs.os }}
name: Sub-test | ${{ inputs.os }} | ${{ inputs.cc }} | ${{inputs.reloc && 'reloc | ' || '' }} ${{ inputs.suite }}
name: Test
env:
CI_BUILD_STAGE_NAME: test
CI_RUNS_ON: ${{ inputs.os }}

View File

@ -20,7 +20,8 @@ defaults:
shell: bash
concurrency:
group: ${{ github.ref }}
# At most 1 job per branch. Auto cancel all but scheduled jobs
group: ${{ github.worfklow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'schedule' }}
jobs:

View File

@ -1,30 +0,0 @@
#!/usr/bin/env bash
# DESCRIPTION: Verilator: CI ccache maintenance
#
# Copyright 2020 by Geza Lore. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
#
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
################################################################################
# This script is run in 'before_script', once ccache has been set up.
################################################################################
set -e
set -x
# Show version
ccache --version
# Flush ccache if requested in commit message
COMMIT="${CI_PULL_REQUEST_SHA:-$CI_COMMIT}"
if git log --format=%B -n 1 "$COMMIT" | grep -q -i '\[CI\s\+ccache\s\+clear\]'; then
echo "Flushing ccache due to commit message"
ccache -C
fi
# Dump stats, then zero stats
# 22.04: ccache -s -v -z
ccache -s -z

View File

@ -85,7 +85,7 @@ if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then
fi
if [ -n "$CCACHE_DIR" ]; then
mkdir -p "$CCACHE_DIR" && ./ci/ci-ccache-maint.bash
mkdir -p "$CCACHE_DIR"
fi
elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then
##############################################################################