-
Notifications
You must be signed in to change notification settings - Fork 0
feat: generic e2e reusable workflow with auto-detection #15
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
Open
lcian
wants to merge
1
commit into
main
Choose a base branch
from
feat/generic-e2e-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+336
−1
Open
Changes from all commits
Commits
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,96 @@ | ||
| name: "E2E benchmarks" | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| language: | ||
| description: "Language to benchmark (auto-detected from repo name if not provided)" | ||
| required: false | ||
| type: string | ||
| sdk-version: | ||
| description: "SDK version (resolves latest if not provided)" | ||
| required: false | ||
| type: string | ||
| iterations: | ||
| description: "Number of benchmark iterations" | ||
| required: false | ||
| type: number | ||
| default: 1 | ||
| post-comment: | ||
| description: "Post results as a PR comment" | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
| workflow_dispatch: | ||
| inputs: | ||
| language: | ||
| description: "Language to benchmark (e.g. go, python)" | ||
| required: true | ||
| sdk-version: | ||
| description: "SDK version (e.g. 0.42.0 or latest)" | ||
| default: "latest" | ||
|
|
||
| jobs: | ||
| discover: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| matrix: ${{ steps.matrix.outputs.apps }} | ||
| sdk-version: ${{ steps.version.outputs.sdk-version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install bench CLI | ||
| run: pip install -e . | ||
|
|
||
| - name: Detect language | ||
| id: lang | ||
| env: | ||
| INPUT_LANGUAGE: ${{ inputs.language }} | ||
| CALLER_REPO: ${{ github.repository }} | ||
| run: | | ||
| if [ -n "$INPUT_LANGUAGE" ]; then | ||
| echo "language=$INPUT_LANGUAGE" >> "$GITHUB_OUTPUT" | ||
| else | ||
| # Extract language from repo name: getsentry/sentry-go → go | ||
| REPO_NAME="${CALLER_REPO##*/}" | ||
| LANGUAGE="${REPO_NAME#sentry-}" | ||
| echo "language=$LANGUAGE" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Resolve SDK version | ||
| id: version | ||
| env: | ||
| INPUT_VERSION: ${{ inputs.sdk-version }} | ||
| LANGUAGE: ${{ steps.lang.outputs.language }} | ||
| run: | | ||
| if [ -n "$INPUT_VERSION" ] && [ "$INPUT_VERSION" != "latest" ]; then | ||
| echo "sdk-version=$INPUT_VERSION" >> "$GITHUB_OUTPUT" | ||
| else | ||
| VERSION=$(bench resolve-version "$LANGUAGE") | ||
| echo "sdk-version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Build matrix | ||
| id: matrix | ||
| env: | ||
| LANGUAGE: ${{ steps.lang.outputs.language }} | ||
| run: | | ||
| APPS=$(bench list-apps "$LANGUAGE") | ||
| echo "apps=$APPS" >> "$GITHUB_OUTPUT" | ||
|
|
||
| bench: | ||
| needs: discover | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| app: ${{ fromJSON(needs.discover.outputs.matrix) }} | ||
| uses: ./.github/workflows/benchmark.yml | ||
| with: | ||
| app: ${{ matrix.app }} | ||
| sdk-version: ${{ needs.discover.outputs.sdk-version }} | ||
| iterations: ${{ inputs.iterations || 1 }} | ||
| post-comment: ${{ inputs.post-comment == '' && true || inputs.post-comment }} | ||
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
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.
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.
Boolean false coerced to true by loose equality
High Severity
The expression
inputs.post-comment == ''matches booleanfalsein addition to empty/unset values, because GitHub Actions'==operator coerces bothfalseand''to the number0before comparing. When aworkflow_callcaller explicitly passespost-comment: false, the expression evaluates totrue, making it impossible to disable PR comment posting. A safer approach would useinputs.post-comment != ''withfromJSON()or handle the boolean type directly.