From 8e5d5ecb127b3653bffcd6108de633d805d8b1f4 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 6 Jun 2024 11:25:09 -0700 Subject: [PATCH] Address comments. --- .github/workflows/cd-sql-engine-tests.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd-sql-engine-tests.yaml b/.github/workflows/cd-sql-engine-tests.yaml index d8ad8c2207..aaf4928500 100644 --- a/.github/workflows/cd-sql-engine-tests.yaml +++ b/.github/workflows/cd-sql-engine-tests.yaml @@ -3,7 +3,9 @@ name: MetricFlow SQL Engine Tests # 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] @@ -11,11 +13,13 @@ 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: ${{ github.event.label.name == 'Run Tests With Other SQL Engines' }} + if: ${{ env.RUN_TESTS }} name: Snowflake Tests runs-on: ubuntu-latest steps: @@ -35,7 +39,7 @@ jobs: redshift-tests: environment: DW_INTEGRATION_TESTS name: Redshift Tests - if: ${{ github.event.label.name == 'Run Tests With Other SQL Engines' }} + if: ${{ env.RUN_TESTS }} runs-on: ubuntu-latest steps: - name: Check-out the repo @@ -53,7 +57,7 @@ jobs: bigquery-tests: environment: DW_INTEGRATION_TESTS name: BigQuery Tests - if: ${{ github.event.label.name == 'Run Tests With Other SQL Engines' }} + if: ${{ env.RUN_TESTS }} runs-on: ubuntu-latest steps: - name: Check-out the repo @@ -72,7 +76,7 @@ jobs: databricks-tests: environment: DW_INTEGRATION_TESTS name: Databricks Tests - if: ${{ github.event.label.name == 'Run Tests With Other SQL Engines' }} + if: ${{ env.RUN_TESTS }} runs-on: ubuntu-latest steps: - name: Check-out the repo @@ -94,7 +98,7 @@ jobs: # 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: ${{ github.event.label.name == 'Run Tests With Other SQL Engines' }} + if: ${{ env.RUN_TESTS }} runs-on: ubuntu-latest services: trino: @@ -116,7 +120,7 @@ jobs: 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: ${{ always() }} + if: ${{ env.RUN_TESTS && github.event.action == 'labeled' }} steps: - name: Remove Label uses: actions-ecosystem/action-remove-labels@v1