Skip to content

Commit 5c6900f

Browse files
committed
Merge branch 'byczong/sc-25983/add-namerank-to-monorepo' into staging
2 parents 5d4cb81 + baf12ea commit 5c6900f

87 files changed

Lines changed: 2412729 additions & 170 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/nameguard-api-lambda-deploy.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ jobs:
7676
cd terraform
7777
chmod +x ./deploy_lambda.sh
7878
./deploy_lambda.sh $STAGE $AWS_REGION $DOMAIN_NAME $CERTIFICATE_NAME $HOSTED_ZONE_NAME
79-
8079
working-directory: apps/api.nameguard.io
8180

8281
notify:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: NameGuard Python - Lint
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- "packages/nameguard-python/**"
8+
pull_request:
9+
branches: ["main", "staging"]
10+
paths:
11+
- "packages/nameguard-python/**"
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout NameKit repo
18+
uses: actions/checkout@v4
19+
20+
- name: Ruff Check
21+
uses: chartboost/ruff-action@v1
22+
with:
23+
version: 0.6.7
24+
src: "./packages/nameguard-python"
25+
26+
- name: Ruff Format
27+
uses: chartboost/ruff-action@v1
28+
with:
29+
version: 0.6.7
30+
args: "format --check"
31+
src: "./packages/nameguard-python"

.github/workflows/nameguard-python-pypi-package-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: NameGuard API - PyPI Package Release
1+
name: NameGuard Python - PyPI Package Release
22

33
on:
44
release:

.github/workflows/nameguard-python-unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: NameGuard API - Unit Tests
1+
name: NameGuard Python - Unit Tests
22
on:
33
schedule:
44
- cron: '0 5 * * 0'
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: NameRank API - Lambda Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- staging
8+
paths:
9+
- "packages/namerank-python/**"
10+
- "apps/api.namerank.io/**"
11+
- ".github/workflows/namerank-api-lambda-deploy.yml"
12+
workflow_dispatch:
13+
14+
permissions:
15+
# `id-token: write` is required for the auth to AWS
16+
id-token: write
17+
contents: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}
21+
# `cancel-in-progress: false` creates a queue for workflow runs, such that
22+
# only one instance of this workflow runs at a time.
23+
cancel-in-progress: false
24+
25+
jobs:
26+
build-image-deploy:
27+
name: Build and deploy NameRank API Lambda
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout this repo
31+
uses: actions/checkout@v4
32+
33+
- name: Configure AWS credentials
34+
uses: aws-actions/configure-aws-credentials@v4
35+
with:
36+
role-to-assume: ${{ secrets.AWS_ROLE}}
37+
aws-region: ${{ secrets.AWS_REGION }}
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
with:
42+
platforms: arm64
43+
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
47+
- name: Setup Terraform
48+
uses: hashicorp/setup-terraform@v2
49+
with:
50+
terraform_version: "1.5.7"
51+
terraform_wrapper: false
52+
53+
54+
- name: Build and deploy lambda
55+
env:
56+
PROVIDER_URI_MAINNET: ${{ secrets.PROVIDER_URI_MAINNET }}
57+
PROVIDER_URI_SEPOLIA: ${{ secrets.PROVIDER_URI_SEPOLIA }}
58+
ALCHEMY_URI_MAINNET: ${{ secrets.ALCHEMY_URI_MAINNET }}
59+
ALCHEMY_URI_SEPOLIA: ${{ secrets.ALCHEMY_URI_SEPOLIA }}
60+
ENS_SUBGRAPH_URL_MAINNET: ${{ secrets.ENS_SUBGRAPH_URL_MAINNET }}
61+
ENS_SUBGRAPH_URL_SEPOLIA: ${{ secrets.ENS_SUBGRAPH_URL_SEPOLIA }}
62+
AWS_REGION: ${{ secrets.AWS_REGION }}
63+
CERTIFICATE_NAME: ${{ secrets.NAMERANK_CERTIFICATE_NAME }}
64+
HOSTED_ZONE_NAME: ${{ secrets.NAMERANK_HOSTED_ZONE_NAME }}
65+
run: |
66+
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
67+
STAGE="prod"
68+
DOMAIN_NAME=${{ secrets.NAMERANK_PROD_DOMAIN_NAME }}
69+
elif [[ ${{ github.ref }} == 'refs/heads/staging' ]]; then
70+
STAGE="staging"
71+
DOMAIN_NAME=${{ secrets.NAMERANK_STAGING_DOMAIN_NAME }}
72+
else
73+
echo "Deployment is only supported for main and staging branches"
74+
exit 1
75+
fi
76+
cd terraform
77+
chmod +x ./deploy_lambda.sh
78+
./deploy_lambda.sh $STAGE $AWS_REGION $DOMAIN_NAME $CERTIFICATE_NAME $HOSTED_ZONE_NAME
79+
working-directory: apps/api.namerank.io
80+
81+
notify:
82+
name: Send Slack deployment event notification
83+
needs: [build-image-deploy]
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Output status on deployment success
87+
if: ${{ needs.build-image-deploy.result == 'success'}}
88+
run: |
89+
echo "STATUS=Success :rocket:" >> $GITHUB_ENV
90+
echo "TEXT=Lambda NameRank deployed successfully! :white_check_mark:" >> $GITHUB_ENV
91+
echo "COLOR=good" >> $GITHUB_ENV
92+
93+
- name: Output status on deployment failed
94+
if: ${{ needs.build-image-deploy.result == 'failure' }}
95+
run: |
96+
echo "STATUS=Failure :x:" >> $GITHUB_ENV
97+
echo "TEXT=Lambda NameRank deployment failed! :rotating_light:" >> $GITHUB_ENV
98+
echo "COLOR=danger" >> $GITHUB_ENV
99+
100+
- name: Output status on deployment cancellation
101+
if: ${{ needs.build-image-deploy.result == 'cancelled' }}
102+
run: |
103+
echo "STATUS=Cancelled :no_entry_sign:" >> $GITHUB_ENV
104+
echo "TEXT=Lambda NameRank deployment was cancelled. :warning:" >> $GITHUB_ENV
105+
echo "COLOR=warning" >> $GITHUB_ENV
106+
107+
- name: Send deployment status Slack notification
108+
uses: 8398a7/action-slack@v3
109+
with:
110+
status: custom
111+
fields: commit,workflow,repo
112+
custom_payload: |
113+
{
114+
attachments: [{
115+
color: '${{ env.COLOR }}',
116+
title: 'Lambda NameRank deployment.',
117+
text: '${{ env.TEXT }}',
118+
fields: [
119+
{
120+
title: 'Repository',
121+
value: `${process.env.AS_REPO}`,
122+
short: true
123+
},
124+
{
125+
title: 'Status',
126+
value: '${{ env.STATUS }}',
127+
short: true
128+
},
129+
{
130+
title: 'Workflow',
131+
value: `${process.env.AS_WORKFLOW}`,
132+
short: true
133+
}
134+
]
135+
}]
136+
}
137+
env:
138+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL}}
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
name: NameGuard API - Lint
1+
name: NameRank Python - Lint
22
on:
33
push:
44
branches:
55
- main
6+
paths:
7+
- "apps/api.namerank.io/**"
68
pull_request:
79
branches: ["main", "staging"]
10+
paths:
11+
- "apps/api.namerank.io/**"
12+
813
jobs:
914
lint:
1015
runs-on: ubuntu-latest
@@ -15,10 +20,12 @@ jobs:
1520
- name: Ruff Check
1621
uses: chartboost/ruff-action@v1
1722
with:
18-
version: 0.1.8
23+
version: 0.6.7
24+
src: "./apps/api.namerank.io"
1925

2026
- name: Ruff Format
2127
uses: chartboost/ruff-action@v1
2228
with:
23-
version: 0.1.8
29+
version: 0.6.7
2430
args: "format --check"
31+
src: "./apps/api.namerank.io"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: NameRank Python - Unit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "apps/api.namerank.io/**"
9+
pull_request:
10+
branches:
11+
- main
12+
- staging
13+
paths:
14+
- "apps/api.namerank.io/**"
15+
16+
jobs:
17+
test:
18+
runs-on: ${{ matrix.os }}
19+
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest]
23+
python-version: ["3.10", "3.11", "3.12"]
24+
25+
steps:
26+
- name: Checkout NameKit repo
27+
uses: actions/checkout@v4
28+
29+
- name: Install poetry
30+
run: pipx install poetry
31+
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
cache: "poetry"
37+
38+
- name: Install dependencies
39+
working-directory: ./apps/api.namerank.io
40+
run: poetry install
41+
42+
- name: Run tests
43+
working-directory: ./apps/api.namerank.io
44+
run: poetry run pytest -vv

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ __pycache__
88
.turbo
99
.next
1010
.vercel
11+
.pytest_cache
12+
.ruff_cache
1113

1214
*storybook.log
1315
storybook-static

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ repos:
44
hooks:
55
- id: ruff
66
args: [ --fix ]
7-
files: '^packages/nameguard-python/.*\.py'
7+
files: '^(packages/nameguard-python|apps/api.namerank.io)/.*\.py'
88
- id: ruff-format
9-
files: '^packages/nameguard-python/.*\.py'
9+
files: '^(packages/nameguard-python|apps/api.namerank.io)/.*\.py'

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,3 @@ We use [Storybook](https://storybook.namekit.io/) to preview components across o
514514
- `@namehash/ens-webfont`
515515
- `@namehash/ui`
516516
- These components are mostly internal and not intended for public use, but they are used across our packages.
517-
518-
## Tailwind Configuration
519-
520-
When configuring Tailwind CSS for use with this project, please note the following:
521-
522-
If you're using the `@tailwindcss/forms` plugin in your `tailwind.config.ts`, you may encounter some styling conflicts with our components. To resolve this, you should use the plugin with the class strategy applied. Here's an example of how to configure it: https://github.com/tailwindlabs/tailwindcss-forms?tab=readme-ov-file#using-only-global-styles-or-only-classes

0 commit comments

Comments
 (0)