Skip to content

Handle zm values (#50) #360

Handle zm values (#50)

Handle zm values (#50) #360

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