From 15261bb98d08f02bc0b6252b1bbfb8d88650d1a4 Mon Sep 17 00:00:00 2001 From: Kyle Wigley Date: Mon, 26 Jul 2021 12:16:21 -0400 Subject: [PATCH] fix gh actions --- .github/workflows/tests.yml | 95 ++++++++++++++++---------------- .github/workflows/unit_tests.yml | 80 +++++++++++++-------------- 2 files changed, 88 insertions(+), 87 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 44b065b4c34..d93804db14e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,28 +6,29 @@ name: dbt Tests on: # Triggers the workflow on push or pull request events and also adds a manual trigger push: - branches: - - 'develop' - - '*.latest' - - 'releases/*' - pull_request_target: - branches: - - 'develop' - - '*.latest' - - 'pr/*' - - 'releases/*' + branches: + - "develop" + - "*.latest" + - "releases/*" + pull_request: + # pull_request_target: + # branches: + # - "develop" + # - "*.latest" + # - "pr/*" + # - "releases/*" # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: PostgresIntegrationTest: - runs-on: 'windows-latest' #TODO: Add Mac support - environment: 'Postgres' + runs-on: "windows-latest" #TODO: Add Mac support + environment: "Postgres" steps: - - uses: actions/checkout@v2 - - name: 'Install postgresql and set up database' - shell: pwsh - run: | + - uses: actions/checkout@v2 + - name: "Install postgresql and set up database" + shell: pwsh + run: | $serviceName = Get-Service -Name postgresql* Set-Service -InputObject $serviceName -StartupType Automatic Start-Service -InputObject $serviceName @@ -38,22 +39,22 @@ jobs: & $env:PGBIN\psql.exe -U postgres -c "CREATE ROLE noaccess WITH PASSWORD '$env:NOACCESS_PASSWORD' NOSUPERUSER;" & $env:PGBIN\psql.exe -U postgres -c "ALTER ROLE noaccess WITH LOGIN;" & $env:PGBIN\psql.exe -U postgres -c "GRANT CONNECT ON DATABASE dbt TO noaccess;" - env: + env: ROOT_PASSWORD: ${{ secrets.ROOT_PASSWORD }} NOACCESS_PASSWORD: ${{ secrets.NOACCESS_PASSWORD }} - - - name: Setup Python - uses: actions/setup-python@v2.2.2 - with: - python-version: '3.7' - architecture: 'x64' - - - name: 'Install dependencies' - run: python -m pip install --upgrade pip && pip install tox - - - name: 'Run integration tests' - run: python -m tox -e py-postgres -- -v -n4 - + + - name: Setup Python + uses: actions/setup-python@v2.2.2 + with: + python-version: "3.7" + architecture: "x64" + + - name: "Install dependencies" + run: python -m pip install --upgrade pip && pip install tox + + - name: "Run integration tests" + run: python -m tox -e py-postgres -- -v -n4 + # These three are all similar except secure environment variables, which MUST be passed along to their tasks, # but there's probably a better way to do this! SnowflakeIntegrationTest: @@ -61,19 +62,19 @@ jobs: matrix: os: [windows-latest, macos-latest] runs-on: ${{ matrix.os }} - environment: 'Snowflake' + environment: "Snowflake" steps: - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2.2.2 with: - python-version: '3.7' - architecture: 'x64' + python-version: "3.7" + architecture: "x64" - - name: 'Install dependencies' + - name: "Install dependencies" run: python -m pip install --upgrade pip && pip install tox - - name: 'Run integration tests' + - name: "Run integration tests" run: python -m tox -e py-snowflake -- -v -n4 env: SNOWFLAKE_TEST_ACCOUNT: ${{ secrets.SNOWFLAKE_TEST_ACCOUNT }} @@ -94,19 +95,19 @@ jobs: matrix: os: [windows-latest, macos-latest] runs-on: ${{ matrix.os }} - environment: 'Bigquery' + environment: "Bigquery" steps: - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2.2.2 with: - python-version: '3.7' - architecture: 'x64' - - - name: 'Install dependencies' + python-version: "3.7" + architecture: "x64" + + - name: "Install dependencies" run: python -m pip install --upgrade pip && pip install tox - - - name: 'Run integration tests' + + - name: "Run integration tests" run: python -m tox -e py-bigquery -- -v -n4 env: BIGQUERY_SERVICE_ACCOUNT_JSON: ${{ secrets.BIGQUERY_SERVICE_ACCOUNT_JSON }} @@ -117,19 +118,19 @@ jobs: matrix: os: [windows-latest, macos-latest] runs-on: ${{ matrix.os }} - environment: 'Redshift' + environment: "Redshift" steps: - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2.2.2 with: - python-version: '3.7' - architecture: 'x64' + python-version: "3.7" + architecture: "x64" - - name: 'Install dependencies' + - name: "Install dependencies" run: python -m pip install --upgrade pip && pip install tox - - name: 'Run integration tests' + - name: "Run integration tests" run: python -m tox -e py-redshift -- -v -n4 env: REDSHIFT_TEST_DBNAME: ${{ secrets.REDSHIFT_TEST_DBNAME }} diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 4f0335c8210..50187dd42dd 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -6,30 +6,30 @@ name: Linting and Unit Tests on: # Trigger on commits to develop and releases branches push: - branches: - - 'develop' - - '*.latest' - - 'releases/*' - pull_request_target: # Trigger for all PRs + branches: + - "develop" + - "*.latest" + - "releases/*" + pull_request: # Trigger for all PRs workflow_dispatch: # Allow manual triggers jobs: Linting: runs-on: ubuntu-latest #no need to run on every OS steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2.2.2 - with: - python-version: '3.6' - architecture: 'x64' - - - name: 'Install dependencies' - run: python -m pip install --upgrade pip && pip install tox - - - name: 'Linting' - run: tox -e mypy,flake8 -- -v - + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2.2.2 + with: + python-version: "3.6" + architecture: "x64" + + - name: "Install dependencies" + run: python -m pip install --upgrade pip && pip install tox + + - name: "Linting" + run: tox -e mypy,flake8 -- -v + UnitTest: strategy: matrix: @@ -37,25 +37,25 @@ jobs: runs-on: ${{ matrix.os }} needs: Linting steps: - - uses: actions/checkout@v2 - - name: Setup Python 3.6 - uses: actions/setup-python@v2.2.2 - with: - python-version: '3.6' - architecture: 'x64' - - name: Setup Python 3.7 - uses: actions/setup-python@v2.2.2 - with: - python-version: '3.7' - architecture: 'x64' - - name: Setup Python 3.8 - uses: actions/setup-python@v2.2.2 - with: - python-version: '3.8' - architecture: 'x64' - - - name: 'Install dependencies' - run: python -m pip install --upgrade pip && pip install tox - - - name: 'Run unit tests' - run: tox -p -e py36,py37,py38 + - uses: actions/checkout@v2 + - name: Setup Python 3.6 + uses: actions/setup-python@v2.2.2 + with: + python-version: "3.6" + architecture: "x64" + - name: Setup Python 3.7 + uses: actions/setup-python@v2.2.2 + with: + python-version: "3.7" + architecture: "x64" + - name: Setup Python 3.8 + uses: actions/setup-python@v2.2.2 + with: + python-version: "3.8" + architecture: "x64" + + - name: "Install dependencies" + run: python -m pip install --upgrade pip && pip install tox + + - name: "Run unit tests" + run: tox -p -e py36,py37,py38