Changes to providers, tests & github actions #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
Authorize: | |
environment: ${{ github.event_name == 'pull_request_target' && | |
github.event.pull_request.head.repo.full_name != github.repository && | |
'external' || 'internal' }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: true | |
Type-Check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
architecture: "x64" | |
- run: pip3 install hatch | |
- run: hatch run tests.py3.9-2.7:type-check | |
Run-Unit-Tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
airflow-version: ["2.7", "2.8", "2.9"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
.nox | |
key: unit-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('cosmos/__init__.py') }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install packages and dependencies | |
run: | | |
python -m pip install hatch | |
hatch -e tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }} run pip freeze | |
- name: Test Anyscale against Airflow ${{ matrix.airflow-version }} and Python ${{ matrix.python-version }} | |
run: | | |
hatch run tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }}:test-cov | |
- name: Upload coverage to Github | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-unit-test-${{ matrix.python-version }}-${{ matrix.airflow-version }} | |
path: .coverage | |
Run-Integration-Tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9"] | |
airflow-version: ["2.8"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
.nox | |
key: integration-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('cosmos/__init__.py') }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install packages and dependencies | |
run: | | |
python -m pip install hatch pytest | |
hatch -e tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }} run pip freeze | |
- name: Run Integration Tests against Airflow ${{ matrix.airflow-version }} and Python ${{ matrix.python-version }} | |
run: | | |
pytest path/to/your/integration/tests | |
- name: Upload coverage to Github | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-integration-test-${{ matrix.python-version }}-${{ matrix.airflow-version }} | |
path: .coverage |