Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
edisonz0718 committed Aug 21, 2024
0 parents commit 22b930f
Show file tree
Hide file tree
Showing 445 changed files with 57,083 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @LeoHChen @AndyBoWu @jdubpark @edisonz0718 @ezreal1997 @limengformal @Narangde @leeren
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Submit a bug ticket if you have an issue. If you're a user, check out the Story Protocol Discord server for faster assistance.
title: ''
labels: 'bug'
assignees: ''
---
<!--- Fill out the fields if you're an integrator or contributor. -->

## Description and context
<!--- Provide a detailed description of the problem to expedite the process. -->


## Steps to reproduce
<!--- Describe what happened step by step. -->
<!--- If applicable, provide a link to a live example or include code to reproduce. -->

1.
2.
3.

## Experienced behavior
<!--- Describe what happened after the last step. -->


## Expected behavior
<!--- Describe what was expected to happen instead. -->


## Solution recommendation
<!--- Not mandatory, but feel free to recommend a way fix the issue. -->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Story Protocol Official Discord
url: https://discord.gg/storyprotocol
about: If you're a user, this is the fastest way to get help. Do not give your wallet private key or mnemonic words to anyone.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature Request
about: Create a feature request item to be picked up by a contributor.
title: ''
labels: 'enhancement'
assignees: ''

---

## Description and context
<!--- Write a description or todo list as the scope. A task should be: -->
<!--- Actionable: can be acted on right away. -->
<!--- Clearly defined scope: has precise limits/boundaries. -->
<!--- Small scope: break complex tasks into smaller ones if they involve multiple system parts, multiple people/PRs, or parallelizable work. -->

## Suggested solution
<!--- Optionally write a description of suggested solution for this feature request -->

## Definition of done
<!--- Describe completion: e.g. code merged, deployment is done, or release published etc. -->
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Task
about: Create a regular work item to be picked up by a contributor.
title: ''
labels: ''
assignees: ''

---

## Description and context
<!--- Write a description or todo list as the scope. A task should be: -->
<!--- Actionable: can be acted on right away. -->
<!--- Clearly defined scope: has precise limits/boundaries. -->
<!--- Small scope: break complex tasks into smaller ones if they involve multiple system parts, multiple people/PRs, or parallelizable work. -->

## Suggested solution
<!--- Optionally write a description of suggested solution for this feature request -->

## Definition of done
<!--- Describe completion: e.g. code merged, deployment is done, or release published etc. -->
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/tracking_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Tracking issue
about: Tracking issues are task lists used to better organize regular work items.
title: 'Tracking issue for *ADD_PROJECT* - *ADD_COMPONENT*'
labels: 'epic'
assignees: ''

---

This issue is for grouping *ADD_COMPONENT* related tasks that are necessary for *ADD_PROJECT*.

### Other tracking issues for the same project:
<!--- Link related tracking issues within the project for easier navigation. -->
<!--- Assign tasks to the appropriate tracking issue if there is more than one. -->

- #XXXX
- #XXXX
- #XXXX

<!--- Subtasks MUST be inside the ``` -> ``` code block. -->
```[tasklist]
### Task list
- [ ] XXXX
- [ ] XXXX
```
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
3 changes: 3 additions & 0 deletions .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- Add a description of the changes that this PR introduces. Must be less than 50 characters, all lower case and no special characters -->

issue: <!-- fixes/closes/resolves #<issue number> -->
29 changes: 29 additions & 0 deletions .github/workflows/ci-docs.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: ci docs
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_PROJECT_ID }}
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'docs/site/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v3
with:
version: 8
- name: Install Vercel CLI
run: pnpm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
150 changes: 150 additions & 0 deletions .github/workflows/ci-iliad-s3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: Build and Upload iliad Binary

on:
workflow_dispatch:
push:
branches:
- main

permissions:
id-token: write
contents: write
pull-requests: write
actions: write

env:
NUM_INTERNAL_BINARIES_TO_KEEP: 50
NUM_PUBLIC_BINARIES_TO_KEEP: 400

jobs:
# Add timestamp
Timestamp:
uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main

# Build and upload the iliad binary
build_and_push:
needs: Timestamp
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux-386, linux-amd64, linux-arm, linux-arm64, darwin-amd64, darwin-arm64, windows-amd64, windows-386]

steps:
- name: Checkout code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::478656756051:role/iac-max-role
aws-region: us-west-1
role-session-name: github-actions

- name: Extract the version
run: |
PARAMS_FILE="./lib/buildinfo/buildinfo.go"
VERSION_MAJOR=$(awk -F= '/VersionMajor/ {gsub(/[^0-9]/, "", $2); printf "%s", $2}' $PARAMS_FILE)
VERSION_MINOR=$(awk -F= '/VersionMinor/ {gsub(/[^0-9]/, "", $2); printf "%s", $2}' $PARAMS_FILE)
VERSION_PATCH=$(awk -F= '/VersionPatch/ {gsub(/[^0-9]/, "", $2); printf "%s", $2}' $PARAMS_FILE)
VERSION_META=$(awk -F\" '/VersionMeta/ {print $2; exit}' $PARAMS_FILE)
VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
if [ "$VERSION_META" != "stable" ]; then
VERSION+="-${VERSION_META}"
fi
echo "Version extracted: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build the iliad binary
run: |
IFS="-" read -r GOOS GOARCH <<< "${{ matrix.platform }}"
bin_name=iliad
if [ "$GOOS" = "windows" ]; then
bin_name+='.exe'
fi
echo "Building for $GOOS/$GOARCH..."
cd client
env GOOS=$GOOS GOARCH=$GOARCH go build -o $bin_name > /dev/null 2>&1
chmod +x $bin_name
- name: Upload the iliad binary to S3
run: |
export TZ=America/Los_Angeles
IFS="-" read -r GOOS GOARCH <<< "${{ matrix.platform }}"
TIMESTAMP=$(date +%Y%m%d%H%M%S)
HUMAN_READABLE_VERSION=$(date)
COMMIT_HASH=$(git rev-parse --short HEAD)
FOLDER_NAME="iliad-${{ matrix.platform }}-${VERSION}-${COMMIT_HASH}"
ARCHIVE_NAME="${FOLDER_NAME}.tar.gz"
bin_name=./client/iliad
if [ "$GOOS" = "windows" ]; then
bin_name+='.exe'
fi
mkdir $FOLDER_NAME
mv $bin_name $FOLDER_NAME/
echo "Archiving the iliad binary..."
tar -czvf $ARCHIVE_NAME $FOLDER_NAME
if [ $? -ne 0 ]; then
echo "Failed to create the archive: $ARCHIVE_NAME"
exit 1
fi
aws s3 cp $ARCHIVE_NAME s3://iliad-geth-binaries/iliad-public/$ARCHIVE_NAME --quiet
if [ "${{ matrix.platform }}" = "linux-amd64" ]; then
echo "Uploading binary for internal use..."
aws s3 cp $ARCHIVE_NAME s3://iliad-geth-binaries/iliad/iliad-$TIMESTAMP --quiet
# Update manifest file
aws s3 cp s3://iliad-geth-binaries/iliad/manifest.txt manifest.txt --quiet || touch manifest.txt
echo "$TIMESTAMP" >> manifest.txt
aws s3 cp manifest.txt s3://iliad-geth-binaries/iliad/manifest.txt --quiet
fi
cleanup:
runs-on: ubuntu-latest
needs: build_and_push
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::478656756051:role/iac-max-role
aws-region: us-west-1
role-session-name: github-actions

- name: Cleanup internal binaries
run: |
cleanup_s3() {
PREFIX=$1
KEEP=$2
echo "Cleaning up in bucket iliad-geth-binaries with prefix: $PREFIX, keeping latest $KEEP binaries"
aws s3api list-objects-v2 --bucket iliad-geth-binaries --prefix $PREFIX --query "sort_by(Contents,&LastModified)[*].Key" > all_binaries.json
# Extract the list of keys, remove the latest $KEEP binaries
BINARIES_TO_DELETE=$(jq -r ".[0:-${KEEP}][]" all_binaries.json)
if [ -n "$BINARIES_TO_DELETE" ]; then
# Delete old binaries
for key in $BINARIES_TO_DELETE; do
aws s3 rm s3://iliad-geth-binaries/$key --quiet
done
echo "Deleted old binaries: $BINARIES_TO_DELETE"
else
echo "No old binaries to delete."
fi
}
# Cleanup internal binaries
cleanup_s3 "iliad/" "${NUM_INTERNAL_BINARIES_TO_KEEP}"
# Cleanup public binaries
cleanup_s3 "iliad-public/" "${NUM_PUBLIC_BINARIES_TO_KEEP}"
28 changes: 28 additions & 0 deletions .github/workflows/ci-main-yml-disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ci main
# continuous integration on push to main

on:
push:
branches:
- main

permissions:
contents: read
pull-requests: read

jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yml
go-tests:
uses: ./.github/workflows/gotest.yml
go-lint:
uses: ./.github/workflows/golangci-lint.yml
sol-tests:
uses: ./.github/workflows/soltest.yml
release-snapshot:
uses: ./.github/workflows/release-snapshot.yml
needs: [pre-commit, go-tests, go-lint, sol-tests]
secrets: inherit
e2e:
uses: ./.github/workflows/e2etest.yml
needs: [release-snapshot]
46 changes: 46 additions & 0 deletions .github/workflows/ci-notify.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: ci notify

# run after all completed workflows on main
on:
workflow_run:
workflows: ["*"]
branches: [main]
types: [completed]

jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: slackapi/[email protected]
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "🚨 CI failed on `${{ github.event.repository.name }}:${{ github.event.workflow_run.head_branch }}`."
}
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/4/43/Minimalist_info_Icon.png",
"alt_text": "images"
},
{
"type": "mrkdwn",
"text": "url: ${{ github.event.workflow_run.html_url }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
Loading

0 comments on commit 22b930f

Please sign in to comment.