Skip to content

Build, Test, Report Coverage #1720

Build, Test, Report Coverage

Build, Test, Report Coverage #1720

Workflow file for this run

name: Build, Test, Report Coverage
on:
workflow_dispatch:
pull_request:
jobs:
build:
name: Main CI
runs-on: ubuntu-latest
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
SECRETS_GPG_ARMOR: true
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Install Poetry
run: pipx install poetry
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "poetry"
- name: run Pre-Commit
uses: pre-commit/action@v3.0.0
- name: Cache Poetry virtualenv
uses: actions/cache@v1
id: cache
with:
path: ~/.virtualenvs
key: poetry-$
restore-keys: |
poetry-$
- name: Install Dependencies using Poetry
run: poetry install --with test
- name: Load secrets
uses: 1password/load-secrets-action@v1
with:
# Export loaded secrets as environment variables
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.ONE_PASSWORD_SERVICE_ACCOUNT }}
# Redshift
PROFILE_DBT_COVES_REDSHIFT: op://Engineering - dbt-coves/dbt-coves-tests/PROFILE_DBT_COVES_REDSHIFT
HOST_REDSHIFT: op://Engineering - dbt-coves/dbt-coves-tests/HOST_REDSHIFT
USER_REDSHIFT: op://Engineering - dbt-coves/dbt-coves-tests/USER_REDSHIFT
PASSWORD_REDSHIFT: op://Engineering - dbt-coves/dbt-coves-tests/PASSWORD_REDSHIFT
DATABASE_REDSHIFT: op://Engineering - dbt-coves/dbt-coves-tests/DATABASE_REDSHIFT
SCHEMA_REDSHIFT: op://Engineering - dbt-coves/dbt-coves-tests/SCHEMA_REDSHIFT
# Snowflake
PROFILE_DBT_COVES_SNOWFLAKE: op://Engineering - dbt-coves/dbt-coves-tests/PROFILE_DBT_COVES_SNOWFLAKE
USER_SNOWFLAKE: op://Engineering - dbt-coves/dbt-coves-tests/USER_SNOWFLAKE
PASSWORD_SNOWFLAKE: op://Engineering - dbt-coves/dbt-coves-tests/PASSWORD_SNOWFLAKE
ACCOUNT_SNOWFLAKE: op://Engineering - dbt-coves/dbt-coves-tests/ACCOUNT_SNOWFLAKE
WAREHOUSE_SNOWFLAKE: op://Engineering - dbt-coves/dbt-coves-tests/WAREHOUSE_SNOWFLAKE
ROLE_SNOWFLAKE: op://Engineering - dbt-coves/dbt-coves-tests/ROLE_SNOWFLAKE
DATABASE_SNOWFLAKE: op://Engineering - dbt-coves/dbt-coves-tests/DATABASE_SNOWFLAKE
SCHEMA_SNOWFLAKE: op://Engineering - dbt-coves/dbt-coves-tests/SCHEMA_SNOWFLAKE
# Bigquery
PROFILE_DBT_COVES_BIGQUERY: op://Engineering - dbt-coves/dbt-coves-tests/PROFILE_DBT_COVES_BIGQUERY
SERVICE_ACCOUNT_GCP: op://Engineering - dbt-coves/dbt-coves-tests/SERVICE_ACCOUNT_GCP
PROJECT_BIGQUERY: op://Engineering - dbt-coves/dbt-coves-tests/PROJECT_BIGQUERY
DATASET_BIGQUERY: op://Engineering - dbt-coves/dbt-coves-tests/DATASET_BIGQUERY
- name: Create profiles
run: |
poetry run python tests/create_profiles.py
mkdir $HOME/.dbt
mv tests/profiles.yml $HOME/.dbt/profiles.yml
- name: Run Tests and Coverage Report
run: poetry run tox
- name: Upload coverage report to CodeCov
uses: codecov/codecov-action@v2
with:
env_vars: GITHUB_RUN_ID
file: coverage-reports/coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false