Skip to content

Commit

Permalink
QA-94 Dynamic chainlink libs (#49)
Browse files Browse the repository at this point in the history
* QA-94 Add Dynamic go get for chainlink/integration-tests lib
Also broke action steps out into more logical groups
CGO_ENABLED now defaults to 1 since most of the use cases now require it

* validate setup changes work
  • Loading branch information
tateexon committed Nov 8, 2022
1 parent cd9e407 commit 5ca2b0a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 30 deletions.
2 changes: 1 addition & 1 deletion chainlink-testing-framework/build-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ runs:
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
if: steps.push.outputs.push == 'true'
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Build and Push
uses: docker/build-push-action@v3
with:
Expand Down
38 changes: 32 additions & 6 deletions chainlink-testing-framework/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ inputs:
go_mod_path:
required: false
description: The go.mod file path
dep_chainlink_integration_tests:
required: false
description: chainlink/integration-tests commit or branch
QA_AWS_REGION:
required: true
description: The AWS region to use
Expand All @@ -69,8 +72,8 @@ inputs:
description: The kubernetes configuration to use
CGO_ENABLED:
required: false
description: Whether to have cgo enabled
default: "0"
description: Whether to have cgo enabled, defaults to enabled
default: "1"
should_cleanup:
required: false
description: Whether to run the cleanup at the end, soak tests and such would not want to automatically cleanup
Expand All @@ -79,25 +82,46 @@ inputs:
runs:
using: composite
steps:
# Setup Tools and libraries
- name: Setup environment
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@v2.0.24
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@v2.0.25
with:
test_download_vendor_packages_command: ${{ inputs.test_download_vendor_packages_command }}
test_download_ginkgo_command: ${{ inputs.test_download_ginkgo_command }}
go_mod_path: ${{ inputs.go_mod_path }}
QA_AWS_REGION: ${{ inputs.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ inputs.QA_KUBECONFIG }}
- name: Replace chainlink/integration-tests deps
if: ${{ inputs.dep_chainlink_integration_tests }}
shell: bash
run: |
# find test go root by using the go_mod_path and change to that directory
TEST_LIB_PATH="${{ inputs.go_mod_path }}"
if [ "${#TEST_LIB_PATH}" -gt "6" ]; then
TEST_LIB_PATH=${TEST_LIB_PATH%go.mod}
cd "${TEST_LIB_PATH}"
fi
# update the integration-tests lib to the branch or commit
go get github.com/smartcontractkit/chainlink/integration-tests@${{ inputs.dep_chainlink_integration_tests }}
go mod tidy
# Download any external artifacts
- name: Download Artifacts
if: inputs.download_contract_artifacts_path != 'none'
uses: actions/download-artifact@v3
with:
name: artifacts
path: ${{ inputs.download_contract_artifacts_path }}

# Generate any excutables needed to run tests
- name: Generate gauntlet executable
if: inputs.build_gauntlet_command != 'false'
shell: bash
run: ${{ inputs.build_gauntlet_command }}

# Run the tests
- name: Run Tests
shell: bash
env:
Expand All @@ -109,11 +133,13 @@ runs:
export PATH
export TEST_TRIGGERED_BY=${{ inputs.triggered_by }}-${{ github.event.pull_request.number || github.run_id }}
${{ inputs.test_command_to_run }}
# Reporting and cleanup
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: ${{ inputs.publish_report_paths }}
junit_files: ${{ inputs.publish_report_paths }}
github_token: ${{ inputs.token }}
check_name: ${{ inputs.publish_check_name }}
comment_mode: ${{ inputs.publish_test_results_comment_mode }}
Expand All @@ -126,7 +152,7 @@ runs:
path: ${{ inputs.artifacts_location }}
- name: cleanup
if: always()
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/cleanup@v2.0.22
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/cleanup@v2.0.25
with:
triggered_by: ${{ inputs.triggered_by }}
should_cleanup: ${{ inputs.should_cleanup }}
56 changes: 33 additions & 23 deletions chainlink-testing-framework/setup-run-tests-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,13 @@ inputs:
runs:
using: composite
steps:
- uses: smartcontractkit/tool-versions-to-env-action@v1.0.8
id: tool-versions

# Go setup and caching
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: ${{ inputs.go_mod_path }}
check-latest: true
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ inputs.QA_AWS_REGION }}
role-to-assume: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 3600
- name: Set Kubernetes Context
uses: azure/k8s-set-context@v3
with:
method: kubeconfig
kubeconfig: ${{ inputs.QA_KUBECONFIG }}
- name: Tool Versions
shell: bash
run: |
aws --version
aws sts get-caller-identity
kubectl version --short
- name: Cache Vendor Packages
uses: actions/cache@v3
id: cache-packages
Expand All @@ -72,12 +55,39 @@ runs:
if [[ -z "${CHECK}" ]]; then
${{ inputs.test_download_ginkgo_command }}
fi
# Setup AWS cred and K8s context
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ inputs.QA_AWS_REGION }}
role-to-assume: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 3600
- name: Set Kubernetes Context
uses: azure/k8s-set-context@v3
with:
method: kubeconfig
kubeconfig: ${{ inputs.QA_KUBECONFIG }}

# Helm Setup
- uses: smartcontractkit/tool-versions-to-env-action@v1.0.8
id: tool-versions
- uses: azure/setup-helm@v3
with:
version: v${{ steps.tool-versions.outputs.helm_version }}
- name: Add QA charts repo
- name: Add required helm charts including chainlink-qa
shell: bash
run: helm repo add chainlink-qa https://raw.githubusercontent.com/smartcontractkit/qa-charts/gh-pages/
- name: Add Bitnami charts repo
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add chainlink-qa https://raw.githubusercontent.com/smartcontractkit/qa-charts/gh-pages/
# Display tool versions
- name: Tool Versions
shell: bash
run: helm repo add bitnami https://charts.bitnami.com/bitnami
run: |
go version
ginkgo version
aws --version
kubectl version
helm version
helm repo list

0 comments on commit 5ca2b0a

Please sign in to comment.