Skip to content

Commit

Permalink
separates ci runs on forks
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed Aug 14, 2023
1 parent bc568c7 commit baad8d4
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test_destinations_slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ env:
jobs:
get_changed_sources:
uses: ./.github/workflows/get_changed_sources.yml
# Tests that require credentials do not run in forks
if: ${{ !github.event.pull_request.head.repo.fork }}

run_loader:
name: test destinations bigquery and redshift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ env:
jobs:
get_changed_sources:
uses: ./.github/workflows/get_changed_sources.yml
# Tests that require credentials do not run in forks
if: ${{ !github.event.pull_request.head.repo.fork }}

run_loader:
name: test destinations redshift, postgres and duckdb
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/test_on_local_destinations_forks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

name: test sources on postgres and duckdb on forks

on:
pull_request:
branches:
- master
- devel
workflow_dispatch:

env:
ALL_DESTINATIONS: '["postgres", "duckdb"]'
DLT_SECRETS_TOML: ${{ secrets.DLT_SECRETS_TOML }}
RUNTIME__LOG_LEVEL: ERROR

jobs:
get_changed_sources:
uses: ./.github/workflows/get_changed_sources.yml
# run only on fork
# if: ${{ github.event.pull_request.head.repo.fork }}

run_loader:
name: test on local postgres and duckdb
needs: get_changed_sources
if: needs.get_changed_sources.outputs.sources_list != ''
strategy:
max-parallel: 1
fail-fast: false
defaults:
run:
shell: bash
runs-on: "ubuntu-latest"

steps:
- name: Check out
uses: actions/checkout@master

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: "3.9.x"

- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
# path: ${{ steps.pip-cache.outputs.dir }}
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-destinations-forks

- name: Install dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --all-extras

- name: create secrets.toml
run: pwd && echo "$DLT_SECRETS_TOML" > sources/.dlt/secrets.toml
# run: pwd && echo "$DESTINATIONS_SECRETS" > sources/.dlt/secrets.toml && echo "$SOURCES_SECRETS" >> sources/.dlt/secrets.toml
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
- run: |
sources_list="${{ needs.get_changed_sources.outputs.sources_list }}"
test_paths=$(echo "$sources_list" | awk '{for(i=1;i<=NF;i++) printf "tests/%s ", $i}')
poetry run pytest $test_paths
name: Run tests on Linux/macOS
env:
DESTINATION__POSTGRES__CREDENTIALS: postgresql://loader:loader@localhost:5432/dlt_data
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packages = [{include = "sources"}]

[tool.poetry.dependencies]
python = "^3.8.1"
dlt = {version = "^0.3.8", allow-prereleases = true, extras = ["redshift", "bigquery", "postgres", "duckdb"]}
dlt = {version = "^0.3.11", allow-prereleases = true, extras = ["redshift", "bigquery", "postgres", "duckdb"]}

[tool.poetry.group.dev.dependencies]
mypy = "^0.991"
Expand Down
1 change: 0 additions & 1 deletion sources/google_sheets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,3 @@ def get_named_ranges():

## Setup credentials
[We recommend to use service account for any production deployments](https://dlthub.com/docs/dlt-ecosystem/verified-sources/google_sheets#google-sheets-api-authentication)

0 comments on commit baad8d4

Please sign in to comment.