Skip to content

Commit 2315c83

Browse files
committed
add cd workflow
1 parent 83e31ab commit 2315c83

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/cd.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: 'Continuous Delivery'
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- release/*
8+
pull_request:
9+
branches:
10+
- develop
11+
- release/*
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: '3.9'
25+
26+
- name: Cache dependencies
27+
uses: actions/cache@v2
28+
with:
29+
path: ~/.cache/pip
30+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
make install
38+
39+
- name: Set up Google Cloud SDK
40+
uses: google-github-actions/auth@v1
41+
with:
42+
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
43+
44+
- name: Configure Docker
45+
run: gcloud auth configure-docker
46+
47+
- name: Setup gcloud CLI
48+
uses: google-github-actions/setup-gcloud@v1
49+
with:
50+
version: '390.0.0'
51+
service_account_key: ${{ secrets.GCP_CREDENTIALS }}
52+
53+
- name: Download Model from GCS
54+
run: gsutil cp gs://diego-tryolabs-latam_cloudbuild/${{ secrets.MODEL_NAME }}.json model.json
55+
56+
- name: Submit Build
57+
run: gcloud builds submit --region ${{ secrets.GCP_REGION }} --tag ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/delay-model/${{ secrets.GCP_IMAGE_NAME }}:latest
58+
59+
- name: Deploy to Cloud Run
60+
run: gcloud run deploy ${{ secrets.GCP_IMAGE_NAME }} --image ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/delay-model/${{ secrets.GCP_IMAGE_NAME }}:latest --allow-unauthenticated --region ${{ secrets.GCP_REGION }}
61+
62+
- name: Run Stress Test
63+
run: make stress-test
64+
65+

0 commit comments

Comments
 (0)