From b8c2c7132fa751a7a9ea39420a08c6471e108bfa Mon Sep 17 00:00:00 2001 From: KijkEr Date: Wed, 25 Sep 2024 22:35:12 +0200 Subject: [PATCH] Squash merge workflow_tests into fix_test_package --- .github/workflows/ci_test_package.yml | 45 ++++++++++++++++++++- .github/workflows/main_test_package.yml | 52 +++++++++++++++++++++---- integration_test_project/profiles.yml | 2 +- 3 files changed, 90 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_test_package.yml b/.github/workflows/ci_test_package.yml index 5eb359fd..c235dbf2 100644 --- a/.github/workflows/ci_test_package.yml +++ b/.github/workflows/ci_test_package.yml @@ -113,7 +113,7 @@ jobs: strategy: fail-fast: false # Don't fail one DWH if the others fail matrix: - warehouse: ["snowflake", "bigquery", "postgres", "sqlserver"] + warehouse: ["snowflake", "bigquery", "postgres"] # When supporting a new version, update the list here version: ["1_3_0", "1_4_0", "1_5_0", "1_6_0", "1_7_0", "1_8_0"] runs-on: ubuntu-latest @@ -193,3 +193,46 @@ jobs: # env: # DBT_VERSION: '' # run: tox -e integration_databricks + + integration-sqlserver: + strategy: + fail-fast: false # Don't fail one DWH if the others fail + matrix: + # When supporting a new version, update the list here + version: ["1_3_0", "1_4_0", "1_7_0", "1_8_0"] + runs-on: ubuntu-latest + environment: + name: Approve Integration Tests + + steps: + - uses: actions/setup-python@v4 + with: + python-version: "3.8.x" + architecture: "x64" + - name: Install SQL Server + uses: Particular/install-sql-server-action@v1.2.0 + with: + connection-string-env-var: SQL_SERVER_CONNECTION_STRING + catalog: dbt_artifact_integrationtests + - name: Create DBT User + shell: pwsh + run: | + echo "Create dbt login with sysadmin" + sqlcmd -Q "CREATE LOGIN dbt WITH PASSWORD = '123', CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF" -d "dbt_artifact_integrationtests" + sqlcmd -Q "ALTER SERVER ROLE sysadmin ADD MEMBER dbt" -d "dbt_artifact_integrationtests" + + - name: Install tox + run: python3 -m pip install tox + + - name: Install Microsoft ODBC + run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y + + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR + + - name: Run Tests on PR + env: + DBT_VERSION: ${{ matrix.version }} + run: tox -e integration_sqlserver_${{ matrix.version }} diff --git a/.github/workflows/main_test_package.yml b/.github/workflows/main_test_package.yml index 1c55194e..c0407572 100644 --- a/.github/workflows/main_test_package.yml +++ b/.github/workflows/main_test_package.yml @@ -34,7 +34,7 @@ jobs: integration: strategy: matrix: - warehouse: ["snowflake", "bigquery", "postgres", "sqlserver"] + warehouse: ["snowflake", "bigquery", "postgres"] version: ["1_3_0", "1_4_0", "1_5_0", "1_6_0", "1_7_0", "1_8_0"] runs-on: ubuntu-latest permissions: @@ -66,12 +66,6 @@ jobs: - name: Install tox run: python3 -m pip install tox - - name: Install SQL Server - run: docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=123" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest - - - name: Install Microsoft ODBC - run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y - - id: auth if: ${{ matrix.warehouse == 'bigquery' }} uses: google-github-actions/auth@v1 @@ -102,3 +96,47 @@ jobs: # - name: Run Databricks Tests # run: tox -e integration_databricks + + integration-sqlserver: + strategy: + fail-fast: false # Don't fail one DWH if the others fail + matrix: + # When supporting a new version, update the list here + version: ["1_3_0", "1_4_0", "1_7_0", "1_8_0"] + runs-on: ubuntu-latest + environment: + name: Approve Integration Tests + + steps: + - uses: actions/setup-python@v4 + with: + python-version: "3.8.x" + architecture: "x64" + - name: Install SQL Server + uses: Particular/install-sql-server-action@v1.2.0 + with: + connection-string-env-var: SQL_SERVER_CONNECTION_STRING + catalog: dbt_artifact_integrationtests + - name: Create DBT User + shell: pwsh + run: | + echo "Create dbt login with sysadmin" + sqlcmd -Q "CREATE LOGIN dbt WITH PASSWORD = '123', CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF" -d "dbt_artifact_integrationtests" + sqlcmd -Q "ALTER SERVER ROLE sysadmin ADD MEMBER dbt" -d "dbt_artifact_integrationtests" + + - name: Install tox + run: python3 -m pip install tox + + - name: Install Microsoft ODBC + run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y + + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR + + - name: Run Tests on PR + env: + DBT_VERSION: ${{ matrix.version }} + run: tox -e integration_sqlserver_${{ matrix.version }} + diff --git a/integration_test_project/profiles.yml b/integration_test_project/profiles.yml index 33a1117a..c5188699 100644 --- a/integration_test_project/profiles.yml +++ b/integration_test_project/profiles.yml @@ -61,5 +61,5 @@ dbt_artifacts: schema: dbo windows_login: False trust_cert: True - user: sa + user: dbt password: "123"