Skip to content

Commit

Permalink
Update reusable workflow to have test results as output
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcl committed Aug 12, 2024
1 parent 646ca45 commit 67fa16d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ runner-test-matrix:
test_env_type: docker
runs_on: ubuntu-latest
workflows:
- Run PR E2E Tests 2
- Run PR E2E Tests 3
- Run Nightly E2E Tests
test_cmd: cd integration-tests/smoke && go test -test.run ^TestLogPollerWithChaosFixedDepth$ -test.parallel=1 -timeout 30m -count=1 -json
pyroscope_env: ci-smoke-log_poller-evm-simulated
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ jobs:
with:
chainlink_version: ${{ inputs.evm-ref || github.sha }}
chainlink_upgrade_version: ${{ github.sha }}
test_workflow: Run PR E2E Tests 2
test_workflow: Run PR E2E Tests 3
upload_cl_node_coverage_artifact: true
upload_cl_node_coverage_artifact_prefix: cl_node_coverage_data_
# slack_notification_after_tests: true
Expand All @@ -268,7 +268,14 @@ jobs:
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_OIDC_IAM_ROLE_VALIDATION_PROD_ARN: ${{ secrets.AWS_OIDC_IAM_ROLE_VALIDATION_PROD_ARN }}
AWS_API_GW_HOST_GRAFANA: ${{ secrets.AWS_API_GW_HOST_GRAFANA }}
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}

send-slack-notification-for-migration-tests:
name: Send Slack Notification for Migration Tests
runs-on: ubuntu-latest
needs: call-run-e2e-tests-workflow
steps:
- run: echo ${{ needs.call-run-e2e-tests-workflow.outputs.test_results }}

# eth-smoke-tests-matrix-automation:
# if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') }}
Expand Down
39 changes: 38 additions & 1 deletion .github/workflows/run-e2e-tests-reusable-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ on:
description: 'Prefix for the Chainlink node coverage artifact'
required: false
type: string
outputs:
test_results:
description: 'Test results from all executed tests'
value: ${{ jobs.after_tests.outputs.test_results }}
secrets:
TEST_SECRETS_OVERRIDE_BASE64:
required: false
Expand Down Expand Up @@ -430,6 +434,7 @@ jobs:
duplicate-authorization-header: "true"

- name: Run tests
id: run_tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fdaf56b1df7248d18e30ad09982d03ec67d6b71c # v2.3.29
env:
DETACH_RUNNER: true
Expand Down Expand Up @@ -495,6 +500,20 @@ jobs:
path: .covdata
retention-days: 1

- name: Record test result
if: ${{ always() }}
run: |
id=${{ matrix.tests.id_sanitized }}
result="${{ steps.run_tests.outcome }}"
echo "{\"id\": \"$id\", \"result\": \"$result\"}" > test_result.json
- name: Upload test result as artifact
uses: actions/upload-artifact@v3
with:
name: test_result_${{ matrix.tests.id_sanitized }}
path: test_result.json


# TODO: move to run-tests GHA
- name: Print failed test summary
if: always()
Expand Down Expand Up @@ -579,6 +598,7 @@ jobs:
echo "Remote Runner Version: ${{ needs.prepare-remote-runner-test-image.outputs.remote-runner-version }}"
- name: Run tests
id: run_tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fdaf56b1df7248d18e30ad09982d03ec67d6b71c # v2.3.29
env:
DETACH_RUNNER: true
Expand Down Expand Up @@ -643,8 +663,25 @@ jobs:
if: always()
name: After tests notifications
runs-on: ubuntu-latest
outputs:
test_results: ${{ steps.set_test_results.outputs.combined_results }}
steps:
- name: Determine combined test results
- name: Download all test result artifacts
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
with:
path: test_results
pattern: test_result_*
merge-multiple: true

- name: Set test results output
id: set_test_results
run: |
ls -R test_results
jq -s add test_results/test_result_*.json > combined_results.json
jq . combined_results.json
echo "combined_results=$(jq -c . combined_results.json)" >> $GITHUB_OUTPUT
- name: Determine combined job results
id: combine_results
run: |
docker_result="${{ needs.run-docker-tests.result }}"
Expand Down

0 comments on commit 67fa16d

Please sign in to comment.