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
34 changes: 34 additions & 0 deletions .github/actions/check-docs-only/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Check Docs Only Changes'
description: 'Check if only documentation files were changed'
outputs:
docs-only:
description: "True if only documentation files were changed"
value: ${{ steps.check.outputs.docs_only }}
runs:
using: "composite"
steps:
- name: Check if only docs changed
id: check
shell: bash
run: |
# Determine the base SHA for comparison
if [ "${{ github.event_name }}" = "pull_request" ]; then
# For PRs, compare against the base branch
BASE_SHA="${{ github.event.pull_request.base.sha }}"
FILES_CHANGED=$(git diff --name-only "${BASE_SHA}"...HEAD)
else
# For pushes, compare with previous commit
FILES_CHANGED=$(git diff --name-only HEAD~1...HEAD 2>/dev/null || echo "")
Comment on lines +14 to +21

Choose a reason for hiding this comment

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

[P1] Diff all commits when skipping checks on push

The composite action only compares HEAD~1...HEAD for push events, so a push containing multiple commits will examine only the last commit. If a developer pushes a code change followed by a documentation change in the same push, the workflow reports docs_only=true based solely on the final commit and all test/clippy/udeps jobs are skipped even though code was modified in the earlier commit. To cover the whole push you need to diff github.event.before (or the merge base) against github.sha.

Useful? React with 👍 / 👎.

fi

# Check if all changed files are in docs/ directory
if [ -z "$FILES_CHANGED" ]; then
echo "docs_only=false" >> $GITHUB_OUTPUT
echo "No files changed"
elif echo "$FILES_CHANGED" | grep -vE '^docs/' > /dev/null; then
echo "docs_only=false" >> $GITHUB_OUTPUT
echo "Non-documentation files changed"
else
echo "docs_only=true" >> $GITHUB_OUTPUT
echo "All changes are in docs/ folder, checks will pass automatically"
fi
56 changes: 51 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,34 @@ env:
RUST_BACKTRACE: 1

jobs:
# Detection job that runs first and determines if only docs changed
detect-docs-only:
name: Detect docs-only changes
runs-on: ubuntu-latest
outputs:
docs-only: ${{ steps.docs-check.outputs.docs-only }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check for docs-only changes
id: docs-check
uses: ./.github/actions/check-docs-only

- name: Display detection result
run: |
if [[ "${{ steps.docs-check.outputs.docs-only }}" == "true" ]]; then
echo "📚 Documentation-only changes detected - expensive checks will be skipped"
else
echo "🔧 Code changes detected - all checks will run"
fi

test-macos:
name: macOS Integration Tests
runs-on: macos-15-xlarge

needs: detect-docs-only
if: needs.detect-docs-only.outputs.docs-only != 'true'
steps:
- uses: actions/checkout@v4

Expand All @@ -41,7 +65,8 @@ jobs:
test-linux:
name: Linux Tests
runs-on: [self-hosted, linux]

needs: detect-docs-only
if: needs.detect-docs-only.outputs.docs-only != 'true'
steps:
- name: Fix permissions from previous runs
run: |
Expand All @@ -55,6 +80,7 @@ jobs:
if [ -d /home/ci/.cargo ]; then
sudo chown -R ci:ci /home/ci/.cargo || true
fi

- uses: actions/checkout@v4

- name: Install Rust
Expand Down Expand Up @@ -120,10 +146,11 @@ jobs:
clippy:
name: Clippy (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: detect-docs-only
if: needs.detect-docs-only.outputs.docs-only != 'true'
strategy:
matrix:
os: [ubuntu-latest-8-cores, macos-latest]

steps:
- uses: actions/checkout@v4

Expand All @@ -144,7 +171,7 @@ jobs:
fmt:
name: Format
runs-on: ubuntu-latest-8-cores

# Format always runs - even for docs changes we want consistent formatting
steps:
- uses: actions/checkout@v4

Expand All @@ -165,7 +192,8 @@ jobs:
udeps:
name: Unused dependency check
runs-on: ubuntu-latest-8-cores

needs: detect-docs-only
if: needs.detect-docs-only.outputs.docs-only != 'true'
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -206,3 +234,21 @@ jobs:
echo "Unused dependencies detected"
exit 1
fi

# Single required job that depends on all others
# This should be the ONLY required status check in branch protection
all-checks-pass:
name: All checks pass
if: always()
needs:
- test-macos
- test-linux
- clippy
- fmt
- udeps
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}