CI workflow (cocotb/cocotb)
The CI workflow from cocotb/cocotb, explained and optimized by Latchkey.
A
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the CI workflow from the cocotb/cocotb repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: ${{ !(contains(github.ref, 'release/') || contains(github.ref, 'master')) }}
on:
# Run this workflow on every push to the master branch, or a stable branch.
push:
branches:
- master
- "stable/**"
- "feature/**"
pull_request:
branches:
- master
- 'stable/**'
- 'feature/**'
paths-ignore:
# Skip running tests for changes only in:
# Documentation
- 'docs/**'
# Dot-files not related to running tests
- '.devcontainer/**'
- '.backportrc.json'
- '.clang-format'
- '.git-blame-ignore-revs'
- '.gitignore'
- '.pre-commit-config.yaml'
- '.readthedocs.yml'
# Information files
- 'LICENSE'
- 'README.md'
- 'CONTRIBUTING.md'
- 'MANIFEST.in'
# Github files that aren't related to testing
- '.github/issue_template.md'
- '.github/PULL_REQUEST_TEMPLATE.md'
- '.github/workflows/backport.yml'
- '.github/workflows/benchmark.yml'
- '.github/workflows/ecosystem-compat.yml'
- '.github/workflows/experimental.yml'
- '.github/workflows/extended.yml'
- '.github/workflows/stale.yml'
jobs:
test_dev:
name: Regression Tests
uses: ./.github/workflows/regression-tests.yml
with:
test_task: dev_test
collect_coverage: true
group: ci-free
test_dev_licensed:
if: github.repository == 'cocotb/cocotb'
name: Regression Tests
uses: ./.github/workflows/regression-tests.yml
with:
test_task: dev_test
collect_coverage: true
group: ci-licensed
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Copyright cocotb contributors # Licensed under the Revised BSD License, see LICENSE for details. # SPDX-License-Identifier: BSD-3-Clause name: CI concurrency: group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} cancel-in-progress: ${{ !(contains(github.ref, 'release/') || contains(github.ref, 'master')) }} on: # Run this workflow on every push to the master branch, or a stable branch. push: branches: - master - "stable/**" - "feature/**" pull_request: branches: - master - 'stable/**' - 'feature/**' paths-ignore: # Skip running tests for changes only in: # Documentation - 'docs/**' # Dot-files not related to running tests - '.devcontainer/**' - '.backportrc.json' - '.clang-format' - '.git-blame-ignore-revs' - '.gitignore' - '.pre-commit-config.yaml' - '.readthedocs.yml' # Information files - 'LICENSE' - 'README.md' - 'CONTRIBUTING.md' - 'MANIFEST.in' # Github files that aren't related to testing - '.github/issue_template.md' - '.github/PULL_REQUEST_TEMPLATE.md' - '.github/workflows/backport.yml' - '.github/workflows/benchmark.yml' - '.github/workflows/ecosystem-compat.yml' - '.github/workflows/experimental.yml' - '.github/workflows/extended.yml' - '.github/workflows/stale.yml' jobs: test_dev: timeout-minutes: 30 name: Regression Tests uses: ./.github/workflows/regression-tests.yml with: test_task: dev_test collect_coverage: true group: ci-free test_dev_licensed: timeout-minutes: 30 if: github.repository == 'cocotb/cocotb' name: Regression Tests uses: ./.github/workflows/regression-tests.yml with: test_task: dev_test collect_coverage: true group: ci-licensed
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.