Fix label removal logic for SQL engine tests #2079
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: MetricFlow SQL Engine Tests | ||
# Runs tests against the other SQL engines that are supported. These engines are hosted externally, and tend to be | ||
# slower. As the test will be I/O bound, the tests can be run with higher parallelism to get faster runtimes. | ||
on: | ||
# Run if manually triggered. Example case: run against `main` to check if something is broken. | ||
workflow_dispatch: | ||
# Run if a PR is given a specific label. | ||
pull_request: | ||
types: [labeled] | ||
env: | ||
PYTHON_VERSION: "3.8" | ||
EXTERNAL_ENGINE_TEST_PARALLELISM: 8 | ||
ADDITIONAL_PYTEST_OPTIONS: "--use-persistent-source-schema" | ||
# If it's not `labeled`, it must be triggered via workflow dispatch. | ||
RUN_TESTS: ${{ github.event.action != 'labeled' || github.event.label.name == 'Run Tests With Other SQL Engines' }} | ||
jobs: | ||
snowflake-tests: | ||
environment: DW_INTEGRATION_TESTS | ||
if: env.RUN_TESTS | ||
Check failure on line 22 in .github/workflows/cd-sql-engine-tests.yaml GitHub Actions / MetricFlow SQL Engine TestsInvalid workflow file
|
||
name: Snowflake Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check-out the repo | ||
uses: actions/checkout@v3 | ||
- name: Test w/ Python ${{ env.PYTHON_VERSION }} | ||
uses: ./.github/actions/run-mf-tests | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
mf_sql_engine_url: ${{ secrets.MF_SNOWFLAKE_URL }} | ||
mf_sql_engine_password: ${{ secrets.MF_SNOWFLAKE_PWD }} | ||
parallelism: ${{ env.EXTERNAL_ENGINE_TEST_PARALLELISM }} | ||
additional-pytest-options: ${{ env.ADDITIONAL_PYTEST_OPTIONS }} | ||
make-target: "test-snowflake" | ||
redshift-tests: | ||
environment: DW_INTEGRATION_TESTS | ||
name: Redshift Tests | ||
if: env.RUN_TESTS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check-out the repo | ||
uses: actions/checkout@v3 | ||
- name: Test w/ Python ${{ env.PYTHON_VERSION }} | ||
uses: ./.github/actions/run-mf-tests | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
mf_sql_engine_url: ${{ secrets.MF_REDSHIFT_URL }} | ||
mf_sql_engine_password: ${{ secrets.MF_REDSHIFT_PWD }} | ||
parallelism: ${{ env.EXTERNAL_ENGINE_TEST_PARALLELISM }} | ||
additional-pytest-options: ${{ env.ADDITIONAL_PYTEST_OPTIONS }} | ||
make-target: "test-redshift" | ||
bigquery-tests: | ||
environment: DW_INTEGRATION_TESTS | ||
name: BigQuery Tests | ||
if: env.RUN_TESTS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check-out the repo | ||
uses: actions/checkout@v3 | ||
- name: Test w/ Python ${{ env.PYTHON_VERSION }} | ||
uses: ./.github/actions/run-mf-tests | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
MF_SQL_ENGINE_URL: ${{ secrets.MF_BIGQUERY_URL }} | ||
MF_SQL_ENGINE_PASSWORD: ${{ secrets.MF_BIGQUERY_PWD }} | ||
parallelism: ${{ env.EXTERNAL_ENGINE_TEST_PARALLELISM }} | ||
additional-pytest-options: ${{ env.ADDITIONAL_PYTEST_OPTIONS }} | ||
make-target: "test-bigquery" | ||
databricks-tests: | ||
environment: DW_INTEGRATION_TESTS | ||
name: Databricks Tests | ||
if: env.RUN_TESTS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check-out the repo | ||
uses: actions/checkout@v3 | ||
- name: Test w/ Python ${{ env.PYTHON_VERSION }} | ||
uses: ./.github/actions/run-mf-tests | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
mf_sql_engine_url: ${{ secrets.MF_DATABRICKS_URL }} | ||
mf_sql_engine_password: ${{ secrets.MF_DATABRICKS_PWD }} | ||
parallelism: ${{ env.EXTERNAL_ENGINE_TEST_PARALLELISM }} | ||
additional-pytest-options: ${{ env.ADDITIONAL_PYTEST_OPTIONS }} | ||
make-target: "test-databricks" | ||
trino-tests: | ||
# Trino tests run on a local service container, which obviates the need for separate Environment hosting. | ||
# We run them here instead of in the CI unit test suite because they are a bit slower, and because in future | ||
# we may choose to execute them against a hosted instance, at which point this config will look like the other | ||
# engine configs in this file. | ||
name: Trino Tests | ||
if: env.RUN_TESTS | ||
runs-on: ubuntu-latest | ||
services: | ||
trino: | ||
image: trinodb/trino | ||
ports: | ||
- 8080:8080 | ||
steps: | ||
- name: Check-out the repo | ||
uses: actions/checkout@v3 | ||
- name: Test w/ Python 3.11 | ||
uses: ./.github/actions/run-mf-tests | ||
with: | ||
python-version: "3.11" | ||
make-target: "test-trino" | ||
remove-label: | ||
name: Remove Label After Running Tests | ||
runs-on: ubuntu-latest | ||
needs: [ snowflake-tests, redshift-tests, bigquery-tests, databricks-tests ] | ||
# Default behavior for `needs` is that it requires success. `always()` runs this action even if tests fail. | ||
if: env.RUN_TESTS && github.event.action == 'labeled' | ||
steps: | ||
- name: Remove Label | ||
uses: actions-ecosystem/action-remove-labels@v1 | ||
with: | ||
labels: 'Run Tests With Other SQL Engines' |