-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kyle Wigley
committed
Aug 2, 2021
1 parent
d4e774a
commit 431fc8d
Showing
6 changed files
with
245 additions
and
127 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# what? - | ||
# why? - | ||
# when? - | ||
|
||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "develop" | ||
- "*.latest" | ||
- "releases/*" | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.python-version }} / ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Upgrade pip and setuptools | ||
run: | | ||
pip install --upgrade pip setuptools | ||
pip --version | ||
- name: Build dist | ||
shell: bash | ||
run: | | ||
./scripts/build-dist.sh | ||
- name: Install wheel dists | ||
run: | | ||
pip install --force-reinstall --find-links=dist/ dist/*.whl | ||
- name: Check wheel dist | ||
run: | | ||
dbt --version | ||
- name: Install source dists | ||
run: | | ||
pip install --force-reinstall --find-links=dist/ dist/*.gz | ||
- name: Check source dist | ||
run: | | ||
dbt --version | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
# what? - This workflow runs integration tests for supported OS and python versions and core adapters. | ||
# It will only run tests for related file changes. Supports a `test all` label and a `test ${adapter}` | ||
# label to manually run all or other tests. Requires secrets to run against different warehouses. | ||
# why? - This checks the functionality of dbt from a user's perspective, provides code coverage, and | ||
# attempts to prevent functional regressions. | ||
# when? - This workflow will run for all pull requests and forked pull requests. This workflow will run | ||
# for pull requests, and will run for forked pull requests when the `ok to test` label is present. | ||
|
||
# TODO: check if user signed cla maybe? | ||
name: Integration Tests (slim) | ||
|
||
on: | ||
pull_request_target: | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
pre-checks: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
changes: ${{ steps.check-changes.outputs.changes }} | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Check if relevant files changed | ||
uses: dorny/paths-filter@v2 | ||
id: check-changes | ||
with: | ||
filters: | | ||
postgres: | ||
- 'core/**' | ||
- 'plugins/postgres/**' | ||
snowflake: | ||
- 'core/**' | ||
- 'plugins/snowflake/**' | ||
bigquery: | ||
- 'core/**' | ||
- 'plugins/bigquery/**' | ||
redshift: | ||
- 'core/**' | ||
- 'plugins/redshift/**' | ||
- 'plugins/postgres/**' | ||
test: | ||
name: ${{ matrix.adapter }} ${{ matrix.python-version }} / ${{ matrix.os }} | ||
|
||
if: >- | ||
github.event.pull_request.head.repo.full_name == github.repository || | ||
contains(github.event.pull_request.labels.*.name, 'ok to test') | ||
needs: pre-checks | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
adapter: [postgres, snowflake, redshift, bigquery] | ||
python-version: [3.8] | ||
tox-cmd: ["tox -- -v --color=yes"] | ||
|
||
env: | ||
TOXENV: integration-${{ matrix.adapter }} | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
pip install --upgrade pip | ||
pip --version | ||
- name: Install tox | ||
run: | | ||
pip install tox | ||
- name: Run tox | ||
if: >- | ||
matrix.adapter == 'postgres' && | ||
( | ||
contains(jobs.pre-checks.outputs.changes, 'postgres' || | ||
contains(github.event.pull_request.labels.*.name, 'test all') || | ||
contains(github.event.pull_request.labels.*.name, 'test postgres') | ||
) | ||
env: | ||
POSTGRES_TEST_HOST: ${{ secrets.POSTGRES_TEST_HOST }} | ||
POSTGRES_TEST_PORT: ${{ secrets.POSTGRES_TEST_PORT }} | ||
POSTGRES_TEST_USER: ${{ secrets.POSTGRES_TEST_USER }} | ||
POSTGRES_TEST_PASS: ${{ secrets.POSTGRES_TEST_PASS }} | ||
POSTGRES_TEST_DATABASE: ${{ secrets.POSTGRES_TEST_DATABASE }} | ||
run: ${{ matrix.tox-cmd }} | ||
|
||
- name: Run tox | ||
if: >- | ||
matrix.adapter == 'redshift' && | ||
( | ||
contains(jobs.pre-checks.outputs.changes, 'redshift' || | ||
contains(github.event.pull_request.labels.*.name, 'test all') || | ||
contains(github.event.pull_request.labels.*.name, 'test redshift') | ||
) | ||
env: | ||
REDSHIFT_TEST_DBNAME: ${{ secrets.REDSHIFT_TEST_DBNAME }} | ||
REDSHIFT_TEST_PASS: ${{ secrets.REDSHIFT_TEST_PASS }} | ||
REDSHIFT_TEST_USER: ${{ secrets.REDSHIFT_TEST_USER }} | ||
REDSHIFT_TEST_PORT: ${{ secrets.REDSHIFT_TEST_PORT }} | ||
REDSHIFT_TEST_HOST: ${{ secrets.REDSHIFT_TEST_HOST }} | ||
run: ${{ matrix.tox-cmd }} | ||
|
||
- name: Run tox | ||
if: >- | ||
matrix.adapter == 'snowflake' && | ||
( | ||
contains(jobs.pre-checks.outputs.changes, 'snowflake' || | ||
contains(github.event.pull_request.labels.*.name, 'test all') || | ||
contains(github.event.pull_request.labels.*.name, 'test snowflake') | ||
) | ||
env: | ||
SNOWFLAKE_TEST_ACCOUNT: ${{ secrets.SNOWFLAKE_TEST_ACCOUNT }} | ||
SNOWFLAKE_TEST_PASSWORD: ${{ secrets.SNOWFLAKE_TEST_PASSWORD }} | ||
SNOWFLAKE_TEST_USER: ${{ secrets.SNOWFLAKE_TEST_USER }} | ||
SNOWFLAKE_TEST_WAREHOUSE: ${{ secrets.SNOWFLAKE_TEST_WAREHOUSE }} | ||
SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN: ${{ secrets.SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN }} | ||
SNOWFLAKE_TEST_OAUTH_CLIENT_ID: ${{ secrets.SNOWFLAKE_TEST_OAUTH_CLIENT_ID }} | ||
SNOWFLAKE_TEST_OAUTH_CLIENT_SECRET: ${{ secrets.SNOWFLAKE_TEST_OAUTH_CLIENT_SECRET }} | ||
SNOWFLAKE_TEST_ALT_DATABASE: ${{ secrets.SNOWFLAKE_TEST_ALT_DATABASE }} | ||
SNOWFLAKE_TEST_ALT_WAREHOUSE: ${{ secrets.SNOWFLAKE_TEST_ALT_WAREHOUSE }} | ||
SNOWFLAKE_TEST_DATABASE: ${{ secrets.SNOWFLAKE_TEST_DATABASE }} | ||
SNOWFLAKE_TEST_QUOTED_DATABASE: ${{ secrets.SNOWFLAKE_TEST_QUOTED_DATABASE }} | ||
SNOWFLAKE_TEST_ROLE: ${{ secrets.SNOWFLAKE_TEST_ROLE }} | ||
run: ${{ matrix.tox-cmd }} | ||
|
||
- name: Run tox | ||
if: >- | ||
matrix.adapter == 'bigquery' && | ||
( | ||
contains(jobs.pre-checks.outputs.changes, 'bigquery' || | ||
contains(github.event.pull_request.labels.*.name, 'test all') || | ||
contains(github.event.pull_request.labels.*.name, 'test bigquery') | ||
) | ||
env: | ||
BIGQUERY_SERVICE_ACCOUNT_JSON: ${{ secrets.BIGQUERY_SERVICE_ACCOUNT_JSON }} | ||
BIGQUERY_TEST_ALT_DATABASE: ${{ secrets.BIGQUERY_TEST_ALT_DATABASE }} | ||
run: ${{ matrix.tox-cmd }} | ||
|
||
post-checks: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- name: Needs permission PR comment | ||
if: >- | ||
needs.test.result == 'skipped' && | ||
github.event_name == 'pull_request_target' && | ||
github.event.pull_request.head.repo.full_name != github.repository | ||
uses: unsplash/comment-on-pr@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
msg: | | ||
"You do not have permissions to run integration tests, @dbt-labs/core "\ | ||
"needs to label this PR with `ok to test` in order to run integration tests!" | ||
check_for_duplicate_msg: true |
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
Oops, something went wrong.