Skip to content
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

Add Flakeguard metadata #15640

Merged
merged 12 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/flakeguard-on-demand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ on:
description: 'The path to the project to run the flaky test detection.'
default: '.'
baseRef:
required: true
required: false
type: string
description: 'The base reference or branch to compare changes for detecting flaky tests.'
default: 'origin/develop'
description: 'The base reference or branch to compare changes for detecting flaky tests. Set only when running diffs between branches. E.g. (develop)'
headRef:
required: false
type: string
description: 'The head reference or branch to compare changes for detecting flaky tests. Default is the current branch.'
description: 'The head reference or branch to compare changes for detecting flaky tests. Default is the current branch. E.g. (develop)'
runAllTests:
required: false
type: boolean
Expand Down
39 changes: 32 additions & 7 deletions .github/workflows/flakeguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
baseRef:
required: false
type: string
description: 'The base reference or branch to compare changes for detecting flaky tests.'
description: 'The base reference or branch to compare changes for detecting flaky tests. Set only when running diffs between branches. E.g. (develop)'
headRef:
required: false
type: string
description: 'The head reference or branch to compare changes for detecting flaky tests. Default is the current branch.'
description: 'The head reference or branch to compare changes for detecting flaky tests. Default is the current branch. E.g. (develop)'
runAllTests:
required: false
type: boolean
Expand Down Expand Up @@ -56,6 +56,7 @@
required: true

env:
GIT_BASE_REF: ${{ inputs.baseRef }}
GIT_HEAD_REF: ${{ inputs.headRef || github.ref }}
SKIPPED_TESTS: ${{ fromJSON(inputs.extraArgs)['skipped_tests'] || '' }} # Comma separated list of test names to skip running in the flaky detector. Related issue: TT-1823
DEFAULT_MAX_RUNNER_COUNT: ${{ fromJSON(inputs.extraArgs)['default_max_runner_count'] || '8' }} # The default maximum number of GitHub runners to use for parallel test execution.
Expand All @@ -80,29 +81,49 @@
affected_test_packages: ${{ steps.get-tests.outputs.packages }}
git_head_sha: ${{ steps.get_commit_sha.outputs.git_head_sha }}
git_head_short_sha: ${{ steps.get_commit_sha.outputs.git_head_short_sha }}
git_base_sha: ${{ steps.get_commit_sha.outputs.git_base_sha }}
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0
ref: ${{ env.GIT_HEAD_REF }}

- name: Get commit SHA
- name: Get SHA
id: get_commit_sha
run: |
# Resolve HEAD SHA
git_head_sha=$(git rev-parse HEAD)
git_head_short_sha=$(git rev-parse --short HEAD)
echo "git_head_sha=$git_head_sha" >> $GITHUB_OUTPUT
echo "git_head_short_sha=$git_head_short_sha" >> $GITHUB_OUTPUT

# Print HEAD SHAs to the console
echo "HEAD SHA: $git_head_sha"
echo "HEAD Short SHA: $git_head_short_sha"

# Conditionally resolve BASE SHA
if [ -n "${{ env.GIT_BASE_REF }}" ]; then
git fetch origin ${{ env.GIT_BASE_REF }} --quiet

git_base_sha=$(git rev-parse origin/${{ env.GIT_BASE_REF }})
echo "git_base_sha=$git_base_sha" >> $GITHUB_OUTPUT

# Print BASE SHA to the console
echo "BASE SHA: $git_base_sha"
else
echo "BASE SHA not provided."
echo "git_base_sha=" >> $GITHUB_OUTPUT
fi

- name: Set up Go 1.21.9
uses: actions/[email protected]
with:
cache: false

- name: Install flakeguard
shell: bash
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@404e04e1e2e2dd5a384b09bd05b8d80409b6609a # [email protected]
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@ccfea1bcfab12eb8cac98b3007b08440deb1db25 # [email protected]

- name: Find new or updated test packages
if: ${{ inputs.runAllTests == false }}
Expand Down Expand Up @@ -261,7 +282,7 @@

- name: Install flakeguard
shell: bash
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@404e04e1e2e2dd5a384b09bd05b8d80409b6609a # [email protected]
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@ccfea1bcfab12eb8cac98b3007b08440deb1db25 # [email protected]

- name: Run tests with flakeguard
shell: bash
Expand All @@ -281,7 +302,7 @@
needs: [get-tests, run-tests]
if: always()
name: Report
runs-on: ubuntu22.04-32cores-128GB # Use a runner with more resources to avoid OOM errors when aggregating test results.

Check failure on line 305 in .github/workflows/flakeguard.yml

View workflow job for this annotation

GitHub Actions / Validate Workflow Changes

1. This Ubuntu runner is 8-16 more expensive than a base Ubuntu runner. Consider using a smaller Ubuntu runner. (runner-ubuntu / error)
outputs:
test_results: ${{ steps.results.outputs.results }}
steps:
Expand All @@ -308,7 +329,7 @@

- name: Install flakeguard
shell: bash
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@404e04e1e2e2dd5a384b09bd05b8d80409b6609a # [email protected]
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@ccfea1bcfab12eb8cac98b3007b08440deb1db25 # [email protected]

- name: Aggregate Flakeguard Results
id: results
Expand All @@ -329,7 +350,11 @@
--output-path ./flakeguard-report \
--repo-path "${{ github.workspace }}" \
--codeowners-path "${{ github.workspace }}/.github/CODEOWNERS" \
--max-pass-ratio "${{ inputs.maxPassRatio }}"
--max-pass-ratio "${{ inputs.maxPassRatio }}" \
--repo-url "${{ inputs.repoUrl }}" \
--base-sha "${{ needs.get-tests.outputs.git_base_sha }}" \
--head-sha "${{ needs.get-tests.outputs.git_head_sha }}" \
--github-workflow-name "${{ github.workflow }}"

# Print out the summary file
echo -e "\nFlakeguard Summary:"
Expand Down
Loading