Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into sebastianbana/sc-2608…
Browse files Browse the repository at this point in the history
…2/adopt-ci-cd-process-to-namerank-nameai-rebrand
  • Loading branch information
BanaSeba committed Jan 10, 2025
2 parents 8824ecc + b1742c9 commit 3d34e4e
Show file tree
Hide file tree
Showing 61 changed files with 185 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
- main
- staging
paths:
- "packages/namerank-python/**"
- "apps/api.namerank.io/**"
- ".github/workflows/namerank-api-lambda-deploy.yml"
- "packages/nameai-python/**"
- "apps/api.nameai.dev/**"
- ".github/workflows/nameai-api-lambda-deploy.yml"
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -60,23 +60,23 @@ jobs:
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.NAMEAI_CERTIFICATE_NAME }}
HOSTED_ZONE_NAME: ${{ secrets.NAMEAI_HOSTED_ZONE_NAME }}
CERTIFICATE_NAME: ${{ secrets.NAMERANK_CERTIFICATE_NAME }} # todo: rename secrets to NAMEAI_* (?)
HOSTED_ZONE_NAME: ${{ secrets.NAMERANK_HOSTED_ZONE_NAME }}
run: |
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
STAGE="prod"
DOMAIN_NAME=${{ secrets.NAMEAI_PROD_DOMAIN_NAME }}
DOMAIN_NAME=${{ secrets.NAMERANK_PROD_DOMAIN_NAME }}
elif [[ ${{ github.ref }} == 'refs/heads/staging' ]]; then
STAGE="staging"
DOMAIN_NAME=${{ secrets.NAMEAI_STAGING_DOMAIN_NAME }}
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
working-directory: apps/api.nameai.dev

notify:
name: Send Slack deployment event notification
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: NameRank Python - Lint
name: NameAI Python - Lint
on:
push:
branches:
- main
paths:
- "apps/api.namerank.io/**"
- "apps/api.nameai.dev/**"
pull_request:
branches: ["main", "staging"]
paths:
- "apps/api.namerank.io/**"
- "apps/api.nameai.dev/**"

jobs:
lint:
Expand All @@ -21,11 +21,11 @@ jobs:
uses: chartboost/ruff-action@v1
with:
version: 0.6.7
src: "./apps/api.namerank.io"
src: "./apps/api.nameai.dev"

- name: Ruff Format
uses: chartboost/ruff-action@v1
with:
version: 0.6.7
args: "format --check"
src: "./apps/api.namerank.io"
src: "./apps/api.nameai.dev"
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: NameRank Python - Unit Tests
name: NameAI Python - Unit Tests

on:
push:
branches:
- main
paths:
- "apps/api.namerank.io/**"
- "apps/api.nameai.dev/**"
pull_request:
branches:
- main
- staging
paths:
- "apps/api.namerank.io/**"
- "apps/api.nameai.dev/**"

jobs:
test:
Expand All @@ -36,9 +36,9 @@ jobs:
cache: "poetry"

- name: Install dependencies
working-directory: ./apps/api.namerank.io
working-directory: ./apps/api.nameai.dev
run: poetry install --extras "lambda"

- name: Run tests
working-directory: ./apps/api.namerank.io
working-directory: ./apps/api.nameai.dev
run: poetry run pytest -vv
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ repos:
hooks:
- id: ruff
args: [ --fix ]
files: '^(packages/nameguard-python|apps/api.namerank.io)/.*\.py'
files: '^(packages/nameguard-python|apps/api.nameai.dev)/.*\.py'
- id: ruff-format
files: '^(packages/nameguard-python|apps/api.namerank.io)/.*\.py'
files: '^(packages/nameguard-python|apps/api.nameai.dev)/.*\.py'
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ 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/
COPY nameai ./nameai/
RUN pip install --no-cache-dir .[lambda]
CMD [ "namerank.root_api.handler" ]
CMD [ "nameai.root_api.handler" ]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
## API
The API extends the NameGuard API and is fully compatible with it.

NameAI-specific endpoints are under the [api.nameai.io/nameai](https://www.api.nameai.io/nameai) path prefix.
NameAI-specific endpoints are under the [api.nameai.dev/nameai](https://www.api.nameai.dev/nameai) path prefix.

API documentation is available at [api.nameai.io/nameai/docs](https://api.nameai.io/nameai/docs) and [api.nameai.io/docs](https://api.nameai.io/docs) for NameGuard.
API documentation is available at [api.nameai.dev/nameai/docs](https://api.nameai.dev/nameai/docs) and [api.nameai.dev/docs](https://api.nameai.dev/docs) for NameGuard.

Lambda is publicly accessible under given domain [api.nameai.io](https://api.nameai.io)
Lambda is publicly accessible under given domain [api.nameai.dev](https://api.nameai.dev)

# AWS deploy
## Requirements
Expand Down Expand Up @@ -106,4 +106,4 @@ python3 with pip installed on local env

## Scripts
Running [start-local.sh](./start-local.sh) script will result in creating running NameAI instance on local environment.
This instance can be reached under [localhost:8000](localhost:8000)
This instance can be reached under [localhost:8000](localhost:8000)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from typing import Tuple, Iterable
import ahocorasick

from namerank.data import get_resource_path
from namerank.static_property import static_property
from nameai.data import get_resource_path
from nameai.static_property import static_property


class Gap(str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@


@contextmanager
def initialize_namerank_config(config_name: Literal['prod_config']):
with initialize_config_module(version_base=None, config_module='namerank.config'):
def initialize_nameai_config(config_name: Literal['prod_config']):
with initialize_config_module(version_base=None, config_module='nameai.config'):
config = compose(config_name=config_name)
yield config


def load_namerank_config(config_name: Literal['prod_config']):
def load_nameai_config(config_name: Literal['prod_config']):
config_path = Path(__file__).parent / (config_name + '.yaml')
with config_path.open('r') as f:
config = omegaconf.OmegaConf.load(f)
Expand Down
Loading

0 comments on commit 3d34e4e

Please sign in to comment.