Skip to content

de-limit

de-limit #4216

Workflow file for this run

name: PR Gate
# This pipeline is the minimum bar a PR must pass before it can be merged.
# It is intended to be fast and lightweight to trigger automatically on every
# change in every PR and provide quick feedback without overloading the CI.
# Requirements for all jobs in this workflow:
# - A new job must cancel a previously scheduled/running job.
# PRs only care about the latest commit and multiple pushes may happen in quick succession.
# - End-to-end (excluding wait times for runners) must be less than 5mins.
# This includes the cost of checking out the code, preparing a runner, etc.
# - Individual test cases must be less than 1s.
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
merge_group:
concurrency:
# Use github.run_id on main branch (or any protected branch)
# This ensure that no runs get cancelled on main
# Use github.event.pull_request.number on pull requests, so it's unique per pull request
# and will cancel obsolete runs
# Use github.ref on other branches, so it's unique per branch
# Possibly PRs can also just use `github.ref`, but for now just copy/pasting from
# https://www.meziantou.net/how-to-cancel-github-workflows-when-pushing-new-commits-on-a-branch.htm
group: ${{ github.workflow }}-${{ github.ref_protected && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pr-gate-build:
name: Build
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- run: |
exit 0
# uses: ./.github/workflows/build-artifact.yaml
# with:
# version: "22.04"
smoke-tests:
needs: pr-gate-build
strategy:
fail-fast: false
matrix:
platform: [
"tt-beta-ubuntu-2204-n300-large-stable",
]
runs-on: ubuntu-latest
steps:
- run: |
exit 0
# uses: ./.github/workflows/smoke.yaml
# with:
# docker-image: ${{ needs.pr-gate-build.outputs.ci-build-docker-image }}
# package-artifact-name: ${{ needs.pr-gate-build.outputs.packages-artifact-name }}
# runner: ${{ matrix.platform }}
# GitHub has so many design limitations it's not even funny.
# This job is purely so we can capture the essence of the workflow as a whole in our status checks.
workflow-status:
name: PR Gate Status
if: always() # Force this job to run so GH can 'see' it
needs: [pr-gate-build, smoke-tests]
runs-on: ubuntu-latest
steps:
- name: Check if all jobs passed
uses: actions/github-script@v7
with:
script: |
const requiredJobs = ["pr-gate-build"];
const optionalJobs = ["smoke-tests"];
// The 'needs' context provides job outcomes
const needs = ${{ toJSON(needs) }};
console.log("Needs context:", needs);
// Check required jobs
for (const job of requiredJobs) {
if (needs[job]?.outcome !== "success") {
core.setFailed(`Required job '${job}' did not succeed.`);
}
}
// Check optional jobs (treat skipped as success)
for (const job of optionalJobs) {
const outcome = needs[job]?.outcome || "success"; // Default to success if undefined
if (outcome === "failure") {
core.setFailed(`Optional job '${job}' failed.`);
}
}
console.log("Workflow was successful.");