Skip to content

Commit

Permalink
Merge branch 'main' of github.com:smartcontractkit/chainlink-testing-…
Browse files Browse the repository at this point in the history
…framework into dependabotUpdates
  • Loading branch information
kalverra committed Nov 7, 2024
2 parents e77c474 + bc5f730 commit 01e050e
Show file tree
Hide file tree
Showing 100 changed files with 5,205 additions and 2,928 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ on:
push:
branches:
- main
tags:
- '*'

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0 # Fetch all history for all tags

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/framework-golden-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Framework Golden Tests Examples
on:
push:

jobs:
test:
defaults:
run:
working-directory: framework/examples/myproject
env:
LOKI_TENANT_ID: promtail
LOKI_URL: http://localhost:3030/loki/api/v1/push
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
test:
- name: TestSmoke
config: smoke.toml
count: 1
timeout: 10m
- name: TestLoad
config: load.toml
count: 1
timeout: 10m
- name: TestChaos
config: chaos.toml
count: 1
timeout: 10m
- name: TestReload
config: reload.toml
count: 1
timeout: 10m
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.PUBLIC_AWS_ECR_ROLE }}
aws-region: us-east-1
- name: Authenticate to ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registry-type: public
- name: Check for changes in Framework
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'framework/**'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.8
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-modules-${{ hashFiles('framework/examples/myproject/go.sum') }}-${{ runner.os }}-framework-golden-examples
restore-keys: |
go-modules-${{ runner.os }}-framework-golden-examples
go-modules-${{ runner.os }}
- name: Install dependencies
run: go mod download
- name: Run Docker Component Tests
if: steps.changes.outputs.src == 'true'
env:
CTF_CONFIGS: ${{ matrix.test.config }}
run: |
go test -timeout ${{ matrix.test.timeout }} -v -count ${{ matrix.test.count }} -run ${{ matrix.test.name }}
13 changes: 13 additions & 0 deletions .github/workflows/framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@ jobs:
run:
working-directory: framework
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.PUBLIC_AWS_ECR_ROLE }}
aws-region: us-east-1
- name: Authenticate to ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registry-type: public
- name: Check for changes in Framework
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release-go-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ jobs:
else
echo "CMD_ENTRYPOINT_EXISTS=false" >> "$GITHUB_ENV"
fi
- name: Set binary name based on PACKAGE_NAME
run: |
if [ "${{ env.PACKAGE_NAME }}" == "framework" ]; then
echo "BINARY_NAME=ctf" >> $GITHUB_ENV
else
echo "BINARY_NAME=${{ env.PACKAGE_NAME }}" >> $GITHUB_ENV
fi
- name: Build binary release
uses: wangyoucao577/go-release-action@v1
if: env.CMD_ENTRYPOINT_EXISTS == 'true'
Expand All @@ -134,7 +141,7 @@ jobs:
goversion: '1.22.6'
goos: ${{ matrix.platform }}
goarch: ${{ matrix.goarch }}
binary_name: ${{ env.PACKAGE_NAME }}
binary_name: ${{ env.BINARY_NAME }}
release_name: ${{ env.PACKAGE_NAME }}
release_tag: ${{ env.PACKAGE_NAME}}/${{ env.VERSION }}
project_path: ${{ env.PACKAGE_NAME }}/cmd
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
path: ./tools/ghlatestreleasechecker/
- name: asciitable
path: ./tools/asciitable/
- name: flakeguard
path: ./tools/flakeguard/
- name: workflowresultparser
path: ./tools/workflowresultparser/
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
[![Seth tag](https://img.shields.io/github/v/tag/smartcontractkit/chainlink-testing-framework?filter=%2Aseth%2A)](https://github.com/smartcontractkit/chainlink-testing-framework/tags)
[![Havoc tag](https://img.shields.io/github/v/tag/smartcontractkit/chainlink-testing-framework?filter=%2Ahavoc%2A)](https://github.com/smartcontractkit/chainlink-testing-framework/tags)

![Tests](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/test.yaml/badge.svg)
![Lint](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/lint.yaml/badge.svg)
[![Tests](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/test.yaml/badge.svg)](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/test.yaml)
[![Lints](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/lint.yaml/badge.svg)](https://github.com/smartcontractkit/chainlink-testing-framework/actions/workflows/lint.yaml)

[![Go Report Card](https://goreportcard.com/badge/github.com/smartcontractkit/chainlink-testing-framework)](https://goreportcard.com/report/github.com/smartcontractkit/chainlink-testing-framework)
![Go Version](https://img.shields.io/github/go-mod/go-version/smartcontractkit/chainlink-testing-framework?filename=./lib/go.mod)
Expand Down
19 changes: 13 additions & 6 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
- [Connecting Chainlink Node (Multiple networks)]()
- [NodeSet Environment](./framework/nodeset_environment.md)
- [NodeSet with Capabilities](./framework/nodeset_capabilities.md)
- [NodeSet with External Blockchain](./framework/nodeset_external.md)
- [NodeSet (Local Docker builds)](./framework/nodeset_docker_rebuild.md)
- [NodeSet Compat Environment](./framework/nodeset_compatibility.md)
- [NodeSet with External Blockchain]()
- [CLI](./framework/cli.md)
- [Configuration](./framework/configuration.md)
- [Test Configuration](./framework/test_configuration_overrides.md)
- [Caching](framework/components/caching.md)
- [Components Persistence](framework/components/state.md)
- [Components Caching](framework/components/caching.md)
- [Secrets]()
- [Docker](framework/docker.md)
- [Observability Stack](framework/observability/observability_stack.md)
- [Metrics]()
- [Metrics](framework/observability/metrics.md)
- [Logs](framework/observability/logs.md)
- [Profiling](framework/observability/profiling.md)
- [Traces]()
Expand All @@ -29,13 +31,18 @@
- [Geth]()
- [Optimism Stack]()
- [Arbitrum Stack]()
- [Chainlink]()
- [Node]()
- [NodeSet]()
- [Chainlink](framework/components/chainlink.md)
- [Node](framework/components/chainlink/node.md)
- [NodeSet](framework/components/chainlink/nodeset.md)
- [Clients]()
- [Chainlink]()
- [RPC]()
- [Loki]()
- [Testing]()
- [Smoke]()
- [Performance]()
- [Chaos]()
- [Interactive](framework/interactive.md)
- [Continuous Integration](ci/ci.md)
- [Libraries](./libraries.md)
- [Seth](./libs/seth.md)
Expand Down
85 changes: 84 additions & 1 deletion book/src/ci/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,87 @@

Here we describe our good practices for structuring different types of tests in Continuous Integration (GitHub Actions).

Follow [this](https://github.com/smartcontractkit/.github/tree/main/.github/workflows) guide.
Set up secrets in your GitHub repository
```
gh secret set CTF_SIMULATED_KEY_1 --body "..."
```

Add a workflow
```yaml
name: Framework Golden Tests Examples
on:
push:

jobs:
test:
defaults:
run:
working-directory: framework/examples/myproject
env:
LOKI_TENANT_ID: promtail
LOKI_URL: http://localhost:3030/loki/api/v1/push
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
test:
- name: TestSmoke
config: smoke.toml
count: 1
timeout: 10m
- name: TestLoad
config: load.toml
count: 1
timeout: 10m
- name: TestChaos
config: chaos.toml
count: 1
timeout: 10m
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.PUBLIC_AWS_ECR_ROLE }}
aws-region: us-east-1
- name: Authenticate to ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registry-type: public
- name: Check for changes in Framework
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
src:
- 'framework/**'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.8
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-modules-${{ hashFiles('framework/examples/myproject/go.sum') }}-${{ runner.os }}-framework-golden-examples
restore-keys: |
go-modules-${{ runner.os }}-framework-golden-examples
go-modules-${{ runner.os }}
- name: Install dependencies
run: go mod download
- name: Run Docker Component Tests
if: steps.changes.outputs.src == 'true'
env:
CTF_CONFIGS: ${{ matrix.test.config }}
run: |
go test -timeout ${{ matrix.test.timeout }} -v -count ${{ matrix.test.count }} -run ${{ matrix.test.name }}
```
If you need to structure a lot of different end-to-end tests follow [this](https://github.com/smartcontractkit/.github/tree/main/.github/workflows) guide.
2 changes: 1 addition & 1 deletion book/src/framework/components/blockchains/anvil.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Anvil command line params, ex.: docker_cmd_params = ['--block-time=1', '...']
docker_cmd_params = []
# Docker image and tag
image = "ghcr.io/gakonst/foundry:latest"
image = "f4hrenh9it/foundry:latest"
# External port to expose
port = "8545"
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
Expand Down
2 changes: 1 addition & 1 deletion book/src/framework/components/caching.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Component caching

We use component caching to accelerate test development and enforce idempotent test actions.
We use component caching to accelerate test development and enforce idempotent test actions development.

Each component is isolated by means of inputs and outputs.

Expand Down
3 changes: 3 additions & 0 deletions book/src/framework/components/chainlink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Chainlink

Here we store `Chainlink` components: Node, NodeSet, JobDistributor and other services.
Loading

0 comments on commit 01e050e

Please sign in to comment.