Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[workflows] Rework pre-commit CI for the release branch #91550

Open
wants to merge 4 commits into
base: release/18.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: "CI Tests"

permissions:
contents: read

on:
pull_request:
types:
- opened
- synchronize
- reopened
# When a PR is closed, we still start this workflow, but then skip
# all the jobs, which makes it effectively a no-op. The reason to
# do this is that it allows us to take advantage of concurrency groups
# to cancel in progress CI jobs whenever the PR is closed.
- closed
branches:
- 'release/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: True

jobs:
compute-test-configs:
name: "Compute Configurations to Test"
if: >-
github.repository_owner == 'llvm' &&
github.event.action != 'closed'
runs-on: ubuntu-22.04
outputs:
projects: ${{ steps.vars.outputs.projects }}
check-targets: ${{ steps.vars.outputs.check-targets }}
test-build: ${{ steps.vars.outputs.check-targets != '' }}
test-platforms: ${{ steps.platforms.outputs.result }}
steps:
- name: Fetch LLVM sources
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Compute projects to test
id: vars
uses: ./.github/workflows/compute-projects-to-test

- name: Compute platforms to test
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
id: platforms
with:
script: |
linuxConfig = {
name: "linux-x86_64",
runs_on: "ubuntu-22.04"
}
windowsConfig = {
name: "windows-x86_64",
runs_on: "windows-2022"
}
macConfig = {
name: "macos-x86_64",
runs_on: "macos-13"
}
macArmConfig = {
name: "macos-aarch64",
runs_on: "macos-14"
}

configs = []

const base_ref = process.env.GITHUB_BASE_REF;
if (base_ref.startsWith('release/')) {
// This is a pull request against a release branch.
configs.push(macConfig)
configs.push(macArmConfig)
}

return configs;

ci-build-test:
# If this job name is changed, then we need to update the job-name
# paramater for the timeout-save step below.
name: "Build"
needs:
- compute-test-configs
permissions:
actions: write #pr-sccache-save may delete artifacts.
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.compute-test-configs.outputs.test-platforms) }}
if: needs.compute-test-configs.outputs.test-build == 'true'
steps:
- name: Fetch LLVM sources
uses: actions/checkout@v4

- name: Timeout Restore
id: timeout
uses: ./.github/workflows/timeout-restore
with:
artifact-name-suffix: ${{ matrix.name }}

- name: Setup Windows
uses: llvm/actions/setup-windows@main
if: ${{ runner.os == 'Windows' }}
with:
arch: amd64

- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: Setup sccache
uses: hendrikmuhs/ccache-action@v1
with:
max-size: 2G
variant: sccache
key: ci-${{ matrix.name }}

- name: Restore sccache from previous PR run
uses: ./.github/workflows/pr-sccache-restore
with:
artifact-name-suffix: ${{ matrix.name }}

- name: Configure
if: ${{ steps.timeout.outputs.exists != 'true' }}
shell: bash
run: |
cmake -B build -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="${{ needs.compute-test-configs.outputs.projects }}" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_LIT_ARGS="-v --no-progress-bar" \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-S llvm

- name: Build
shell: bash
timeout-minutes: 330
run: |
ninja -C build -k 0 ${{ needs.compute-test-configs.outputs.check-targets }}

- name: Timeout Save
if: always()
uses: ./.github/workflows/timeout-save
with:
job-name: "Build (${{ matrix.name }}, ${{ matrix.runs_on }})"
artifact-name-suffix: ${{ matrix.name }}
timeout-step: "Build"
timeout-minutes: 330

- name: Save sccache for next PR run
if: always()
uses: ./.github/workflows/pr-sccache-save
with:
artifact-name-suffix: ${{ matrix.name }}
38 changes: 0 additions & 38 deletions .github/workflows/clang-tests.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/compute-projects-to-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Compute Projects To Test'
inputs:
projects:
required: false
type: 'string'

outputs:
check-targets:
description: "A space delimited list of check-targets to pass to ninja."
value: ${{ steps.compute-projects.outputs.check-targets }}

projects:
description: "A semi-colon delimited list of projects to pass to -DLLVM_ENABLE_PROJECTS."
value: ${{ steps.compute-projects.outputs.projects }}

runs:
using: "composite"
steps:
- id: compute-projects
run: .github/workflows/compute-projects-to-test/compute-projects-to-test.sh ${{ inputs.projects }}
shell: bash
Loading
Loading