Skip to content
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
16 changes: 14 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,14 @@ jobs:
- name: Check for unsupported C global variables
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
run: make check-c-globals
- name: Check for undocumented C APIs
run: make check-c-api-docs

check-c-api-docs:
name: C API Docs
needs: build-context
if: >-
needs.build-context.outputs.run-tests == 'true'
|| needs.build-context.outputs.run-docs == 'true'
Comment on lines +150 to +151
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(personal style preference, optional)

Suggested change
needs.build-context.outputs.run-tests == 'true'
|| needs.build-context.outputs.run-docs == 'true'
fromJSON(needs.build-context.outputs.run-tests)
|| fromJSON(needs.build-context.outputs.run-docs)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to remain consistent, I'll leave it up to whoever merges, however.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is consistent with a bunch of places while differs from the others. I think GHA infra could use some linting and will probably look into that later. But again, this is probably something that would be improved in follow-ups.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a truthiness check, thing == 'true' is clearer to me than fromJSON(thing).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Hugo that is indeed more readable/logical.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright.. String comparison it is, then. It's just that the readability is poor when multiple conditionals are chained and having function calls makes it a little bit better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright.. String comparison it is, then. It's just that the readability is poor when multiple conditionals are chained and having function calls makes it a little bit better.

uses: ./.github/workflows/reusable-check-c-api-docs.yml

build-windows:
name: >-
Expand Down Expand Up @@ -685,6 +690,7 @@ jobs:
- check-docs
- check-autoconf-regen
- check-generated-files
- check-c-api-docs
- build-windows
- build-windows-msi
- build-macos
Expand Down Expand Up @@ -721,6 +727,12 @@ jobs:
'
|| ''
}}
${{
!fromJSON(needs.build-context.outputs.run-tests)
&& !fromJSON(needs.build-context.outputs.run-docs)
&& 'check-c-api-docs,'
|| ''
}}
${{ !fromJSON(needs.build-context.outputs.run-windows-tests) && 'build-windows,' || '' }}
${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && 'cifuzz,' || '' }}
${{ !fromJSON(needs.build-context.outputs.run-macos) && 'build-macos,' || '' }}
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/reusable-check-c-api-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Reusable C API Docs Check

on:
workflow_call:

permissions:
contents: read

env:
FORCE_COLOR: 1

jobs:
check-c-api-docs:
name: 'Check if all C APIs are documented'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Check for undocumented C APIs
run: python Tools/check-c-api-docs/main.py
Loading