-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'byczong/sc-25983/add-namerank-to-monorepo' into staging
- Loading branch information
Showing
87 changed files
with
2,412,729 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: NameGuard Python - Lint | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "packages/nameguard-python/**" | ||
pull_request: | ||
branches: ["main", "staging"] | ||
paths: | ||
- "packages/nameguard-python/**" | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout NameKit repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Ruff Check | ||
uses: chartboost/ruff-action@v1 | ||
with: | ||
version: 0.6.7 | ||
src: "./packages/nameguard-python" | ||
|
||
- name: Ruff Format | ||
uses: chartboost/ruff-action@v1 | ||
with: | ||
version: 0.6.7 | ||
args: "format --check" | ||
src: "./packages/nameguard-python" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: NameGuard API - PyPI Package Release | ||
name: NameGuard Python - PyPI Package Release | ||
|
||
on: | ||
release: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: NameGuard API - Unit Tests | ||
name: NameGuard Python - Unit Tests | ||
on: | ||
schedule: | ||
- cron: '0 5 * * 0' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: NameRank API - Lambda Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- staging | ||
paths: | ||
- "packages/namerank-python/**" | ||
- "apps/api.namerank.io/**" | ||
- ".github/workflows/namerank-api-lambda-deploy.yml" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
# `id-token: write` is required for the auth to AWS | ||
id-token: write | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
# `cancel-in-progress: false` creates a queue for workflow runs, such that | ||
# only one instance of this workflow runs at a time. | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build-image-deploy: | ||
name: Build and deploy NameRank API Lambda | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE}} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: arm64 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_version: "1.5.7" | ||
terraform_wrapper: false | ||
|
||
|
||
- name: Build and deploy lambda | ||
env: | ||
PROVIDER_URI_MAINNET: ${{ secrets.PROVIDER_URI_MAINNET }} | ||
PROVIDER_URI_SEPOLIA: ${{ secrets.PROVIDER_URI_SEPOLIA }} | ||
ALCHEMY_URI_MAINNET: ${{ secrets.ALCHEMY_URI_MAINNET }} | ||
ALCHEMY_URI_SEPOLIA: ${{ secrets.ALCHEMY_URI_SEPOLIA }} | ||
ENS_SUBGRAPH_URL_MAINNET: ${{ secrets.ENS_SUBGRAPH_URL_MAINNET }} | ||
ENS_SUBGRAPH_URL_SEPOLIA: ${{ secrets.ENS_SUBGRAPH_URL_SEPOLIA }} | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
CERTIFICATE_NAME: ${{ secrets.NAMERANK_CERTIFICATE_NAME }} | ||
HOSTED_ZONE_NAME: ${{ secrets.NAMERANK_HOSTED_ZONE_NAME }} | ||
run: | | ||
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then | ||
STAGE="prod" | ||
DOMAIN_NAME=${{ secrets.NAMERANK_PROD_DOMAIN_NAME }} | ||
elif [[ ${{ github.ref }} == 'refs/heads/staging' ]]; then | ||
STAGE="staging" | ||
DOMAIN_NAME=${{ secrets.NAMERANK_STAGING_DOMAIN_NAME }} | ||
else | ||
echo "Deployment is only supported for main and staging branches" | ||
exit 1 | ||
fi | ||
cd terraform | ||
chmod +x ./deploy_lambda.sh | ||
./deploy_lambda.sh $STAGE $AWS_REGION $DOMAIN_NAME $CERTIFICATE_NAME $HOSTED_ZONE_NAME | ||
working-directory: apps/api.namerank.io | ||
|
||
notify: | ||
name: Send Slack deployment event notification | ||
needs: [build-image-deploy] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Output status on deployment success | ||
if: ${{ needs.build-image-deploy.result == 'success'}} | ||
run: | | ||
echo "STATUS=Success :rocket:" >> $GITHUB_ENV | ||
echo "TEXT=Lambda NameRank deployed successfully! :white_check_mark:" >> $GITHUB_ENV | ||
echo "COLOR=good" >> $GITHUB_ENV | ||
- name: Output status on deployment failed | ||
if: ${{ needs.build-image-deploy.result == 'failure' }} | ||
run: | | ||
echo "STATUS=Failure :x:" >> $GITHUB_ENV | ||
echo "TEXT=Lambda NameRank deployment failed! :rotating_light:" >> $GITHUB_ENV | ||
echo "COLOR=danger" >> $GITHUB_ENV | ||
- name: Output status on deployment cancellation | ||
if: ${{ needs.build-image-deploy.result == 'cancelled' }} | ||
run: | | ||
echo "STATUS=Cancelled :no_entry_sign:" >> $GITHUB_ENV | ||
echo "TEXT=Lambda NameRank deployment was cancelled. :warning:" >> $GITHUB_ENV | ||
echo "COLOR=warning" >> $GITHUB_ENV | ||
- name: Send deployment status Slack notification | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: custom | ||
fields: commit,workflow,repo | ||
custom_payload: | | ||
{ | ||
attachments: [{ | ||
color: '${{ env.COLOR }}', | ||
title: 'Lambda NameRank deployment.', | ||
text: '${{ env.TEXT }}', | ||
fields: [ | ||
{ | ||
title: 'Repository', | ||
value: `${process.env.AS_REPO}`, | ||
short: true | ||
}, | ||
{ | ||
title: 'Status', | ||
value: '${{ env.STATUS }}', | ||
short: true | ||
}, | ||
{ | ||
title: 'Workflow', | ||
value: `${process.env.AS_WORKFLOW}`, | ||
short: true | ||
} | ||
] | ||
}] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: NameRank Python - Unit Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "apps/api.namerank.io/**" | ||
pull_request: | ||
branches: | ||
- main | ||
- staging | ||
paths: | ||
- "apps/api.namerank.io/**" | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- name: Checkout NameKit repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "poetry" | ||
|
||
- name: Install dependencies | ||
working-directory: ./apps/api.namerank.io | ||
run: poetry install | ||
|
||
- name: Run tests | ||
working-directory: ./apps/api.namerank.io | ||
run: poetry run pytest -vv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ __pycache__ | |
.turbo | ||
.next | ||
.vercel | ||
.pytest_cache | ||
.ruff_cache | ||
|
||
*storybook.log | ||
storybook-static | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"credsStore": "ecr-login" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Provider URIs (can be any Ethereum node, e.g. Infura, Alchemy, your own node, etc.). | ||
# The following example values are rate limited. | ||
# Sign up for your own node provider (e.g. Infura, Alchemy, etc.) to remove rate limits. | ||
PROVIDER_URI_MAINNET=https://rpc.ankr.com/eth | ||
PROVIDER_URI_SEPOLIA=https://rpc.ankr.com/eth_sepolia | ||
|
||
# Alchemy API URIs (needed for their NFT API for NameGuard's fake ENS NFT checks) | ||
# Replace [YOUR_ALCHEMY_API_KEY] with your actual Alchemy API key). | ||
# Sign up for a free account at https://www.alchemy.com/ | ||
ALCHEMY_URI_MAINNET=https://eth-mainnet.g.alchemy.com/v2/[YOUR_ALCHEMY_API_KEY] | ||
ALCHEMY_URI_SEPOLIA=https://eth-sepolia.g.alchemy.com/v2/[YOUR_ALCHEMY_API_KEY] | ||
|
||
# ENS Subgraph URLs | ||
# The following example values are rate limited. | ||
# You're highly encouraged to sign up for your own API key. | ||
# For more details, see: | ||
# - https://docs.ens.domains/web/subgraph | ||
# - https://discuss.ens.domains/t/ens-subgraph-migration-to-the-decentralised-version/19183 | ||
# - https://thegraph.com/explorer/subgraphs/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH?view=Query&chain=arbitrum-one | ||
ENS_SUBGRAPH_URL_MAINNET=https://api.thegraph.com/subgraphs/name/ensdomains/ens | ||
ENS_SUBGRAPH_URL_SEPOLIA=https://api.studio.thegraph.com/query/49574/enssepolia/version/latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM --platform=linux/arm64 public.ecr.aws/lambda/python:3.11 | ||
WORKDIR /app | ||
RUN yum install gcc -y | ||
COPY pyproject.toml poetry.lock LICENSE README.md ./ | ||
COPY namerank ./namerank/ | ||
RUN pip install --no-cache-dir .[namerank] | ||
CMD [ "namerank.root_api.handler" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO |
Oops, something went wrong.