Skip to content

Commit

Permalink
base 0 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nareshmmr committed Nov 26, 2024
0 parents commit 1901e09
Show file tree
Hide file tree
Showing 803 changed files with 166,574 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake .
18 changes: 18 additions & 0 deletions .githooks/detect-ethereum-keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Define the regex pattern for Ethereum keys
ethereum_key_pattern="(0x[a-fA-F0-9]{40})"

# Loop over each file passed to the script
for file in "$@"; do
echo -n "Checking $file for ethereum keys... "

if grep -q "$ethereum_key_pattern" "$file"; then
echo -e "❌\nFound eth keys in $file:"
grep -n "$ethereum_key_pattern" "$file"
echo -e "\e[31mRemove the Ethereum key before committing.\e[0m\n"
exit 1
else
echo ""
fi
done
17 changes: 17 additions & 0 deletions .githooks/detect-rpc-urls
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Define the regex pattern for HTTP and WS URLs
url_pattern="(http|ws)(s)?:\/\/[^ \t\n\r]+"

# Loop over each file passed to the script
for file in "$@"; do
echo -n "Checking $file for RPC URLs... "
if grep -q "$url_pattern" "$file"; then
echo -e "❌\nFound RPC URL in $file:"
grep -n "$url_pattern" "$file"
echo -e "\e[31mRemove the RPC URL before committing.\e[0m\n"
exit 1
else
echo ""
fi
done
23 changes: 23 additions & 0 deletions .githooks/go-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Find all 'go.mod' files, get their directories, and run 'go mod tidy'
find "./" -type f -name 'go.mod' -print0 | while IFS= read -r -d $'\0' file; do
directory=$(dirname "$file")
cd "$directory" || exit 1

# Run linter and capture exit status
set +e
golangci-lint run -v
linting_result=$?
set -e

# Check linting result
if [[ $linting_result -ne 0 ]]; then
echo -e "Executing linters in $directory... \e[31mNOK!\e[0m\n"
echo -e "Run \`cd $directory && golangci-lint run --fix -v\` and fix the issues\n"
exit 1
else
echo -e "Executing linters in $directory... \e[32mOK!\e[0m\n"
fi
cd - || exit 1
done
14 changes: 14 additions & 0 deletions .githooks/go-mod-local-replace
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Loop over each file passed to the script
for file in "$@"; do
echo -n "Checking $file for local replacements... "
if grep -q 'replace .* => /' "$file"; then
echo -e "❌\nFound local replacements in $file:"
grep -n 'replace .* => /' "$file"
echo -e "\e[31mYou forgot about a local replacement\e[0m\n"
exit 1
else
echo ""
fi
done
23 changes: 23 additions & 0 deletions .githooks/go-mod-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set +e

# Find all 'go.mod' files, get their directories, and run 'go mod tidy'
find "./" -type f -name 'go.mod' -print0 | while IFS= read -r -d $'\0' file; do
dir=$(dirname "$file")
echo "Executing cd \"$dir\" && go mod tidy"
cd "$dir" || exit 1
go mod tidy
cd - || exit 1
done
# pre-commit stashes changes before running the hooks so we can use git to check for changes here
# Run git diff and capture output
output=$(git diff --stat)

if [ -z "$output" ]; then
echo "No changes in any files."
else
echo "go.mod files that need to be tidied:"
echo "$output" | awk -F '|' '/\|/ { print $1 }'
exit 1
fi
12 changes: 12 additions & 0 deletions .githooks/go-test-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

# Find all 'go.mod' files, get their directories, and run an empty 'go test' in them to compile the tests.
find "./" -type f -name 'go.mod' -print0 | while IFS= read -r -d $'\0' file; do
dir=$(dirname "$file")
echo "Executing cd \"$dir\" && go test -run=^# ./..."
cd "$dir"
go test -run=^# ./...
cd -
done
5 changes: 5 additions & 0 deletions .githooks/run-unit-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

printf "Executing unit tests..."

make test_unit
15 changes: 15 additions & 0 deletions .githooks/typos
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set +e
# shellcheck disable=SC2068
typos --config ./_typos.toml --force-exclude $@
typos_result=$?
set -e

# Check typos result
if [[ $typos_result -ne 0 ]]; then
echo -e "❌ Found typos\n"
# shellcheck disable=SC2145
echo -e "Run \`typos --write-changes --config ./_typos.toml --force-exclude $@\` and fix any issues left\n"
exit 1
fi
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.

**Versions**

- OS:
- Integrations Framework Version:
- plugin-testing-framework Version:

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Code**
If applicable, add the code of the test you're running.

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
56 changes: 56 additions & 0 deletions .github/actions/update-internal-mirrors/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 'Update Internal Mirrors Action'
inputs:
aws_region:
description: 'AWS region for the ECR'
required: false
role_to_assume:
description: 'AWS IAM role to assume'
required: false
aws_account_number:
description: 'AWS Account Number'
required: false
image_name:
description: 'Name of the docker image to update'
required: false
expression:
description: 'Regex expression for image tags'
required: false
page_size:
description: 'Number of tags to return per page'
required: false
default: '100'
github_token:
description: 'Token to use for GitHub API, in most cases github.token'
required: true

runs:
using: 'composite'
steps:
- name: Checkout the Repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ inputs.aws_region }}
role-to-assume: ${{ inputs.role_to_assume }}
role-duration-seconds: 3600
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
mask-password: 'true'
env:
AWS_REGION: ${{ inputs.aws_region }}
- name: Update images
shell: bash
env:
GHCR_TOKEN: ${{ inputs.github_token }}
run: |
# Update images
# Change to the directory where the action is stored
cd ${{ github.action_path }}
if [[ -z "${{ inputs.image_name }}" ]]; then
./scripts/update_mirrors.sh ${{ inputs.aws_account_number }}.dkr.ecr.${{ inputs.aws_region }}.amazonaws.com
else
# Update ${{ inputs.image_name }}
./scripts/update_mirrors.sh ${{ inputs.aws_account_number }}.dkr.ecr.${{ inputs.aws_region }}.amazonaws.com ${{ inputs.image_name }} '${{ inputs.expression }}' ${{ inputs.page_size }}
fi
5 changes: 5 additions & 0 deletions .github/actions/update-internal-mirrors/scripts/mirror.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"gcr.io/prysmaticlabs/prysm/beacon-chain:v4.1.1",
"gcr.io/prysmaticlabs/prysm/validator:v4.1.1",
"protolambda/eth2-val-tools:latest"
]
Loading

0 comments on commit 1901e09

Please sign in to comment.