tools/templates/ci_workflow.yaml (39 lines of code) (raw):
build-job-{{ connector_name }}:
docker:
- image: python:3.8
steps:
- checkout
- compare-branch:
pattern: ^connectors/{{ connector_name }}/
- run:
name: Build
command: |
python3.8 -m venv venv/
venv/bin/pip install -r requirements.txt
venv/bin/pip install -r connectors/{{ connector_name }}/requirements.txt
- run:
name: isort
command: venv/bin/isort --check connectors/{{ connector_name }}
- run:
name: Mypy
command: venv/bin/mypy --ignore-missing-imports connectors/{{ connector_name }}
- run:
name: Test connector code
command: venv/bin/pytest --black --flake8 connectors/{{ connector_name }}/tests/
deploy-{{ connector_name }}:
docker:
- image: google/cloud-sdk
steps:
- checkout
- run:
name: Authorize gcloud CLI
command: |
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcp.json"
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS"
gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
gcloud config set project $GCLOUD_PROJECT
- run:
name: Deploy Function
command: |
cd connectors/{{ connector_name }}
gcloud functions deploy {{ connector_name }} --entry-point main --runtime python38 --trigger-http --timeout=540 --memory=4096MB