Skip to content

Commit

Permalink
Fix nightly flakeguard job (#15485)
Browse files Browse the repository at this point in the history
* Add separate job for nightly flakeguard workflow

* trigger

* fix

* fix

* Fix

* Fix codeowners issue

* Fix all tests path

* Fix

* bump flakeguard to fix codeowners
  • Loading branch information
lukaszcl authored Dec 3, 2024
1 parent 9853e32 commit c4b8d4a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/flakeguard-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Flakeguard Nightly

on:
schedule:
# Run every night at 3:00 AM UTC
- cron: '0 3 * * *'
workflow_dispatch:

jobs:
trigger-flaky-test-detection:
name: Find Flaky Tests
uses: ./.github/workflows/flakeguard.yml
with:
repoUrl: 'https://github.com/smartcontractkit/chainlink'
baseRef: 'origin/develop'
projectPath: '.'
maxPassRatio: '1.0'
runAllTests: true
extraArgs: '{ "skipped_tests": "TestChainComponents", "test_repeat_count": "5", "all_tests_runner": "ubuntu22.04-32cores-128GB", "all_tests_runner_count": "3", "run_with_race": "false" }'
slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications
secrets:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
3 changes: 0 additions & 3 deletions .github/workflows/flakeguard-on-demand.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Flakeguard On Demand

on:
schedule:
# Run every night at 3:00 AM UTC
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
repoUrl:
Expand Down
26 changes: 16 additions & 10 deletions .github/workflows/flakeguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:

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

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

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

- name: Run tests with flakeguard
shell: bash
Expand All @@ -283,6 +283,11 @@ jobs:
outputs:
test_results: ${{ steps.set_test_results.outputs.results }}
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ env.GIT_HEAD_REF }}

- name: Set Pretty Project Path
id: set_project_path_pretty
run: |
Expand All @@ -295,37 +300,38 @@ jobs:
- name: Download all test result artifacts
uses: actions/[email protected]
with:
path: test_results
path: ci_test_results
pattern:
test-result-${{ needs.get-tests.outputs.workflow_id }}-*

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

- name: Set combined test results
id: set_test_results
shell: bash
run: |
set -e # Exit immediately if a command exits with a non-zero status.
if [ -d "test_results" ]; then
cd test_results
if [ -d "ci_test_results" ]; then
cd ci_test_results
ls -R .
# Fix flakeguard binary path
PATH=$PATH:$(go env GOPATH)/bin
export PATH
# Use flakeguard to aggregate all test results
flakeguard aggregate-results --results-path . --output-results ../all_tests.json
flakeguard aggregate-results --results-path . --output-results ../all_tests.json --project-path=${{ github.workspace }}/${{ inputs.projectPath }} --codeowners-path=${{ github.workspace }}/.github/CODEOWNERS
# Count all tests
ALL_TESTS_COUNT=$(jq '.Results | length' ../all_tests.json)
echo "All tests count: $ALL_TESTS_COUNT"
echo "all_tests_count=$ALL_TESTS_COUNT" >> "$GITHUB_OUTPUT"
# Use flakeguard to filter and output failed tests based on MaxPassRatio
flakeguard aggregate-results --filter-failed=true --max-pass-ratio=${{ inputs.maxPassRatio }} --results-path . --output-results ../failed_tests.json --output-logs ../failed_test_logs.json --project-path=${{ inputs.projectPath }} --codeowners-path=.github/CODEOWNERS
flakeguard aggregate-results --filter-failed=true --max-pass-ratio=${{ inputs.maxPassRatio }} --results-path . --output-results ../failed_tests.json --output-logs ../failed_test_logs.json --project-path=${{ github.workspace }}/${{ inputs.projectPath }} --codeowners-path=${{ github.workspace }}/.github/CODEOWNERS
# Count failed tests
if [ -f "../failed_tests.json" ]; then
Expand All @@ -342,7 +348,7 @@ jobs:
fi
- name: Tests Summary
if: always()
if: ${{ fromJson(steps.set_test_results.outputs.all_tests_count) > 0 }}
run: |
FILE_SIZE=$(wc -c < all_tests.md)
echo "File size: $FILE_SIZE bytes"
Expand Down Expand Up @@ -412,7 +418,7 @@ jobs:
script: |
const fs = require('fs');
const prNumber = context.payload.pull_request.number;
const commentBody = fs.readFileSync('../all_tests.md', 'utf8');
const commentBody = fs.readFileSync('all_tests.md', 'utf8');
await github.rest.issues.createComment({
owner: context.repo.owner,
Expand Down

0 comments on commit c4b8d4a

Please sign in to comment.