-
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.
- Loading branch information
Showing
126 changed files
with
11,216 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
**/__pycache__ | ||
.data/ | ||
.git/ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
AJNA_DB_HOST=127.0.0.1 | ||
AJNA_DB_PASSWORD=postgres | ||
AJNA_DB_PORT=5436 | ||
AJNA_DEBUG=1 | ||
AJNA_DB_NAME=ajna | ||
AJNA_DB_USER=ajna | ||
AJNA_INTERNAL_IPS=172.18.0.1;0.0.0.0;localhost;127.0.0.1 | ||
DJANGO_SETTINGS_MODULE=config.settings.local | ||
AJNA_REDIS_HOST=127.0.0.1 | ||
AJNA_REDIS_PORT=6375 | ||
AJNA_LOG_LEVEL=DEBUG | ||
SUBGRAPH_ENDPOINT= |
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,14 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" | ||
directory: "/requirements" | ||
schedule: | ||
interval: "weekly" | ||
commit-message: | ||
prefix: "chore" | ||
include: "scope" | ||
reviewers: | ||
- "0xCommanderKeen" | ||
labels: | ||
- "dependencies" | ||
- "automerge" |
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,76 @@ | ||
name: Deploy Production | ||
|
||
concurrency: deploy_production | ||
|
||
on: | ||
push: | ||
branches: | ||
- production | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
|
||
build-and-push: | ||
name: Build and push to ECR | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: production | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-west-1 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: ajna-api | ||
IMAGE_TAG: production-${{ github.sha }} | ||
run: | | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
deploy: | ||
needs: [build-and-push] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: production | ||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.10.9 | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ecs-deploy==1.12.1 | ||
- name: Deploy new api version | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: eu-west-1 | ||
run: ecs deploy ajna-cluster ajna-api --tag production-${{ github.sha }} --timeout -1 | ||
- name: Deploy new celery beat version | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: eu-west-1 | ||
run: ecs deploy ajna-cluster ajna-celery-beat --tag production-${{ github.sha }} --timeout -1 | ||
- name: Deploy new celery worker default version | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: eu-west-1 | ||
run: ecs deploy ajna-cluster ajna-celery-worker-default --tag production-${{ github.sha }} --timeout -1 |
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,64 @@ | ||
name: Deploy Staging | ||
|
||
concurrency: deploy_staging | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
|
||
build-and-push: | ||
name: Build and push to ECR | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-west-1 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: ajna-api | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
deploy: | ||
needs: [build-and-push] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.10.9 | ||
cache: "pip" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ecs-deploy==1.12.1 | ||
- name: Deploy new api version | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: eu-west-1 | ||
run: ecs deploy ajna-cluster ajna-api-staging --tag ${{ github.sha }} --timeout -1 |
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,36 @@ | ||
name: Pull request format check | ||
|
||
on: | ||
pull_request: | ||
types: [ opened, reopened, synchronize, edited ] | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check-pull-request: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 'Pull Request - Title verification (starts with "feat: PR title" or "Merge pull request...")' | ||
if: always() | ||
uses: gsactions/commit-message-checker@v1 | ||
with: | ||
pattern: '^(?:feat|fix|docs|style|refactor|revert|perf|test|build|ci|chore(deps)|deps)\!?: .+| [A-Za-z].+$' | ||
flags: 'g' | ||
error: 'Pull request - Title not in correct format (e.g.: "feat: Short title" or "revert: Short title")' | ||
excludeDescription: 'true' | ||
|
||
- name: Pull Request - Title verification (must not end with "." dot) | ||
uses: gsactions/commit-message-checker@v1 | ||
with: | ||
pattern: '^.+[^\.]$' | ||
error: 'Pull request - Title must not end with dot "."' | ||
excludeDescription: 'true' | ||
|
||
- name: Pull Request - Title length validation | ||
if: always() | ||
uses: gsactions/commit-message-checker@v1 | ||
with: | ||
pattern: '^[^#].{0,80}$' | ||
error: 'Pull Request - Maximum title line length is 80 characters' | ||
excludeDescription: 'true' |
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,24 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: simple | ||
version-file: VERSION | ||
- uses: peterjgrainger/action-create-branch@v2.2.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
branch: "release/${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" | ||
if: ${{ steps.release.outputs.release_created }} |
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,68 @@ | ||
name: Test | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11.2 | ||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ runner.os }}-${{ hashFiles('**/lint-requirements.txt') }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r lint-requirements.txt | ||
- name: Lint with flake8 | ||
run: flake8 . | ||
- name: Run black check | ||
run: black --check . | ||
- name: Run isort check | ||
run: isort . --check | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
db: | ||
image: postgres:13.2 | ||
env: | ||
POSTGRES_DB: ajna | ||
POSTGRES_USER: ajna | ||
POSTGRES_PASSWORD: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.10.9 | ||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ runner.os }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dev-requirements.txt') }} | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Run pytest | ||
run: pytest --ds=config.settings.test tests/ | ||
env: | ||
AJNA_DB_NAME: ajna | ||
AJNA_DB_USER: ajna | ||
AJNA_DB_HOST: localhost | ||
AJNA_DB_PASSWORD: postgres |
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,11 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- production | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml |
Oops, something went wrong.