dbt-fal integration tests #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: dbt-fal integration tests | |
on: | |
pull_request: | |
types: [assigned, opened, synchronize, reopened] | |
paths: | |
- "projects/adapter/**" | |
- ".github/workflows/test_integration_adapter.yml" | |
push: | |
branches: [main] | |
paths: | |
- "projects/adapter/**" | |
schedule: | |
# every monday | |
- cron: "0 0 * * 1" | |
workflow_dispatch: | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
profile: | |
- postgres | |
dbt_version: | |
- "1.7.16" | |
python: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
concurrency: | |
group: "${{ github.head_ref || github.run_id }}-${{ github.workflow }}-${{ matrix.profile }}-${{ matrix.python }}" | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: "fal" | |
- name: Start Docker database | |
working-directory: fal/projects/adapter/integration_tests | |
if: contains(fromJSON('["postgres"]'), matrix.profile) | |
run: docker-compose up -d | |
- name: Setup latest dependencies | |
working-directory: fal/projects/adapter/integration_tests | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install --upgrade pip | |
ADAPTER_PACKAGE="dbt-${{ matrix.profile }}" | |
if [[ -n '${{ matrix.dbt_version }}' ]] | |
then | |
ADAPTER_PACKAGE="${ADAPTER_PACKAGE}==${{ matrix.dbt_version }}" | |
fi | |
pushd .. | |
EXTRAS="${{ matrix.profile }}" | |
if [[ '${{ matrix.teleport }}' == 'true' ]] | |
then | |
EXTRAS="$EXTRAS,teleport" | |
fi | |
DBT_FAL_PACKAGE=".[$EXTRAS]" | |
echo "pip install $ADAPTER_PACKAGE -e $DBT_FAL_PACKAGE" | |
pip install $ADAPTER_PACKAGE -e $DBT_FAL_PACKAGE | |
popd | |
- name: Setup behave | |
working-directory: fal/projects/adapter/integration_tests | |
run: pip install behave | |
- name: Run tests | |
id: test_run | |
working-directory: fal/projects/adapter/integration_tests | |
env: | |
FAL_STATS_ENABLED: false | |
run: | | |
source .venv/bin/activate | |
# Database and schema setup for sources | |
# Could not get the real job_id easily from context | |
UUID=$(uuidgen | head -c8) | |
export DB_NAMESPACE="${{ github.run_id }}_${UUID}" | |
BEHAVE_TAGS="--tags=-TODO-${{ matrix.profile }}" | |
if [[ '${{ matrix.teleport }}' != 'true' ]] | |
then | |
BEHAVE_TAGS="$BEHAVE_TAGS --tags=-teleport" | |
fi | |
if [[ -z "${GITHUB_HEAD_REF}" ]] | |
then | |
export FAL_GITHUB_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}} | |
else | |
export FAL_GITHUB_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | |
fi | |
behave $BEHAVE_TAGS -fplain -D profile=${{ matrix.profile }} --no-capture |