Skip to content

Commit

Permalink
Merge branch 'develop' into VRF-797-remove-oracle-withdraw-and-allow-…
Browse files Browse the repository at this point in the history
…contract-owner-to-withdraw
  • Loading branch information
jinhoonbang authored Dec 21, 2023
2 parents 279fec7 + c3ba3a5 commit 3a7a000
Show file tree
Hide file tree
Showing 490 changed files with 9,140 additions and 5,075 deletions.
5 changes: 5 additions & 0 deletions .ct.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See: https://github.com/helm/chart-testing
target-branch: develop
chart-dirs: 'charts'
check-version-increment: false
validate-maintainers: false
7 changes: 1 addition & 6 deletions .github/actions/golangci-lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,9 @@ runs:
shell: bash
run: mkdir -p core/web/assets && touch core/web/assets/index.html
- name: Build binary
if: ${{ inputs.go-directory == '.' }}
shell: bash
run: go build ./...
- name: Build binary
if: ${{ inputs.go-directory != '.' }}
working-directory: ${{ inputs.go-directory }}
shell: bash
run: go build
run: go build ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
Expand Down
37 changes: 37 additions & 0 deletions .github/actions/notify-slack-jobs-result/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Notify Slack Jobs Result

Sends a Slack message to a specified channel detailing the results of one to many GHA job results using a regex. The job results will be grouped by the `github_job_name_regex` and displayed underneath the `message_title`, with the regex matching group displayed as an individual result. This is primarily designed for when you have test groups running in a matrix, and would like condensed reporting on their status by group. It's often accompanied by posting a Slack message before to start a thread, then attaching all the results to that thread like we do in the reporting section of the [live-testnet-test.yml workflow](../../workflows/live-testnet-tests.yml). Check out the example below, where we post an initial summary message, then use this action to thread together specific results:

```yaml
message_title: Optimism Goerli
github_job_name_regex: ^Optimism Goerli (?<cap>.*?) Tests$ # Note that the regex MUST have a capturing group named "cap"
```
![example](image.png)
## Inputs
```yaml
inputs:
github_token:
description: "The GitHub token to use for authentication (usually ${{ github.token }})"
required: true
github_repository:
description: "The GitHub owner/repository to use for authentication (usually ${{ github.repository }}))"
required: true
workflow_run_id:
description: "The workflow run ID to get the results from (usually ${{ github.run_id }})"
required: true
github_job_name_regex:
description: "The regex to use to match 1..many job name(s) to collect results from. Should include a capture group named 'cap' for the part of the job name you want to display in the Slack message (e.g. ^Client Compatability Test (?<cap>.*?)$)"
required: true
message_title:
description: "The title of the Slack message"
required: true
slack_channel_id:
description: "The Slack channel ID to post the message to"
required: true
slack_thread_ts:
description: "The Slack thread timestamp to post the message to, handy for keeping multiple related results in a single thread"
required: false
```
110 changes: 110 additions & 0 deletions .github/actions/notify-slack-jobs-result/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Notify Slack Jobs Result
description: Will send a notification in Slack for the result of a GitHub action run, typically for test results
inputs:
github_token:
description: "The GitHub token to use for authentication (usually github.token)"
required: true
github_repository:
description: "The GitHub owner/repository to use for authentication (usually github.repository))"
required: true
workflow_run_id:
description: "The workflow run ID to get the results from (usually github.run_id)"
required: true
github_job_name_regex:
description: "The regex to use to match 1..many job name(s) to collect results from. Should include a capture group named 'cap' for the part of the job name you want to display in the Slack message (e.g. ^Client Compatability Test (?<cap>.*?)$)"
required: true
message_title:
description: "The title of the Slack message"
required: true
slack_channel_id:
description: "The Slack channel ID to post the message to"
required: true
slack_bot_token:
description: "The Slack bot token to use for authentication which needs permission and an installed app in the channel"
required: true
slack_thread_ts:
description: "The Slack thread timestamp to post the message to, handy for keeping multiple related results in a single thread"
required: false

runs:
using: composite
steps:
- name: Get Results
shell: bash
id: test-results
run: |
# I feel like there's some clever, fully jq way to do this, but I ain't got the motivation to figure it out
echo "Querying test results at https://api.github.com/repos/${{inputs.github_repository}}/actions/runs/${{ inputs.workflow_run_id }}/jobs"
PARSED_RESULTS=$(curl \
-H "Authorization: Bearer ${{ inputs.github_token }}" \
'https://api.github.com/repos/${{inputs.github_repository}}/actions/runs/${{ inputs.workflow_run_id }}/jobs' \
| jq -r --arg pattern "${{ inputs.github_job_name_regex }}" '.jobs[]
| select(.name | test($pattern)) as $job
| $job.steps[]
| select(.name == "Run Tests")
| { conclusion: (if .conclusion == "success" then ":white_check_mark:" else ":x:" end), cap: ("*" + ($job.name | capture($pattern).cap) + "*"), html_url: $job.html_url }')
echo "Parsed Results:"
echo $PARSED_RESULTS
ALL_SUCCESS=true
echo "Checking for failures"
echo "$PARSED_RESULTS" | jq -s | jq -r '.[] | select(.conclusion != ":white_check_mark:")'
for row in $(echo "$PARSED_RESULTS" | jq -s | jq -r '.[] | select(.conclusion != ":white_check_mark:")'); do
ALL_SUCCESS=false
break
done
echo "Success: $ALL_SUCCESS"
echo all_success=$ALL_SUCCESS >> $GITHUB_OUTPUT
FORMATTED_RESULTS=$(echo $PARSED_RESULTS | jq -s '[.[]
| {
conclusion: .conclusion,
cap: .cap,
html_url: .html_url
}
]
| map("{\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"<\(.html_url)|\(.cap)>: \(.conclusion)\"}}")
| join(",")')
echo "Formatted Results:"
echo $FORMATTED_RESULTS
# Cleans out backslashes and quotes from jq
CLEAN_RESULTS=$(echo "$FORMATTED_RESULTS" | sed 's/\\\"/"/g' | sed 's/^"//;s/"$//')
echo "Clean Results"
echo $CLEAN_RESULTS
echo results=$CLEAN_RESULTS >> $GITHUB_OUTPUT
- name: Post Results
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
env:
SLACK_BOT_TOKEN: ${{ inputs.slack_bot_token }}
with:
channel-id: ${{ inputs.slack_channel_id }}
payload: |
{
"thread_ts": "${{ inputs.slack_thread_ts }}",
"attachments": [
{
"color": "${{ steps.test-results.outputs.all_success == 'true' && '#2E7D32' || '#C62828' }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ inputs.message_title }} ${{ steps.test-results.outputs.all_success == 'true' && ':white_check_mark:' || ':x:'}}",
"emoji": true
}
},
{
"type": "divider"
},
${{ steps.test-results.outputs.results }}
]
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions .github/workflows/automation-load-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ on:
description: TestInputs
required: false
type: string
ConfigOverride:
description: ConfigOverride
required: false
type: string
slackMemberID:
description: Notifies test results (Not your @)
required: true
Expand All @@ -43,6 +47,7 @@ jobs:
SLACK_API_KEY: ${{ secrets.QA_SLACK_API_KEY }}
SLACK_CHANNEL: C03KJ5S7KEK
TEST_INPUTS: ${{ inputs.TestInputs }}
CONFIG_OVERRIDE: ${{ inputs.ConfigOverride }}
CHAINLINK_ENV_USER: ${{ github.actor }}
REF_NAME: ${{ github.head_ref || github.ref_name }}
steps:
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/ci-chaincli.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/ci-scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI Scripts

on:
push:
pull_request:

jobs:
lint-scripts:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Golang Lint
uses: ./.github/actions/golangci-lint
with:
name: lint-scripts
go-directory: core/scripts
go-version-file: core/scripts/go.mod
go-module-file: core/scripts/go.sum
gc-basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_CLOUD_HOST }}

test-scripts:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Go
uses: ./.github/actions/setup-go
with:
go-version-file: core/scripts/go.mod
go-module-file: core/scripts/go.sum
- name: Run Tests
shell: bash
working-directory: core/scripts
run: go test ./...
- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: test-scripts
continue-on-error: true
Loading

0 comments on commit 3a7a000

Please sign in to comment.