-
Notifications
You must be signed in to change notification settings - Fork 421
CI: Add pre-check status check #1252
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
087fe99
CI: Add pre-check status check
gyohuangxin d76f1ca
Revert "CI: Add pre-check status check"
gyohuangxin 7b972d8
CI: Move all pre checks to one yaml file
gyohuangxin 009f5b6
Updates
gyohuangxin 59beb93
Updates
gyohuangxin 0216e68
Updates
gyohuangxin 1cf00ca
Test
gyohuangxin fabf340
Update setup.py
gyohuangxin 985a0e5
Apply suggestion from @Copilot
gyohuangxin ba59278
Optimize
gyohuangxin 8964085
Merge branch 'main' into precheck_status_check
gyohuangxin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| ARTIFACT_NAME="checks-signal-${GITHUB_SHA:-${1}}" | ||
| MAX_RETRIES=5 | ||
|
|
||
| for i in $(seq 1 $MAX_RETRIES); do | ||
| echo "Attempt $i: Downloading artifact..." | ||
| if gh run download --name "$ARTIFACT_NAME"; then | ||
| if [ -f checks_signal.txt ]; then | ||
| echo "Artifact $ARTIFACT_NAME downloaded successfully." | ||
| SIGNAL=$(head -n 1 checks_signal.txt) | ||
| if [ "$SIGNAL" = "success" ]; then | ||
| echo "Pre-checks passed, continuing workflow." | ||
| exit 0 | ||
| else | ||
| echo "Pre-checks failed, skipping workflow. Details:" | ||
| tail -n +2 checks_signal.txt | ||
| exit 78 # 78 = neutral/skip | ||
| fi | ||
| fi | ||
| fi | ||
| echo "Artifact not found, retrying in 30s..." | ||
| sleep 30 | ||
| done | ||
|
|
||
| echo "Failed to download pre-checks artifact after $MAX_RETRIES attempts. Exiting workflow." | ||
| exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| name: Checks | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
|
|
||
| jobs: | ||
| check-ck: | ||
| name: Check Repository Dependency | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: 'recursive' | ||
|
|
||
| - name: Verify 3rdparty commits | ||
| run: ./.github/scripts/check_deps.sh | ||
|
|
||
| black: | ||
| name: Check Code Style with Black | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - 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@v4 | ||
| - name: Set up Python environment | ||
| uses: actions/setup-python@v2 | ||
| 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 . -e | reviewdog -efm="%f:%l:%c: %m" -diff="git diff FETCH_HEAD" -reporter=github-pr-check -tee | ||
|
|
||
| upload-success-artifact: | ||
| name: Upload Success Signal | ||
| runs-on: ubuntu-latest | ||
| needs: [check-ck, black, ruff] | ||
| if: ${{ success() }} | ||
|
gyohuangxin marked this conversation as resolved.
Outdated
|
||
| 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: [check-ck, black, ruff] | ||
| if: ${{ failure() }} | ||
|
gyohuangxin marked this conversation as resolved.
Outdated
|
||
| steps: | ||
| - name: Create failure signal file with failed jobs | ||
| run: | | ||
| echo "failure" > checks_signal.txt | ||
| if [ "${{ needs.check-ck.result }}" != "success" ]; then | ||
| echo "FAILED: check-ck (${{ needs.check-ck.result }})" >> checks_signal.txt | ||
| fi | ||
| 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 | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.