add mock template #94
Workflow file for this run
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 Unit Testing | |
on: | |
pull_request_target: | |
types: [labeled] | |
jobs: | |
pr-integration-tests-snowflake: | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'safe to test') | |
environment: test | |
env: | |
SNOWFLAKE_TEST_ACCOUNT: ${{ secrets.SNOWFLAKE_TEST_ACCOUNT }} | |
SNOWFLAKE_TEST_USER: ${{ secrets.SNOWFLAKE_TEST_USER }} | |
SNOWFLAKE_TEST_PASSWORD: ${{ secrets.SNOWFLAKE_TEST_PASSWORD }} | |
SNOWFLAKE_TEST_ROLE: ${{ secrets.SNOWFLAKE_TEST_ROLE }} | |
SNOWFLAKE_TEST_WAREHOUSE: ${{ secrets.SNOWFLAKE_TEST_WAREHOUSE }} | |
steps: | |
- uses: "actions/checkout@v2" | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: test snowflake | |
run: ./run-all-integration-tests.sh snowflake | |
pr-integration-tests-bigquery: | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'safe to test') | |
environment: test | |
steps: | |
- uses: "actions/checkout@v2" | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- id: "auth" | |
name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v0" | |
with: | |
credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}" | |
- name: "Set up Cloud SDK" | |
uses: "google-github-actions/setup-gcloud@v0" | |
- name: test bigquery | |
run: ./run-all-integration-tests.sh bigquery | |
pr-integration-tests-postgres: | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'safe to test') | |
environment: test | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: "actions/checkout@v2" | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: test postgres | |
run: ./run-all-integration-tests.sh postgres | |
pr-jaffle-shop-tests-postgres: | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'safe to test') | |
environment: test | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: "actions/checkout@v2" | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: test postgres | |
run: ./run-all-jaffle-shop-tests.sh postgres | |
remove-safe-to-test-label-after-test-run: | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: | |
[ | |
pr-integration-tests-snowflake, | |
pr-integration-tests-bigquery, | |
pr-integration-tests-postgres, | |
pr-jaffle-shop-tests-postgres, | |
] | |
environment: test | |
steps: | |
- name: Manage PR Labels | |
uses: andymckay/[email protected] | |
with: | |
remove-labels: "safe to test" | |
pr-check-skipped-tests: | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
pr-integration-tests-snowflake, | |
pr-integration-tests-bigquery, | |
pr-integration-tests-postgres, | |
pr-jaffle-shop-tests-postgres, | |
] | |
environment: test | |
if: | | |
always() && | |
(needs.pr-integration-tests-snowflake.result == 'skipped' || | |
needs.pr-integration-tests-bigquery.result == 'skipped' || | |
needs.pr-integration-tests-postgres.result == 'skipped' || | |
needs.pr-jaffle-shop-tests-postgres.result == 'skipped') | |
steps: | |
- name: Check for skipped integration tests | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('Some integration Tests were skipped!') |