ci: doc: always report status

Generate status that can be used for enforcing branch checks even if
some jobs get skipped.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2024-02-19 12:24:28 -05:00
parent f3709e20b8
commit a9f77a5126
2 changed files with 72 additions and 14 deletions

View file

@ -10,19 +10,6 @@ on:
tags:
- v*
pull_request:
paths:
- 'doc/**'
- '**.rst'
- 'include/**'
- 'kernel/include/kernel_arch_interface.h'
- 'lib/libc/**'
- 'subsys/testsuite/ztest/include/**'
- 'tests/**'
- '**/Kconfig*'
- 'west.yml'
- '.github/workflows/doc-build.yml'
- 'scripts/dts/**'
- 'doc/requirements.txt'
env:
# NOTE: west docstrings will be extracted from the version listed here
@ -33,9 +20,41 @@ env:
DOXYGEN_VERSION: 1.9.6
jobs:
doc-file-check:
name: Check for doc changes
runs-on: ubuntu-22.04
if: >
github.repository_owner == 'zephyrproject-rtos'
outputs:
file_check: ${{ steps.check-doc-files.outputs.any_changed }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Check if Documentation related files changed
uses: tj-actions/changed-files@v42
id: check-doc-files
with:
files: |
doc/**
**.rst
include/**
kernel/include/kernel_arch_interface.h
lib/libc/**
subsys/testsuite/ztest/include/**
tests/**
**/Kconfig*
west.yml
scripts/dts/**
doc/requirements.txt
.github/workflows/doc-build.yml
doc-build-html:
name: "Documentation Build (HTML)"
if: github.repository_owner == 'zephyrproject-rtos'
needs: [doc-file-check]
if: github.repository_owner == 'zephyrproject-rtos' && needs.doc-file-check.outputs.file_check == 'true'
runs-on: zephyr-runner-linux-x64-4xlarge
timeout-minutes: 45
concurrency:
@ -217,3 +236,14 @@ jobs:
path: |
doc/_build/latex/zephyr.pdf
doc/_build/latex/zephyr.log
doc-build-status-check:
if: always()
name: "Documentation Build Status"
needs:
- doc-build-pdf
- doc-file-check
- doc-build-html
uses: ./.github/workflows/ready-to-merge.yml
with:
needs_context: ${{ toJson(needs) }}

28
.github/workflows/ready-to-merge.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: ready to merge
on:
workflow_call:
inputs:
needs_context:
type: string
required: true
jobs:
all_jobs_passed:
name: all jobs passed
runs-on: ubuntu-latest
steps:
- name: "Check status of all required jobs"
run: |-
NEEDS_CONTEXT='${{ inputs.needs_context }}'
JOB_IDS=$(echo "$NEEDS_CONTEXT" | jq -r 'keys[]')
for JOB_ID in $JOB_IDS; do
RESULT=$(echo "$NEEDS_CONTEXT" | jq -r ".[\"$JOB_ID\"].result")
echo "$JOB_ID job result: $RESULT"
if [[ $RESULT != "success" && $RESULT != "skipped" ]]; then
echo "***"
echo "Error: The $JOB_ID job did not pass."
exit 1
fi
done
echo "All jobs passed or were skipped."