Skip to content

Pre Checkin

Pre Checkin #7

Workflow file for this run

name: Pre Checkin
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [main] # Triggers on PRs targeting `main`
paths-ignore:
- '**/*.md'
- 'docs/**'
- 'LICENSE'
- '.gitignore'
workflow_dispatch:
schedule:
- cron: '0 22 * * *' # 6:00 AM Beijing Time (UTC+8)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
black:
name: Check Code Style with Black
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Describe Pre Checkin scope
run: |
echo "Pre Checkin is the shared gate for lightweight validation before GPU CI starts."
echo "Future fast, non-GPU checks can be added here so Native and OOT reuse one result."
- name: Run Black
uses: psf/black@stable
ruff:
name: Check Code Style with Ruff
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python environment
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip3 install ruff
- name: Install reviewdog
uses: reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893
- name: Run ruff with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ruff check . \
--output-format=rdjson \
--exit-zero \
--no-fix \
| reviewdog \
-f=rdjson \
-name="ruff" \
-reporter=github-pr-review \
-filter-mode=diff_context \
-fail-on-error=true
upload-success-artifact:
name: Upload Success Signal
runs-on: ubuntu-latest
needs: [black, ruff]
if: ${{ needs.black.result == 'success' && needs.ruff.result == 'success' }}
steps:
- name: Create success signal file
run: echo "success" > checks_signal.txt
- name: Upload success artifact
uses: actions/upload-artifact@v4
with:
name: checks-signal-${{ github.sha }}
path: checks_signal.txt
upload-failure-artifact:
name: Upload Failure Signal
runs-on: ubuntu-latest
needs: [black, ruff]
if: ${{ always() && (needs.black.result != 'success' || needs.ruff.result != 'success') }}
steps:
- name: Create failure signal file with failed jobs
run: |
echo "failure" > checks_signal.txt
if [ "${{ needs.black.result }}" != "success" ]; then
echo "FAILED: black (${{ needs.black.result }})" >> checks_signal.txt
fi
if [ "${{ needs.ruff.result }}" != "success" ]; then
echo "FAILED: ruff (${{ needs.ruff.result }})" >> checks_signal.txt
fi
- name: Upload failure artifact
uses: actions/upload-artifact@v4
with:
name: checks-signal-${{ github.sha }}
path: checks_signal.txt