-
Notifications
You must be signed in to change notification settings - Fork 0
flaky: container-safe flaky-filter + record-results; add stale (max adoptability) #2
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 all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f02e60d
flaky: add container-safe flaky-filter; make record-results container…
kei-nan 088997e
flaky-filter: add all-quarantined output
kei-nan 94d84fb
flaky-filter: only flag all-quarantined when there were valid tests
kei-nan af541ba
stale: close messages reflect the configured days-before-close
kei-nan 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,134 @@ | ||
| name: Filter flaky tests from a test list | ||
| description: | | ||
| Fetch active flaky marks for the current branch from the REPO/BRANCH-keyed | ||
| flaky DB and filter them out of a caller-provided test-id list, emitting the | ||
| path to a filtered TESTFILE the runner can consume. | ||
|
|
||
| The caller enumerates its own tests (that step is product-specific, e.g. | ||
| `LIST=1 make pytest`) and passes the list as `tests`. This action only does | ||
| the generic fetch + filter, so it stays framework/product agnostic. | ||
|
|
||
| Fail-open: emits an empty `testfile` when there are no active marks, when the | ||
| DB is unset/unreachable, or on any error — callers treat empty as "run the | ||
| full suite". When marks exist and they filter out *every* enumerated test, the | ||
| `all-quarantined` output is `true` so the caller can choose to skip the shard | ||
| entirely (an empty TESTFILE alone can't express "run nothing"). | ||
|
|
||
| Container-safe: the DB CLI is fetched into the (mounted) workspace via checkout, | ||
| since github.action_path is not mounted in container jobs. | ||
|
|
||
| inputs: | ||
| redis-url: | ||
| description: "Redis connection URL (rediss://...). No marks fetched if empty." | ||
| required: true | ||
| tests: | ||
| description: "Path to the enumerated test-id list (one RLTest id per line)." | ||
| required: true | ||
| output: | ||
| description: "Path to write the filtered TESTFILE." | ||
| required: true | ||
| branch: | ||
| description: "Branch to fetch marks for. Defaults to the PR / merge-queue target." | ||
| required: false | ||
| default: "" | ||
| ci-common-ref: | ||
| description: "Ref of redisearch-ci-common to fetch the DB CLI from (match your pin)." | ||
| required: false | ||
| default: v1 | ||
|
|
||
| outputs: | ||
| testfile: | ||
| description: "Filtered TESTFILE path; empty if no marks or any step failed." | ||
| value: ${{ steps.filter.outputs.testfile }} | ||
| all-quarantined: | ||
| description: > | ||
| 'true' when active marks filtered out every enumerated test (the filtered | ||
| set is empty). Callers can skip the test step entirely in that case. | ||
| 'false' otherwise (no marks, partial filter, or any error). | ||
| value: ${{ steps.filter.outputs.all-quarantined }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Resolve target branch | ||
| shell: bash -l -eo pipefail {0} | ||
| env: | ||
| OVERRIDE: ${{ inputs.branch }} | ||
| MERGE_GROUP_BASE: ${{ github.event.merge_group.base_ref }} | ||
| BASE_REF: ${{ github.base_ref }} | ||
| REF_NAME: ${{ github.ref_name }} | ||
| run: | | ||
| if [ -n "$OVERRIDE" ]; then | ||
| branch="$OVERRIDE" | ||
| elif [ -n "$MERGE_GROUP_BASE" ]; then | ||
| branch="${MERGE_GROUP_BASE#refs/heads/}" | ||
| elif [ -n "$BASE_REF" ]; then | ||
| branch="$BASE_REF" | ||
| else | ||
| branch="$REF_NAME" | ||
| fi | ||
| echo "Resolved flaky target branch: $branch" | ||
| echo "FLAKY_BRANCH=$branch" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Fetch shared flaky DB CLI | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: redislabsdev/redisearch-ci-common | ||
| ref: ${{ inputs.ci-common-ref }} | ||
| path: .redisearch-ci-common | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.x" | ||
|
|
||
| - name: Install dependencies | ||
| shell: bash -l -eo pipefail {0} | ||
| run: python3 -m pip install 'redis>=6,<7' | ||
|
|
||
| - name: Fetch marks and filter | ||
| id: filter | ||
| shell: bash -l -eo pipefail {0} | ||
| env: | ||
| REDIS_URL: ${{ inputs.redis-url }} | ||
| REPO: ${{ github.repository }} | ||
| BRANCH: ${{ env.FLAKY_BRANCH }} | ||
| TESTS: ${{ inputs.tests }} | ||
| OUTPUT: ${{ inputs.output }} | ||
| run: | | ||
| cli="$GITHUB_WORKSPACE/.redisearch-ci-common/scripts/ci_common/flaky_db.py" | ||
| marks="$RUNNER_TEMP/flaky_marks.txt" | ||
| # Fail-open: a DB outage must not break the test pipeline. | ||
| python3 "$cli" fetch --output-json "$RUNNER_TEMP/flaky_marks.json" --output-list "$marks" || \ | ||
| echo "::warning::flaky fetch failed; running the full suite" | ||
| : > "$OUTPUT" | ||
| all_quarantined=false | ||
| if [ -s "$marks" ]; then | ||
| if python3 "$cli" filter --tests "$TESTS" --marks "$marks" --output "$OUTPUT"; then | ||
| if [ ! -s "$OUTPUT" ]; then | ||
| # Output empty: distinguish "every valid test was quarantined" from | ||
| # "the input had no valid test ids at all". Re-filter with no marks | ||
| # (same code path, so the same id-validation applies) to get the set | ||
| # of tests that *would* run; only call it all-quarantined if that | ||
| # baseline was non-empty. | ||
| empty_marks="$RUNNER_TEMP/flaky_empty_marks.txt"; : > "$empty_marks" | ||
| baseline="$RUNNER_TEMP/flaky_baseline.txt" | ||
| python3 "$cli" filter --tests "$TESTS" --marks "$empty_marks" --output "$baseline" || : > "$baseline" | ||
| if [ -s "$baseline" ]; then | ||
| all_quarantined=true | ||
| echo "::notice::All enumerated tests are quarantined for this shard." | ||
| fi | ||
| fi | ||
| else | ||
| : > "$OUTPUT" # filter error ⇒ fail-open (full suite) | ||
| fi | ||
| else | ||
| echo "No active flaky marks — running the full suite" | ||
| fi | ||
| if [ -s "$OUTPUT" ]; then | ||
| echo "testfile=$OUTPUT" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "testfile=" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| echo "all-quarantined=$all_quarantined" >> "$GITHUB_OUTPUT" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: Stale issues and PRs (reusable) | ||
|
|
||
| # Reusable wrapper around actions/stale with sensible defaults. Opt-in: only | ||
| # repos that track work in GitHub issues/PRs (e.g. the public repo) need call it | ||
| # via a thin `on: schedule` caller. Tunables are overridable via inputs. | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| days-before-stale: | ||
| type: number | ||
| default: 60 | ||
| days-before-close: | ||
| type: number | ||
| default: -1 | ||
| operations-per-run: | ||
| type: number | ||
| default: 1000 | ||
| runs-on: | ||
| type: string | ||
| default: ubuntu-latest | ||
|
|
||
| jobs: | ||
| stale: | ||
| runs-on: ${{ inputs.runs-on }} | ||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/stale@v10 | ||
| with: | ||
| days-before-stale: ${{ inputs.days-before-stale }} | ||
| days-before-close: ${{ inputs.days-before-close }} | ||
| stale-issue-label: "stale" | ||
| stale-issue-message: "This issue is stale because it has been open for ${{ inputs.days-before-stale }} days with no activity." | ||
| close-issue-message: "This issue was closed because it has been inactive for ${{ inputs.days-before-close }} days since being marked as stale." | ||
| stale-pr-label: "stale" | ||
| stale-pr-message: "This pull request is stale because it has been open for ${{ inputs.days-before-stale }} days with no activity." | ||
| close-pr-message: "This pull request was closed because it has been inactive for ${{ inputs.days-before-close }} days since being marked as stale." | ||
| operations-per-run: ${{ inputs.operations-per-run }} |
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.
Uh oh!
There was an error while loading. Please reload this page.