-
Notifications
You must be signed in to change notification settings - Fork 153
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
feature/workflow_dispatch to test contributors code #650
Conversation
WalkthroughThe pull request introduces a new GitHub Actions workflow file Changes
Sequence DiagramsequenceDiagram
participant Workflow as GitHub Actions
participant Tests as Python Tests
participant Slack as Slack Notification
participant Binaries as Binary Builder
Workflow->>Tests: Trigger Tests
Tests-->>Workflow: Test Results
alt Test Success
Workflow->>Slack: Send Notification
Workflow->>Binaries: Build Binaries
Binaries-->>Workflow: Artifact Generation
end
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/contributer_action.yml (2)
1-5
: Fix spelling in filename and consider additional triggersThe workflow filename contains a spelling error ("contributer" should be "contributor"). Additionally, consider adding
pull_request
trigger for automated testing of PRs.name: Python Package - Contributor on: workflow_dispatch: + pull_request: + branches: [ main ]
28-37
: Enhance Slack notifications with more contextThe notification job could be improved with better error handling and more informative messages.
notify: needs: test runs-on: ubuntu-20.04 if: contains(fromJson('["refs/heads/main", "refs/heads/binaries-fixes"]'), github.ref) || startsWith(github.ref, 'refs/tags') steps: - name: Slack trigger - uses: slackapi/slack-github-action@v1.23.0 + uses: slackapi/slack-github-action@v1.24.0 env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + with: + payload: | + { + "text": "Tests completed for ${{ github.repository }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Build Status:* ${{ job.status }}\n*Ref:* ${{ github.ref }}\n*Commit:* ${{ github.sha }}" + } + } + ] + } + continue-on-error: true
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/contributer_action.yml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/contributer_action.yml
13-13: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
15-15: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
47-47: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
49-49: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
58-58: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
64-64: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
70-70: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
76-76: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🔇 Additional comments (1)
.github/workflows/contributer_action.yml (1)
38-81
: 🛠️ Refactor suggestion
Improve binary build process reliability and maintainability
Several improvements could enhance the binary build process:
- Add retry mechanism for flaky builds
- Document Python version requirement
- DRY up artifact upload configurations
- Verify binaries.py script existence
build-binaries:
needs: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['windows-latest', 'ubuntu-20.04', 'macos-latest']
env:
BINARY_OS: '${{ matrix.os }}'
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
+ - name: Verify binaries.py
+ run: |
+ if [ ! -f "binaries.py" ]; then
+ echo "Error: binaries.py not found!"
+ exit 1
+ fi
- - name: Set up Python
- uses: actions/setup-python@v4
+ - uses: actions/setup-python@v5
with:
python-version: '3.10' # Required version for binary generation
- name: Install Dependencies
- run: python binaries.py install
+ uses: nick-fields/retry@v2
+ with:
+ timeout_minutes: 10
+ max_attempts: 3
+ command: python binaries.py install
- name: Test Safety
run: python binaries.py test
- name: Producing Binaries
run: python binaries.py dist
- - uses: actions/upload-artifact@v3
- if: ${{ matrix.os == 'windows-latest' }}
- with:
- name: safety-win-i686.exe
- path: dist/safety-win-i686.exe
- if-no-files-found: error
- - uses: actions/upload-artifact@v3
- if: ${{ matrix.os == 'windows-latest' }}
- with:
- name: safety-win-x86_64.exe
- path: dist/safety-win-x86_64.exe
- if-no-files-found: error
- - uses: actions/upload-artifact@v3
- if: ${{ matrix.os == 'ubuntu-20.04' }}
- with:
- name: safety-linux-x86_64
- path: dist/safety-linux-x86_64
- if-no-files-found: error
- - uses: actions/upload-artifact@v3
- if: ${{ matrix.os == 'macos-latest' }}
- with:
- name: safety-macos-x86_64
- path: dist/safety-macos-x86_64
- if-no-files-found: error
+ - name: Upload Binary Artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ matrix.os == 'windows-latest' && format('safety-win-{0}', contains(github.ref, 'i686') && 'i686.exe' || 'x86_64.exe') || matrix.os == 'ubuntu-20.04' && 'safety-linux-x86_64' || 'safety-macos-x86_64' }}
+ path: dist/${{ matrix.os == 'windows-latest' && format('safety-win-{0}', contains(github.ref, 'i686') && 'i686.exe' || 'x86_64.exe') || matrix.os == 'ubuntu-20.04' && 'safety-linux-x86_64' || 'safety-macos-x86_64' }}
+ if-no-files-found: error
🧰 Tools
🪛 actionlint (1.7.4)
47-47: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
49-49: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
58-58: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
64-64: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
70-70: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
76-76: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This workflow will allow us to test contributors code changes without exposing secrets or uploading to our services.
https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow
Summary by CodeRabbit
New Features
Improvements