-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (124 loc) · 4.91 KB
/
test_deploy_ecr.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Build, test, and deploy docker image to ECR
on:
push:
branches:
- 'master'
concurrency:
group: testing_environment
cancel-in-progress: false
jobs:
build:
name: Build and deploy docker container
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: self-hosted
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# This is a github function? Ref doc: https://github.com/actions/checkout#checkout-a-different-branch
# IMPORTANT NOTE: pinned to v3 instead of master, because v4 uses node20 and glibc 2.27. Amazon linux 2 atm only supports
# glibc 2.26. Change notes: https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v3
with:
ref: master
# https://github.com/marketplace/actions/microsoft-teams-deploy-card
# Using replacement fork for toko-bifrost, context for why: https://github.com/toko-bifrost/ms-teams-deploy-card/issues/33#issuecomment-888466503
#- uses: toko-bifrost/ms-teams-deploy-card@master
# Note: deprecated because of nodejs 12 and seemingly un-updated.
# commenting out for now.
#- uses: patrickpaulin/ms-teams-deploy-card@master
# if: always()
# with:
# GITHUB-TOKEN: ${{ github.token }}
# WEBHOOK-URI: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
# card-layout-start: compact
# show-on-start: true
# show-on-exit: true
# custom-facts: |
# - name: Job Progress
# value: Building databridge-etl-tools
# https://github.com/aws-actions/amazon-ecr-login
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Pull Oracle Instant Client rpm from S3
id: pull-oracle-rpm
run: bash ./scripts/pull-oracle-rpm.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Prune docker system to clear space
- name: docker system purne
run: |
yes | docker system prune
# Build our docker container and insert our AWS secret keys
# no-cache so we're sure we're getting all changes (such as geopetl changes)
- name: Build docker container
run: |
docker build -t dbtools \
--build-arg AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
--build-arg AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
--no-cache \
.
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Postgres pytests
run: |
docker run --rm dbtools \
pytest tests/test_postgres.py \
-vvv -ra --showlocals --tb=long --disable-warnings \
--user citygeo \
--password $POSTGRES_PASSWORD \
--host $POSTGRES_HOST \
--database $POSTGRES_DB
env:
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
- name: Oracle pytests
run: |
docker run --rm dbtools \
pytest tests/test_oracle.py \
-vvv -ra --showlocals --tb=long --disable-warnings \
--user GIS_TEST \
--password $ORACLE_PASSWORD \
--host $ORACLE_HOST \
--database $ORACLE_DB
env:
ORACLE_HOST: ${{ secrets.ORACLE_HOST }}
ORACLE_PASSWORD: ${{ secrets.ORACLE_PASSWORD }}
ORACLE_DB: ${{ secrets.ORACLE_DB }}
- name: AGO pytests
run: |
docker run --rm dbtools \
pytest tests/test_ago.py \
-s -vvv -ra --showlocals --tb=long --disable-warnings \
--ago_user $AGO_USER \
--ago_password $AGO_PASSWORD
env:
AGO_USER: ${{ secrets.AGO_USER }}
AGO_PASSWORD: ${{ secrets.AGO_PASSWORD }}
- name: Carto pytests
run: |
docker run --rm dbtools \
pytest tests/test_carto.py \
-s -vvv -ra --showlocals --tb=long --disable-warnings \
--carto_user $CARTO_USER \
--carto_password $CARTO_PASSWORD
env:
CARTO_USER: ${{ secrets.CARTO_USER }}
CARTO_PASSWORD: ${{ secrets.CARTO_PASSWORD }}
# https://github.com/aws-actions/amazon-ecr-login
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Docker Push to ECR
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ECR_REPOSITORY_URL: ${{ secrets.ECR_REPOSITORY_URL }}
run: |
docker tag dbtools:latest $ECR_REPOSITORY_URL:latest
docker push $ECR_REPOSITORY_URL:latest