forked from smartcontractkit/chainlink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AUTO-3172] add automation-on-demand-tests GHA (smartcontractkit#9376)
- Loading branch information
1 parent
c1065c9
commit 186ed3c
Showing
2 changed files
with
182 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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,179 @@ | ||
name: Automation On Demand Tests | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
chainlinkVersion: | ||
description: Chainlink image version to use | ||
required: false | ||
type: string | ||
chainlinkImage: | ||
description: Chainlink image repo to use (Leave empty to build from head/ref) | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
build-chainlink: | ||
environment: integration | ||
permissions: | ||
id-token: write | ||
contents: read | ||
strategy: | ||
matrix: | ||
image: | ||
- name: "" | ||
dockerfile: core/chainlink.Dockerfile | ||
tag-suffix: "" | ||
- name: (plugins) | ||
dockerfile: plugins/chainlink.Dockerfile | ||
tag-suffix: -plugins | ||
name: Build Chainlink Image ${{ matrix.image.name }} | ||
runs-on: ubuntu20.04-16cores-64GB | ||
steps: | ||
- name: Collect Metrics | ||
if: inputs.chainlinkImage == '' | ||
id: collect-gha-metrics | ||
uses: smartcontractkit/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0 | ||
with: | ||
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | ||
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | ||
this-job-name: Build Chainlink Image ${{ matrix.image.name }} | ||
continue-on-error: true | ||
- name: Checkout the repo | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
with: | ||
ref: ${{ github.head_ref || github.ref_name }} | ||
- name: Check if image exists | ||
if: inputs.chainlinkImage == '' | ||
id: check-image | ||
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ab595504ae9cf10c60eb8d2c5ce025284e58b210 #v2.1.5 | ||
with: | ||
repository: chainlink | ||
tag: ${{ github.sha }}${{ matrix.image.tag-suffix }} | ||
AWS_REGION: ${{ secrets.QA_AWS_REGION }} | ||
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} | ||
- name: Build Image | ||
if: steps.check-image.outputs.exists == 'false' && inputs.chainlinkImage == '' | ||
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@2c9f401149f6c25fb632067b7e6626aebeee5d69 | ||
with: | ||
cl_repo: smartcontractkit/chainlink | ||
cl_ref: ${{ github.sha }} | ||
cl_dockerfile: ${{ matrix.image.dockerfile }} | ||
push_tag: ${{ env.CHAINLINK_IMAGE }}:${{ github.sha }}${{ matrix.image.tag-suffix }} | ||
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} | ||
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} | ||
- name: Print Chainlink Image Built | ||
if: inputs.chainlinkImage == '' | ||
run: | | ||
echo "### chainlink node image tag used for this test run :link:" >>$GITHUB_STEP_SUMMARY | ||
echo "\`${GITHUB_SHA}\`" >>$GITHUB_STEP_SUMMARY | ||
build-test-image: | ||
environment: integration | ||
permissions: | ||
id-token: write | ||
contents: read | ||
name: Build Test Image | ||
runs-on: ubuntu20.04-16cores-64GB | ||
steps: | ||
- name: Collect Metrics | ||
id: collect-gha-metrics | ||
uses: smartcontractkit/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0 | ||
with: | ||
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | ||
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | ||
this-job-name: Build Test Image | ||
continue-on-error: true | ||
- name: Checkout the repo | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
with: | ||
ref: ${{ github.head_ref || github.ref_name }} | ||
- name: Build Test Image | ||
uses: ./.github/actions/build-test-image | ||
with: | ||
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} | ||
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} | ||
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} | ||
|
||
automation-on-demand-tests: | ||
environment: integration | ||
permissions: | ||
checks: write | ||
pull-requests: write | ||
id-token: write | ||
contents: read | ||
needs: [ build-chainlink, build-test-image ] | ||
env: | ||
CHAINLINK_COMMIT_SHA: ${{ github.sha }} | ||
CHAINLINK_ENV_USER: ${{ github.actor }} | ||
TEST_LOG_LEVEL: debug | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
tests: | ||
- name: chaos | ||
nodes: 5 | ||
os: ubuntu-latest | ||
pyroscope_env: ci-automation-on-demand-chaos | ||
network: SIMULATED | ||
command: -run ^TestAutomationChaos$ ./chaos | ||
- name: reorg | ||
nodes: 1 | ||
os: ubuntu-latest | ||
pyroscope_env: ci-automation-on-demand-reorg | ||
network: SIMULATED_NONDEV | ||
command: -run ^TestAutomationReorg$ ./reorg | ||
runs-on: ${{ matrix.tests.os }} | ||
name: Automation On Demand ${{ matrix.tests.name }} Test | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
with: | ||
ref: ${{ github.head_ref || github.ref_name }} | ||
- name: Determine build to use | ||
id: determine-build | ||
shell: bash | ||
run: | | ||
if [[ "${{ inputs.chainlinkImage }}" == "" ]]; then | ||
echo "image=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink" >>$GITHUB_OUTPUT | ||
echo "version=${{ github.head_ref || github.ref_name }}" >>$GITHUB_OUTPUT | ||
else | ||
echo "image=${{ inputs.chainlinkImage }}" >>$GITHUB_OUTPUT | ||
echo "version=${{ inputs.chainlinkVersion }}" >>$GITHUB_OUTPUT | ||
fi | ||
- name: Run Tests | ||
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ab595504ae9cf10c60eb8d2c5ce025284e58b210 #v2.1.5 | ||
env: | ||
PYROSCOPE_SERVER: ${{ matrix.tests.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725 | ||
PYROSCOPE_ENVIRONMENT: ${{ matrix.tests.pyroscope_env }} | ||
PYROSCOPE_KEY: ${{ secrets.QA_PYROSCOPE_KEY }} | ||
SELECTED_NETWORKS: ${{ matrix.tests.network }} | ||
with: | ||
test_command_to_run: make test_need_operator_assets && cd ./integration-tests && go test -timeout 30m -count=1 -json -test.parallel=${{ matrix.tests.nodes }} ${{ matrix.tests.command }} 2>&1 | tee /tmp/gotest.log | gotestfmt | ||
test_download_vendor_packages_command: cd ./integration-tests && go mod download | ||
cl_repo: ${{ steps.determine-build.outputs.image }} | ||
cl_image_tag: ${{ steps.determine-build.outputs.version }} | ||
artifacts_location: ./integration-tests/${{ matrix.tests.name }}/logs | ||
publish_check_name: Automation On Demand Results ${{ matrix.tests.name }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
go_mod_path: ./integration-tests/go.mod | ||
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} | ||
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} | ||
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }} | ||
- name: Upload test log | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
if: failure() | ||
with: | ||
name: test-log-${{ matrix.tests.name }} | ||
path: /tmp/gotest.log | ||
retention-days: 7 | ||
continue-on-error: true | ||
- name: Collect Metrics | ||
if: always() | ||
id: collect-gha-metrics | ||
uses: smartcontractkit/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0 | ||
with: | ||
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | ||
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | ||
this-job-name: Automation On Demand ${{ matrix.tests.name }} Test | ||
test-results-file: '{"testType":"go","filePath":"/tmp/gotest.log"}' | ||
continue-on-error: true |
This file contains 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