Generic Test Runner #164
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
name: Generic Test Runner | |
on: | |
workflow_dispatch: | |
inputs: | |
network: | |
description: 'Network to run tests against' | |
required: true | |
default: 'SIMULATED' | |
wsURL: | |
description: 'Chain WS URL (Skip with SIMULATED)' | |
required: false | |
httpURL: | |
description: 'Chain HTTP URL (Skip with SIMULATED)' | |
required: false | |
fundingKey: | |
description: 'Private key to fund test (Skip with SIMULATED)' | |
required: false | |
directory: | |
description: 'Directory to run tests from' | |
required: true | |
default: 'smoke' | |
test: | |
description: 'Test to run' | |
required: true | |
default: 'OCRBasic' | |
testInputs: | |
description: 'Custom test inputs' | |
required: false | |
default: '' | |
env: | |
ENV_JOB_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-tests:${{ github.sha }} | |
CHAINLINK_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink | |
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: Checkout the repo | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
- name: Check if image exists | |
id: check-image | |
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 | |
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' | |
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 | |
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 | |
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 | |
env: | |
TEST_SUITE: ${{ github.event.inputs.directory }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
- 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 }} | |
test: | |
runs-on: ubuntu-latest | |
needs: [build-chainlink, build-test-image] | |
name: Run Test | |
environment: integration | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
CHAINLINK_ENV_USER: ${{ github.actor }} | |
CHAINLINK_COMMIT_SHA: ${{ github.sha }} | |
TEST_SUITE: ${{ github.event.inputs.directory }} | |
SELECTED_NETWORKS: ${{ github.event.inputs.network }} | |
TEST_LOG_LEVEL: debug | |
steps: | |
- name: Mask Inputs | |
run: | | |
EVM_URLS=$(jq -r '.inputs.wsURL' $GITHUB_EVENT_PATH) | |
EVM_HTTP_URLS=$(jq -r '.inputs.httpURL' $GITHUB_EVENT_PATH) | |
EVM_KEYS=$(jq -r '.inputs.fundingKey' $GITHUB_EVENT_PATH) | |
echo ::add-mask::$EVM_URLS | |
echo ::add-mask::$EVM_HTTP_URLS | |
echo ::add-mask::$EVM_KEYS | |
echo EVM_URLS=$EVM_URLS >> $GITHUB_ENV | |
echo EVM_HTTP_URLS=$EVM_HTTP_URLS >> $GITHUB_ENV | |
echo EVM_KEYS=$EVM_KEYS >> $GITHUB_ENV | |
- name: Debug Input | |
run: echo ${{ github.event.inputs.testInputs }} | |
- name: Checkout the repo | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
- name: Run Tests | |
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 | |
with: | |
test_command_to_run: make test_need_operator_assets && cd ./integration-tests && go test -timeout 1h -count=1 ./${{ github.event.inputs.directory }} -run ${{ github.event.inputs.test }} -v -args ${{ github.event.inputs.test-inputs }} | |
test_download_vendor_packages_command: cd ./integration-tests && go mod download | |
cl_repo: ${{ env.CHAINLINK_IMAGE }} | |
cl_image_tag: ${{ github.sha }} | |
artifacts_location: ./integration-tests/smoke/logs | |
publish_check_name: Generic Test Run | |
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 }} |