Skip to content

Commit

Permalink
fix gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Wigley committed Jul 26, 2021
1 parent 2360950 commit 15261bb
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 87 deletions.
95 changes: 48 additions & 47 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -38,42 +39,42 @@ 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/[email protected]
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/[email protected]
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:
strategy:
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
environment: 'Snowflake'
environment: "Snowflake"
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/[email protected]
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 }}
Expand All @@ -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/[email protected]
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 }}
Expand All @@ -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/[email protected]
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 }}
Expand Down
80 changes: 40 additions & 40 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,56 @@ 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/[email protected]
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/[email protected]
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:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
needs: Linting
steps:
- uses: actions/checkout@v2
- name: Setup Python 3.6
uses: actions/[email protected]
with:
python-version: '3.6'
architecture: 'x64'
- name: Setup Python 3.7
uses: actions/[email protected]
with:
python-version: '3.7'
architecture: 'x64'
- name: Setup Python 3.8
uses: actions/[email protected]
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/[email protected]
with:
python-version: "3.6"
architecture: "x64"
- name: Setup Python 3.7
uses: actions/[email protected]
with:
python-version: "3.7"
architecture: "x64"
- name: Setup Python 3.8
uses: actions/[email protected]
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

0 comments on commit 15261bb

Please sign in to comment.