-
Notifications
You must be signed in to change notification settings - Fork 2.2k
65 lines (55 loc) · 1.9 KB
/
ci-tests.yml
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
name: CI-Tests
on:
pull_request:
branches:
- 'develop'
paths:
- '06-best-practices/code/**'
env:
AWS_DEFAULT_REGION: 'eu-west-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
working-directory: "06-best-practices/code"
run: pip install pipenv && pipenv install --dev
- name: Run Unit tests
working-directory: "06-best-practices/code"
run: pipenv run pytest tests/
- name: Lint
working-directory: "06-best-practices/code"
run: pipenv run pylint --recursive=y .
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Integration Test
working-directory: '06-best-practices/code/integraton-test'
run: |
. run.sh
tf-plan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- uses: hashicorp/setup-terraform@v2
- name: TF plan
id: plan
working-directory: '06-best-practices/code/infrastructure'
run: |
terraform init -backend-config="key=mlops-zoomcamp-prod.tfstate" --reconfigure && terraform plan --var-file vars/prod.tfvars