-
Notifications
You must be signed in to change notification settings - Fork 8
74 lines (71 loc) · 2.23 KB
/
cd_pipeline.yml
File metadata and controls
74 lines (71 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: CDPipeline
on:
push:
branches:
- main
jobs:
lint-project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: s-weigand/setup-conda@v1
with:
python-version: 3.7.9
- name: Install pip-tools
run: pip install pip-tools
- name: Install dependencies
run: |
pip-compile src/requirements.in --output-file src/requirements.txt
pip install -r src/requirements.txt
- name: Run linting
run: kedro lint
test-project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: s-weigand/setup-conda@v1
with:
python-version: 3.7.9
- name: Install pip-tools
run: pip install pip-tools
- name: Install dependencies
run: |
pip-compile src/requirements.in --output-file src/requirements.txt
pip install -r src/requirements.txt
- name: Run test
run: kedro test
build-and-push-container:
runs-on: ubuntu-latest
needs: [lint-project, test-project]
steps:
- uses: actions/checkout@v2
- uses: RafikFarhad/push-to-gcr-github-action@v4
with:
gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
registry: us.gcr.io
project_id: sumz-laboratorios
image_name: kedro-devops
deploy-infrastructure:
runs-on: ubuntu-latest
needs: [build-and-push-container]
steps:
- uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.0.8
terraform_plugins: yes
- name: Terraform Init
working-directory: ./terraform
run: terraform init
- name: Terraform Validate
run: terraform validate -no-color
- name: Setup Terraform Parameters
working-directory: ./terraform
env:
GCLOUD_SERVICE_KEY_RAW: ${{ secrets.GCLOUD_SERVICE_KEY_RAW }}
run: |
echo "${GCLOUD_SERVICE_KEY_RAW}" > credentials.json
echo 'docker_worker_image_digest="us.gcr.io/sumz-laboratorios/kedro-devops"' > config.tfvars
- name: Terraform Apply
working-directory: ./terraform
run: terraform apply -var-file="config.tfvars" -auto-approve