-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
3e51965
commit bd8b329
Showing
19 changed files
with
2,616 additions
and
69 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,46 @@ | ||
name: Build & Push | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
PROJECT_NAME: copilot | ||
PYTHON_VERSION: "3.11.2" | ||
|
||
jobs: | ||
build_and_push: | ||
name: Build & Push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Pritunl Profile and Start VPN Connection | ||
uses: nathanielvarona/pritunl-client-github-action@v1 | ||
with: | ||
profile-file: ${{ secrets.PRITUNL_PROFILE_FILE_PRODUCTION }} | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ vars.AWS_IAM_ROLE }} | ||
aws-region: ${{ vars.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Build, tag, and push docker image to Amazon ECR | ||
env: | ||
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
REPOSITORY: ${{ env.PROJECT_NAME }} | ||
COMMIT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | ||
run: | | ||
docker build --build-arg GIT_COMMIT=$COMMIT_SHA -t $REGISTRY/$REPOSITORY:$COMMIT_SHA --platform linux/amd64 --memory=3072m -f Dockerfile . | ||
docker push $REGISTRY/$REPOSITORY:$COMMIT_SHA |
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,38 @@ | ||
name: Deploy to AWS EKS (production) | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
PROJECT_NAME: copilot | ||
PYTHON_VERSION: "3.11.2" | ||
|
||
jobs: | ||
deploy_to_production: | ||
name: Deploy to production | ||
runs-on: ubuntu-latest | ||
environment: production | ||
concurrency: | ||
group: production | ||
cancel-in-progress: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Pritunl Profile and Start VPN Connection | ||
uses: nathanielvarona/pritunl-client-github-action@v1 | ||
with: | ||
profile-file: ${{ secrets.PRITUNL_PROFILE_FILE_PRODUCTION }} | ||
|
||
- name: Deploy Helm chart to AWS EKS | ||
uses: bitovi/[email protected] | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PRODUCTION }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PRODUCTION }} | ||
aws-region: ${{ vars.AWS_REGION }} | ||
cluster-name: dema-ai-production | ||
chart-path: k8s-helm | ||
name: ${{ env.PROJECT_NAME }} | ||
namespace: prod | ||
values: env=prod,image.repository=${{ vars.AWS_ECR_REGISTRY }}/${{ env.PROJECT_NAME }},image.tag=${{ github.sha }} | ||
# values: env=prod,image.repository=${{ vars.AWS_ECR_REGISTRY }}/${{ env.PROJECT_NAME }},image.tag=${{ github.sha }},S3_ACC_KEY=${{ secrets.S3_ACC_KEY_PROD }},S3_SEC_ACC_KEY=${{ secrets.S3_SEC_ACC_KEY_PROD }},slack.bot.token=${{ secrets.SLACK_REPLAY_BOT_TOKEN }} | ||
# config-files: k8s-helm/values.production.yaml |
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,38 @@ | ||
name: Deploy to AWS EKS (staging) | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
PROJECT_NAME: copilot | ||
PYTHON_VERSION: "3.11.2" | ||
|
||
jobs: | ||
deploy_to_staging: | ||
name: Deploy to staging | ||
runs-on: ubuntu-latest | ||
environment: staging | ||
concurrency: | ||
group: staging | ||
cancel-in-progress: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Pritunl Profile and Start VPN Connection | ||
uses: nathanielvarona/pritunl-client-github-action@v1 | ||
with: | ||
profile-file: ${{ secrets.PRITUNL_PROFILE_FILE_STAGING }} | ||
|
||
- name: Deploy Helm chart to AWS EKS | ||
uses: bitovi/[email protected] | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} | ||
aws-region: ${{ vars.AWS_REGION }} | ||
cluster-name: dema-ai-staging | ||
chart-path: k8s-helm | ||
name: ${{ env.PROJECT_NAME }} | ||
namespace: prod | ||
values: env=staging,image.repository=${{ vars.AWS_ECR_REGISTRY }}/${{ env.PROJECT_NAME }},image.tag=${{ github.sha }} | ||
# values: env=staging,image.repository=${{ vars.AWS_ECR_REGISTRY }}/${{ env.PROJECT_NAME }},image.tag=${{ github.sha }},S3_ACC_KEY=${{ secrets.S3_ACC_KEY_STAG }},S3_SEC_ACC_KEY=${{ secrets.S3_SEC_ACC_KEY_STAG }},slack.bot.token=${{ secrets.SLACK_REPLAY_BOT_TOKEN }} | ||
# config-files: k8s-helm/values.staging.yaml |
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,75 @@ | ||
name: Test and Lint | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
PROJECT_NAME: copilot | ||
PYTHON_VERSION: "3.11.2" | ||
|
||
jobs: | ||
install_dependencies: | ||
name: Install Dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: "pip" | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install pytest-cov==4.1.0 pytest==7.4.3 \ | ||
poetry==1.7.1 poetry-plugin-export==1.6.0 \ | ||
pre-commit==3.5.0 ruff==0.1.6 | ||
linting: | ||
name: Code Linting | ||
needs: install_dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: "pip" | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install pytest-cov==4.1.0 pytest==7.4.3 \ | ||
poetry==1.7.1 poetry-plugin-export==1.6.0 \ | ||
pre-commit==3.5.0 ruff==0.1.6 | ||
- name: Run Code Linting | ||
run: | | ||
ruff --output-format=github --fix --unsafe-fixes src | ||
make lint | ||
unit_tests: | ||
name: Unit Tests | ||
needs: install_dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: "pip" | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install pytest-cov==4.1.0 pytest==7.4.3 \ | ||
poetry==1.7.1 poetry-plugin-export==1.6.0 \ | ||
pre-commit==3.5.0 ruff==0.1.6 | ||
- name: Run unit tests | ||
run: | | ||
pip install -e . | ||
make test |
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
Oops, something went wrong.