Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kalverra committed Jan 6, 2025
2 parents 0c4bb16 + 15722ca commit 8235813
Show file tree
Hide file tree
Showing 558 changed files with 37,937 additions and 8,170 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
types: [submitted]
pull_request:
types: [labeled]
paths-ignore:
- 'tools/**'

jobs:
eth_env:
Expand Down
27 changes: 22 additions & 5 deletions .github/workflows/framework-golden-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,27 @@ jobs:
config: smoke.toml
count: 1
timeout: 10m
- name: TestLoad
config: load.toml
- name: TestSolanaSmoke
config: smoke_solana.toml
count: 1
timeout: 10m
- name: TestUpgrade
config: upgrade.toml
count: 1
timeout: 10m
- name: TestPerformanceBaseline
config: performance_baseline.toml
count: 1
timeout: 10m
- name: TestChaos
config: chaos.toml
count: 1
timeout: 10m
- name: TestReload
config: reload.toml
- name: TestScalability
config: scalability.toml
count: 1
timeout: 10m
name: ${{ matrix.test.name }}
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand All @@ -54,6 +63,7 @@ jobs:
filters: |
src:
- 'framework/**'
- '.github/workflows/framework-golden-tests.yml'
- name: Set up Go
uses: actions/setup-go@v4
with:
Expand All @@ -70,9 +80,16 @@ jobs:
go-modules-${{ runner.os }}
- name: Install dependencies
run: go mod download
- name: Run Docker Component Tests
- name: Run System 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 }}
- name: Upload Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: container-logs-${{ matrix.test.name }}
path: framework/examples/myproject/logs
retention-days: 1
6 changes: 4 additions & 2 deletions .github/workflows/framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-framework
cancel-in-progress: true
jobs:
test:
framework-component-tests:
defaults:
run:
working-directory: framework
env:
CTF_JD_IMAGE: ${{ secrets.CTF_JD_IMAGE }}
runs-on: ubuntu-latest
permissions:
id-token: write
Expand Down Expand Up @@ -51,4 +53,4 @@ jobs:
- name: Run Docker Component Tests
if: steps.changes.outputs.src == 'true'
run: |
go test -timeout 5m -v -count 1 -run TestDocker ./...
go test -timeout 2m -v -count 1 -run TestComponent ./...
223 changes: 223 additions & 0 deletions .github/workflows/generate-go-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
name: Generate go-docs

on:
pull_request:
types:
- labeled
- reopened
- synchronize

jobs:
generate_docs_new_pr:
name: Generate Go Docs
if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }}
runs-on: ubuntu-latest
environment: integration
permissions:
id-token: write
contents: read

steps:
- name: Setup GitHub Token for reading Generate Go Doc Repo
id: setup-github-token-read
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }}
aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Configure git for private repository and install go tools
env:
GOPRIVATE: github.com/smartcontractkit/generate-go-function-docs
run: |
git config --global url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/"
go install github.com/smartcontractkit/[email protected]
go install github.com/jmank88/[email protected]
go install golang.org/x/tools/gopls@latest
- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Detect changes related to current PR
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
seth:
- 'seth/**/*.go'
wasp:
- 'wasp/**/*.go'
havoc:
- 'havoc/**/*.go'
lib:
- 'lib/**/*.go'
k8s-test-runner:
- 'k8s-test-runner/**/*.go'
framework:
- 'framework/**/*.go'
tools/asciitable:
- 'tools/asciitable/**/*.go'
tools/breakingchanges:
- 'tools/breakingchanges/**/*.go'
tools/citool:
- 'tools/citool/**/*.go'
tools/ecrimagefetcher:
- 'tools/ecrimagefetcher/**/*.go'
tools/envresolve:
- 'tools/envresolve/**/*.go'
tools/flakeguard:
- 'tools/flakeguard/**/*.go'
tools/ghlatestreleasechecker:
- 'tools/ghlatestreleasechecker/**/*.go'
tools/ghsecrets:
- 'tools/ghsecrets/**/*.go'
tools/gotestloghelper:
- 'tools/gotestloghelper/**/*.go'
tools/testlistgenerator:
- 'tools/testlistgenerator/**/*.go'
tools/workflowresultparser:
- 'tools/workflowresultparser/**/*.go'
# add more projects here
- name: Find all go modules in the repository and filter the ones that changed
shell: bash
id: go-modules
env:
FILTERS: ${{ steps.changes.outputs.changes }}
run: |
PATH=$PATH:$(go env GOPATH)/bin
export PATH
# Find all go projects
gomods_output=$(gomods 2>&1)
# Extract the parent directories of go.mod files
parent_folders=$(echo "$gomods_output" | grep 'go\.mod$' | sed 's/\/go\.mod//' | sed 's/^[ \t]*//;s/[ \t]*$//' | xargs -n 1)
# Convert parent directories into a JSON matrix
echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > all_folders.json
# Filter the directories that did not changeß
jq --argjson filters "$FILTERS" 'map(select(.folder as $folder | $filters | index($folder)))' all_folders.json > filtered_folders.json
echo "Filtered folder List JSON"
cat filtered_folders.json
rm all_folders.json
- name: Generate go docs for changed projects
shell: bash
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_DOC_GEN_API_KEY }}
run: |
# Add go binary to PATH
PATH=$PATH:$(go env GOPATH)/bin
export PATH
cat filtered_folders.json | jq -c '.[]' | while read -r item; do
folder=$(echo "$item" | jq -r '.folder')
echo "Processing folder: $folder"
generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} --saveCosts --generator chatgpt --generatorSubType ${{ vars.GO_DOC_GEN_CHATGPT_MODEL }} --folder "$folder"
done
rm filtered_folders.json
- name: Upload costs as artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: generation-costs
path: ./costs

- name: Remove costs before committing
shell: bash
run: rm -rf costs

- name: Setup GitHub Token for creating a new PR
id: setup-github-token-write
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_ROLE_ARN_CREATE_PR }}
aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Create a new PR targeting current PR
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
id: create-pr
with:
token: ${{ steps.setup-github-token-write.outputs.access-token }}
branch: ${{ github.head_ref }}-docs
base: ${{ github.head_ref }}
title: "Go docs for PR#${{ github.event.pull_request.number }}"
body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes."
commit-message: "[Bot] Add automatically generated go documentation"

- name: Find comment with PR link
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Go doc generation

- name: Create comment in the original PR with link to the new PR
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
if: steps.create-pr.outputs.pull-request-number != ''
with:
token: ${{ steps.setup-github-token-write.outputs.access-token }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
## Go doc generation
Hey @${{ github.actor }}, you can check generated Go function documentation [here](${{ steps.create-pr.outputs.pull-request-url }}). Please review them and merge to this PR once you're satisfied with them.
- name: Create comment in the original PR to notify about no new docs
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
if: steps.create-pr.outputs.pull-request-number == ''
with:
token: ${{ steps.setup-github-token-write.outputs.access-token }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
## Go doc generation
Hey @${{ github.actor }}, no documentation was generated. Are you sure that you made changes to public functions without existing comments in your PR?
- name: Send Slack notification
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
if: failure()
id: slack
env:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
with:
channel-id: 'C049X3353K2'
payload: |
{
"attachments": [
{
"color": "#C62828",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Go doc generation - Failed :x:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<@U060CGGPY8H>, please have a look."
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}|PR#${{ github.event.pull_request.number }}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run Details>"
}
}
]
}
]
}
7 changes: 3 additions & 4 deletions .github/workflows/k8s-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: (k8s package) E2E tests
on:
pull_request:
pull_request:

concurrency:
group: e2e-tests-k8s-${{ github.ref }}
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Load Nix
run: nix develop -c sh -c "cd lib &&go mod download"
- name: Setup environment
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@d2f9642bcc24a73400568756f24b72c188ac7a9a # v2.3.31
uses: smartcontractkit/.github/actions/ctf-setup-run-tests-environment@49cb1613e96c9ce17f7290e4dabd38f43aa9bd4d # [email protected]
with:
go_mod_path: go.mod
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand All @@ -83,7 +83,7 @@ jobs:
- name: Run Tests
env:
LOCAL_CHARTS: true
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@d2f9642bcc24a73400568756f24b72c188ac7a9a # v2.3.31
uses: smartcontractkit/.github/actions/ctf-run-tests@b8731364b119e88983e94b0c4da87fc27ddb41b8 # [email protected]
with:
cl_repo: ${{ env.CHAINLINK_IMAGE }}
cl_image_tag: ${{ env.CHAINLINK_VERSION }}
Expand All @@ -96,7 +96,6 @@ jobs:
go_mod_path: 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 }}
run_setup: false
- name: Upload test log
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/k8s-publish-test-base-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
# we only need base image for k8s based tests
- 'lib/v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag for the base image'
required: true
type: string

jobs:
publish_test_base_image:
Expand All @@ -19,12 +24,20 @@ jobs:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Strip "lib/" from github.ref_name
if: ${{ github.event_name == 'push' }}
run: |
stripped_ref_name="${GITHUB_REF//refs\/tags\/lib\//}"
# disabling as the string containing variable is double-quotted as a whole, no need to quote each variable separately
# shellcheck disable=SC2086
echo "BASE_IMAGE_TAG=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:$stripped_ref_name" >> $GITHUB_ENV
- name: Export base image tag for workflow dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
shell: bash
run: |
# shellcheck disable=SC2086
echo "BASE_IMAGE_TAG=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:${{ github.event.inputs.tag }}" >> $GITHUB_ENV
- name: Build Base Image
uses: smartcontractkit/chainlink-github-actions/docker/build-push@d2f9642bcc24a73400568756f24b72c188ac7a9a # v2.3.31
with:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/modgraph.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Module graph
on:
pull_request:
jobs:
modgraph:
runs-on: ubuntu-latest
name: modgraph
steps:
- name: Checkout the Repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Setup Go
uses: actions/setup-go@v5
- run: make modgraph
- name: Ensure clean modgraph
run: git diff --minimal --exit-code
Loading

0 comments on commit 8235813

Please sign in to comment.