Skip to content

Add uv-managed pytest test foundation #185

Add uv-managed pytest test foundation

Add uv-managed pytest test foundation #185

Workflow file for this run

name: execute whirl ci for examples
on:
push:
branches:
- master
pull_request:
jobs:
shellcheck: # Job that list subdirectories of ./examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: run shellcheck
uses: sudo-bot/action-shellcheck@latest
with:
# https://github.com/koalaman/shellcheck#how-to-use
cli-args: "-x whirl"
- name: shellcheck setup scripts
# Lint every setup script (gated at warning severity; info-level quoting
# noise is tracked separately). The main `whirl` script is linted above.
run: |
shellcheck --severity=warning $(find envs examples -type f \
\( -path '*/whirl.setup.d/*.sh' \
-o -path '*/compose.setup.d/*.sh' \
-o -path '*/compose.teardown.d/*.sh' \) | sort)
unit-tests: # Fast, Docker-free pytest suite (DAG parsing + setup-script checks)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: astral-sh/setup-uv@v5
- name: Install Python 3.13
run: uv python install 3.13
- name: Sync test dependencies
run: uv sync --group test
- name: Run pytest
run: uv run pytest -q
directories: # Job that list subdirectories of ./examples
runs-on: ubuntu-latest
outputs:
# generate output name dir by using inner step output
dir: ${{ steps.setdirs.outputs.dir }}
steps:
- uses: actions/checkout@v2
- id: setdirs # Give it an id to handle to get step outputs in the outputs key above
# run: echo "::set-output name=dir::$(ls -d ./examples/* | jq -R -s -c 'split("\n")[:-1]')"
run: echo "dir=$(ls -d ./examples/* | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
# Define step output named dir based on ls command transformed to JSON thanks to jq
examples: # Job that list subdirectories of ./examples
runs-on: ubuntu-latest
outputs:
# generate output name example by using inner step output
example: ${{ steps.setexamples.outputs.example }}
steps:
- uses: actions/checkout@v2
- id: setexamples # Give it an id to handle to get step outputs in the outputs key above
run: echo "example=$(ls -d ./examples/* | sed -r 's/\.\/examples\/(.*)/\1/g' | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
# Define step output named example based on ls command transformed to JSON thanks to jq
whirl-ci-default-envs:
needs: [directories]
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 4
matrix:
example_dir: ${{ fromJson(needs.directories.outputs.dir) }}
python_version: ["3.10", "3.13"]
airflow_version: ["3.2.1"]
exclude:
# Needs more memory than available on the runner
- example_dir: ./examples/dbt-spark-example
- example_dir: ./examples/spark-delta-sharing
- example_dir: ./examples/spark-s3-to-hive
# No default dag available for CI
- example_dir: ./examples/airflow-datasets
# Run without parallelism separately
- example_dir: ./examples/dbt-example
# Requires artifact downloaded from github.com/godatadriven/spot, which doesn't publish artifacts yet (2024-12-11)
- example_dir: ./examples/spark-opentelemetry
env:
PYTHON_VERSION: ${{ matrix.python_version }}
AIRFLOW_VERSION: ${{ matrix.airflow_version }}
steps:
- uses: actions/checkout@v2
- name: Run whirl CI ${{ matrix.example_dir }}
working-directory: ${{ matrix.example_dir }}
run: |
echo Run Ci from example directory ${{ matrix.example_dir }}
../../whirl ci
whirl-ci-default-envs-from-root-dir:
needs: [examples]
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 4
matrix:
example: ${{ fromJson(needs.examples.outputs.example) }}
python_version: ["3.10", "3.13"]
airflow_version: ["3.2.1"]
exclude:
# Needs more memory than available on the runner
- example: dbt-spark-example
- example: spark-delta-sharing
- example: spark-s3-to-hive
# No default dag available for CI
- example: airflow-datasets
# Run without parallelism separately
- example: dbt-example
# Requires artifact downloaded from github.com/godatadriven/spot, which doesn't publish artifacts yet (2024-12-11)
- example: spark-opentelemetry
env:
PYTHON_VERSION: ${{ matrix.python_version }}
AIRFLOW_VERSION: ${{ matrix.airflow_version }}
steps:
- uses: actions/checkout@v2
- name: Run whirl CI example ${{ matrix.example }}
run: |
echo Run Ci for example ${{ matrix.example }}
./whirl -x ${{ matrix.example }} ci
whirl-ci-dbt-example:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
python_version: ["3.10", "3.13"]
airflow_version: ["3.2.1"]
env:
PYTHON_VERSION: ${{ matrix.python_version }}
AIRFLOW_VERSION: ${{ matrix.airflow_version }}
steps:
- uses: actions/checkout@v2
- name: Run whirl CI dbt example
working-directory: ./examples/dbt-example
run: |
echo Run Ci from dbt-example directory
../../whirl ci
whirl-ci-opentelemetry-example:
if: false # Disabled until github.com/godatadriven/spot has public Releases (need a stable download URL)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run whirl CI opentelemetry example
working-directory: ./examples/spark-opentelemetry/
run: |
curl -fLSs \
-o ./whirl.setup.d/spot-complete.jar \
--url "https://github.com/godatadriven/spot/releases/..." # TODO spot-complete-3.5_2.21.jar
echo Run Ci from spark-opentelemetry directory
../../whirl ci
whirl-ci-extra-env-spark-s3-to-postgres:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run whirl CI non-default env
working-directory: ./examples/spark-s3-to-postgres/
run: |
echo Run Ci for example spark-s3-to-postgres with non-default env
../../whirl ci -e postgres-s3-spark
whirl-ci-extra-env-api-to-s3:
strategy:
fail-fast: false
max-parallel: 4
matrix:
python_version: ["3.10", "3.13"]
airflow_version: ["3.2.1"]
runs-on: ubuntu-latest
env:
PYTHON_VERSION: ${{ matrix.python_version }}
AIRFLOW_VERSION: ${{ matrix.airflow_version }}
steps:
- uses: actions/checkout@v2
- name: Run whirl CI api-to-s3 on k8s executor
working-directory: ./examples/api-to-s3/
run: |
echo Run Ci for example api-to-s3 with k8s executor env
../../whirl ci -e api-python-s3-k8s
whirl-ci-extra-env-ha-scheduler:
strategy:
fail-fast: false
max-parallel: 4
matrix:
python_version: ["3.10", "3.13"]
airflow_version: ["3.2.1"]
runs-on: ubuntu-latest
env:
PYTHON_VERSION: ${{ matrix.python_version }}
AIRFLOW_VERSION: ${{ matrix.airflow_version }}
steps:
- uses: actions/checkout@v2
- name: Run whirl CI ha-scheduler env
working-directory: ./examples/external-airflow-db/
run: |
echo Run Ci for example external-airflow-db with ha-scheduler env
../../whirl ci -e ha-scheduler