From e1858b8db881a4bbe6fa6835f4bbf471b364b451 Mon Sep 17 00:00:00 2001 From: Michelle Yan Date: Wed, 9 Oct 2024 13:35:36 -0700 Subject: [PATCH] testing #445 --- .github/workflows/ci_test_package.yml | 83 +++++++++++++++++++++++++ .github/workflows/main_test_package.yml | 44 ++++++++++++- integration_test_project/profiles.yml | 3 +- tox.ini | 22 ++++--- 4 files changed, 143 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_test_package.yml b/.github/workflows/ci_test_package.yml index 5eb359fd..dac5e014 100644 --- a/.github/workflows/ci_test_package.yml +++ b/.github/workflows/ci_test_package.yml @@ -193,3 +193,86 @@ jobs: # env: # DBT_VERSION: '' # run: tox -e integration_databricks + + integration-sqlserver: + strategy: + fail-fast: false # Don't fail one DWH if the others fail + 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 + + integration-sqlserver-single-run: + 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"] + run: tox -e integration_sqlserver_${{ matrix.version }} + 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..f0aa8343 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: @@ -102,3 +102,45 @@ 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..fee862ad 100644 --- a/integration_test_project/profiles.yml +++ b/integration_test_project/profiles.yml @@ -61,5 +61,6 @@ dbt_artifacts: schema: dbo windows_login: False trust_cert: True - user: sa + Encrypt: False + user: dbt password: "123" diff --git a/tox.ini b/tox.ini index 93d870d2..d865318c 100644 --- a/tox.ini +++ b/tox.ini @@ -359,31 +359,39 @@ commands = [testenv:integration_sqlserver] changedir = integration_test_project -deps = dbt-sqlserver~=1.8.4 +deps = dbt-sqlserver~=1.8.0 commands = dbt clean dbt deps dbt build --target sqlserver -[testenv:integration_sqlserver_1_4_3] +[testenv:integration_sqlserver_1_3_0] changedir = integration_test_project -deps = dbt-sqlserver~=1.4.3 +deps = dbt-sqlserver~=1.3.0 commands = dbt clean dbt deps dbt build --target sqlserver -[testenv:integration_sqlserver_1_7_4] +[testenv:integration_sqlserver_1_4_0] changedir = integration_test_project -deps = dbt-sqlserver~=1.7.4 +deps = dbt-sqlserver~=1.4.0 commands = dbt clean dbt deps dbt build --target sqlserver -[testenv:integration_sqlserver_1_8_4] +[testenv:integration_sqlserver_1_7_0] changedir = integration_test_project -deps = dbt-sqlserver~=1.8.4 +deps = dbt-sqlserver~=1.7.0 +commands = + dbt clean + dbt deps + dbt build --target sqlserver + +[testenv:integration_sqlserver_1_8_0] +changedir = integration_test_project +deps = dbt-sqlserver~=1.8.0 commands = dbt clean dbt deps