-
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
0 parents
commit fa2943c
Showing
63 changed files
with
3,094 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 @@ | ||
__pycache__ |
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,48 @@ | ||
name: pr-test | ||
|
||
# 1. Runs tests | ||
# 2. Upload coverage | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
install: true | ||
|
||
- name: Bring up DBs | ||
run: docker-compose -f docker-compose.db.yml up -d | ||
|
||
- name: Run unit tests | ||
run: cd src && go test -v -covermode=atomic -coverprofile=coverage.out ./... | ||
|
||
- uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.out | ||
flags: unit | ||
fail_ci_if_error: true | ||
|
||
- name: Bring up stack | ||
run: make up | ||
|
||
- name: Run integration tests | ||
run: cd tests && go test -v -covermode=atomic -coverprofile=coverage.out ./... | ||
|
||
- uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.out | ||
flags: integration | ||
fail_ci_if_error: 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,49 @@ | ||
name: push-chart | ||
|
||
# 1. Run unit and integration tests on chart | ||
# 2. Release the chart | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'chart/**' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Minikube | ||
uses: manusa/[email protected] | ||
with: | ||
minikube version: 'v1.16.0' | ||
kubernetes version: 'v1.19.2' | ||
|
||
- name: Test | ||
run: | | ||
sudo apt-get -y install socat | ||
export KUBE_CONFIG_PATH=$HOME/.kube/config | ||
cd chart/test | ||
go test . | ||
cd ../.. | ||
- name: Configure Git | ||
run: | | ||
git config user.name "geometrybot" | ||
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.4.0 | ||
|
||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
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,145 @@ | ||
name: push-main | ||
|
||
# 1. Run unit and integration tests | ||
# 2. Push containers to AWS ECR with tag based on incrementing build number | ||
# 3. Recommit an update to the chart's deployments with the updated build number in the `deployment` branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- 'chart/**' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install deps | ||
run: | | ||
pip3 install -r requirements_api.txt -r requirements_worker.txt -r requirements_dev.txt | ||
pip3 install --upgrade protobuf | ||
- name: Bring up stack | ||
run: make up-dbs && sleep 30 | ||
|
||
- name: Check stack | ||
run: make ps | ||
|
||
- name: Run tests with coverage | ||
run: make test-coverage | ||
|
||
- uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./.coverage | ||
fail_ci_if_error: true | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_WORKER }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_WORKER }} | ||
aws-region: us-west-2 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr-worker | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Worker - Build, tag, and push image to Amazon ECR | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr-worker.outputs.registry }} | ||
ECR_REPOSITORY: icon-metrics-worker | ||
IMAGE_TAG: ${{ github.run_number }} | ||
run: | | ||
docker build --target prod --build-arg SERVICE_NAME=worker -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_API }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_API }} | ||
aws-region: us-west-2 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr-api | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: API - Build, tag, and push image to Amazon ECR | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr-api.outputs.registry }} | ||
ECR_REPOSITORY: icon-metrics-api | ||
IMAGE_TAG: ${{ github.run_number }} | ||
run: | | ||
docker build --target prod --build-arg SERVICE_NAME=api -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
- name: Merge main -> deployment-dev | ||
uses: devmasx/[email protected] | ||
with: | ||
type: now | ||
from_branch: main | ||
target_branch: deployment-dev | ||
github_token: ${{ github.token }} | ||
|
||
- name: Checkout dev deployment | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: deployment-dev | ||
path: deployment-dev | ||
|
||
- name: Update dev-mainnet deployment values file (API) and re-commit | ||
uses: fjogeleit/yaml-update-action@master | ||
with: | ||
valueFile: 'chart/deployments/dev-mainnet/values.dev.yaml' | ||
propertyPath: 'api.image.tag' | ||
value: ${{ github.run_number }} | ||
branch: deployment-dev | ||
createPR: 'false' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
updateFile: true | ||
commitChange: false | ||
workDir: deployment-dev | ||
|
||
- name: Update dev-mainnet deployment values file (WORKER) and re-commit | ||
uses: fjogeleit/yaml-update-action@master | ||
with: | ||
valueFile: 'chart/deployments/dev-mainnet/values.dev.yaml' | ||
propertyPath: 'worker.image.tag' | ||
value: ${{ github.run_number }} | ||
branch: deployment-dev | ||
createPR: 'false' | ||
message: 'Update dev deployment (mainnet) image versions to ${{ github.run_number }}' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
updateFile: true | ||
workDir: deployment-dev | ||
|
||
# - name: Update dev-mainnet deployment values file (API) and re-commit | ||
# uses: fjogeleit/yaml-update-action@master | ||
# with: | ||
# valueFile: 'chart/deployments/dev-sejong/values.dev.yaml' | ||
# propertyPath: 'api.image.tag' | ||
# value: ${{ github.run_number }} | ||
# branch: deployment-dev | ||
# createPR: 'false' | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# updateFile: true | ||
# commitChange: false | ||
# workDir: deployment-dev | ||
# | ||
# - name: Update dev-mainnet deployment values file (WORKER) and re-commit | ||
# uses: fjogeleit/yaml-update-action@master | ||
# with: | ||
# valueFile: 'chart/deployments/dev-sejong/values.dev.yaml' | ||
# propertyPath: 'worker.image.tag' | ||
# value: ${{ github.run_number }} | ||
# branch: deployment-dev | ||
# createPR: 'false' | ||
# message: 'Update dev deployment (sejong) image versions to ${{ github.run_number }}' | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# updateFile: true | ||
# workDir: deployment-dev |
Oops, something went wrong.