Skip to content

Instantly share code, notes, and snippets.

@toodaniels
Created October 18, 2021 21:43
Show Gist options
  • Save toodaniels/ae75cd33994162c6edc52b7a7580efc1 to your computer and use it in GitHub Desktop.
Save toodaniels/ae75cd33994162c6edc52b7a7580efc1 to your computer and use it in GitHub Desktop.
Github action example Airflow test using pytest
name: Integrity Tests
on:
pull_request:
branches: [ develop ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
AIRFLOW_HOME: /opt/airflow
AIRFLOW_VERSION: 2.2.0
CONSTRAINT_URL: "https://raw.githubusercontent.com/apache/airflow/constraints-2.2.0/constraints-3.9.txt"
AIRFLOW__CORE__LOAD_EXAMPLES: False
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "apache-airflow[postgres,aws,slack,snowflake]==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"
pip install pytest pytest-helpers-namespace
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Init Airflow
run: |
airflow db init
- name: Test with pytest
run: |
pytest -vv test/dags/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment