-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ci workflows back at the adapter level
- Loading branch information
1 parent
fb2b0ba
commit 5b094f1
Showing
3 changed files
with
248 additions
and
0 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,61 @@ | ||
# **what?** | ||
# Run code quality checks, e.g. `black`, `flake8`, `mypy`, via `pre-commit` | ||
# | ||
# **why?** | ||
# Ensure code quality meets dbt Labs standards | ||
# | ||
# **when?** | ||
# - runs on all PRs into protected branches | ||
# - runs indirectly during releases and release tests | ||
# - can be manually run | ||
name: "Code quality" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: "The branch/tag/commit to run code quality on" | ||
type: string | ||
required: true | ||
check-command: | ||
description: "The command to run code quality checks" | ||
type: string | ||
required: true | ||
python-version: | ||
description: "The python version to test against" | ||
type: string | ||
required: true | ||
|
||
permissions: read-all | ||
|
||
concurrency: | ||
group: "${{ github.workflow }}-${{ github.event_name }}-${{ inputs.ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
code-quality: | ||
name: "Code quality" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Check out ${{ github.repository }}@${{ inputs.ref }}" | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
persist-credentials: false | ||
|
||
- name: "Setup environment" | ||
uses: ./setup-environment | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: "Run code quality" | ||
shell: bash | ||
run: ${{ inputs.check-command }} | ||
|
||
- name: "[INFO] Run code quality" | ||
shell: bash | ||
run: | | ||
echo "::notice title=$TITLE::$MESSAGE" | ||
env: | ||
TITLE: "Run code quality" | ||
MESSAGE: "Code quality checks completed successfully!" |
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,115 @@ | ||
name: "Integration tests" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: "The branch/tag/commit to run integration tests on" | ||
type: string | ||
required: true | ||
test-command: | ||
description: "The command to run unit tests" | ||
type: string | ||
required: true | ||
python-versions-ubuntu: | ||
description: "The python versions to test against for ubuntu" | ||
type: string | ||
required: true | ||
python-versions-macos: | ||
description: "The python version to test against for macos" | ||
type: string | ||
required: true | ||
python-versions-windows: | ||
description: "The python version to test against for windows" | ||
type: string | ||
required: true | ||
|
||
permissions: read-all | ||
|
||
concurrency: | ||
group: "${{ github.workflow }}-${{ github.event_name }}-${{ inputs.ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
require-approval-on-forks: | ||
# if it's a pull request from a fork that has not been approved yet, don't run tests | ||
if: >- | ||
github.event_name == 'pull_request_target' && | ||
github.event.pull_request.head.repo.full_name != github.repository && | ||
!contains(github.event.pull_request.labels.*.name, 'ok to test') | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: "Author requires permission to run tests" | ||
uses: unsplash/comment-on-pr@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
msg: | | ||
"Thanks for your contribution! "\ | ||
"This PR was created from a fork, integration tests need to be approved prior to running. "\ | ||
"@dbt-labs/core will review this PR and approve running integration tests." | ||
check_for_duplicate_msg: true | ||
|
||
integration-tests: | ||
name: "Integration tests" | ||
needs: require-approval-on-forks | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ${{ fromJSON(inputs.python-versions-ubuntu) }} | ||
include: | ||
- os: macos-latest | ||
python-version: ${{ fromJSON(inputs.python-versions-macos) }} | ||
- os: windows-latest | ||
python-version: ${{ fromJSON(inputs.python-versions-windows) }} | ||
env: | ||
DBT_INVOCATION_ENV: ${{ vars.DBT_INVOCATION_ENV }} | ||
DD_CIVISIBILITY_AGENTLESS_ENABLED: true | ||
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }} | ||
DD_SITE: ${{ vars.DD_SITE }} | ||
DD_ENV: ${{ vars.DD_ENV }} | ||
DD_SERVICE: ${{ github.event.repository.name }} | ||
steps: | ||
- name: "Check out ${{ github.repository }}@${{ inputs.ref }}" | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
persist-credentials: false | ||
|
||
- name: "Setup environment" | ||
uses: ./setup-environment@add-hatch-actions | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: "Run integration tests" | ||
shell: bash | ||
run: ${{ inputs.test-command }} | ||
|
||
aggregate-results: | ||
name: "Collect integration tests results" | ||
needs: integration-tests | ||
if: always() && !cancelled() | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "[INFO] Integration tests - FAILED" | ||
if: failure() | ||
shell: bash | ||
run: | | ||
echo "::notice title=$TITLE::$MESSAGE" | ||
exit 1 | ||
env: | ||
TITLE: "Integration tests - FAILED" | ||
MESSAGE: "Integration tests failed!" | ||
|
||
- name: "[INFO] Integration tests - PASSED" | ||
if: ${{ !failure() }} # includes skipped | ||
shell: bash | ||
run: | | ||
echo "::notice title=$TITLE::$MESSAGE" | ||
env: | ||
TITLE: "Integration tests - PASSED" | ||
MESSAGE: "Integration tests completed successfully!" |
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,72 @@ | ||
name: "Unit tests" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: "The branch/tag/commit to run integration tests on" | ||
type: string | ||
required: true | ||
test-command: | ||
description: "The command to run unit tests" | ||
type: string | ||
required: true | ||
python-versions: | ||
description: "The python versions to test against" | ||
type: string | ||
required: true | ||
|
||
permissions: read-all | ||
|
||
concurrency: | ||
group: "${{ github.workflow }}-${{ github.event_name }}-${{ inputs.ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit-tests: | ||
name: "Unit tests" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ${{ fromJSON(inputs.python-versions) }} | ||
steps: | ||
- name: "Check out ${{ github.repository }}@${{ inputs.ref }}" | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
persist-credentials: false | ||
|
||
- name: "Setup environment" | ||
uses: ./setup-environment | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: "Run unit tests" | ||
shell: bash | ||
run: ${{ inputs.test-command }} | ||
|
||
aggregate-results: | ||
name: "Collect unit tests results" | ||
needs: unit-tests | ||
if: always() && !cancelled() | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "[INFO] Unit tests - FAILED" | ||
if: failure() | ||
shell: bash | ||
run: | | ||
echo "::notice title=$TITLE::$MESSAGE" | ||
exit 1 | ||
env: | ||
TITLE: "Unit tests - FAILED" | ||
MESSAGE: "Unit tests completed with failures!" | ||
|
||
- name: "[INFO] Unit tests - PASSED" | ||
if: ${{ !failure() }} # includes skipped | ||
shell: bash | ||
run: | | ||
echo "::notice title=$TITLE::$MESSAGE" | ||
env: | ||
TITLE: "Unit tests - PASSED" | ||
MESSAGE: "Unit tests completed successfully!" |