Skip to content

merge cidc-api-gae/pull/815 #978

merge cidc-api-gae/pull/815

merge cidc-api-gae/pull/815 #978

Workflow file for this run

name: Continuous Integration
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]
jobs:
test:
strategy:
matrix:
python-version: [3.8, 3.9]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.dev.txt
- name: Check code format with black
run: |
black --check functions main.py --target-version=py37
- name: Test with pytest
run: |
pytest
deploy:
runs-on: ubuntu-latest
needs: test
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/production' }}
strategy:
matrix:
include:
- name: ingest_upload
topic: uploads
timeout: 540
memory: 2048
- name: send_email
topic: emails
timeout: 60
memory: 512
- name: store_auth0_logs
topic: daily_cron
timeout: 120
memory: 1024
- name: disable_inactive_users
topic: daily_cron
timeout: 120
memory: 1024
- name: refresh_download_permissions
topic: daily_cron
timeout: 120
memory: 1024
- name: vis_preprocessing
topic: artifact_upload
timeout: 540
memory: 1024
max_instances: 10
- name: derive_files_from_manifest_upload
topic: patient_sample_update
timeout: 60
memory: 1024
- name: derive_files_from_assay_or_analysis_upload
topic: assay_or_analysis_upload_complete
timeout: 540
memory: 1024
- name: update_cidc_from_csms
topic: csms_trigger
timeout: 540
memory: 1024
- name: grant_download_permissions
topic: grant_download_perms
timeout: 540
memory: 1024
- name: worker
topic: worker
timeout: 540
memory: 1024
steps:
- uses: actions/checkout@v2
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ github.ref == 'refs/heads/production' && 'cidc-dfci' || 'cidc-dfci-staging' }}
service_account_key: ${{ github.ref == 'refs/heads/production' && secrets.GCP_SA_KEY_PROD || secrets.GCP_SA_KEY_STAGING }}
export_default_credentials: true
- name: Deploy ${{ matrix.name }} to Cloud Functions
env:
ENV_VARS_FILE: ${{ github.ref == 'refs/heads/production' && '.env.prod.yaml' || '.env.staging.yaml' }}
run: |
gcloud functions deploy ${{ matrix.name }} \
--trigger-topic ${{ matrix.topic }} \
--timeout ${{ matrix.timeout }} \
--memory ${{ matrix.memory }} \
--env-vars-file $ENV_VARS_FILE \
--runtime python37 \
${{ matrix.max_instances && format('--max-instances {0}', matrix.max_instances) || ''}}