Skip to content

Commit

Permalink
Chore: add github ci workflows (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored Feb 16, 2024
1 parent 81d7894 commit e2e8f0b
Show file tree
Hide file tree
Showing 10 changed files with 362 additions and 181 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Auto-fix when '/autofix' Slash Command is used

on:
workflow_dispatch: {}
repository_dispatch:
types: [autofix-command]

jobs:
python-autofix:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.7.1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'poetry'

- name: Install dependencies
run: poetry install

- name: Format code
run: poetry run ruff format .

- name: Commit changes
run: |
git config --global user.name "Airbyte Automation Bot"
git config --global user.email "[email protected]"
git add .
git diff-index --quiet HEAD || git commit -m "Format code with black"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/python_format_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Python Format Check

on:
push:
branches:
- main
pull_request: {}

jobs:
python-format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.7.1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'

- name: Install dependencies
run: poetry install

- name: Check code format
run: poetry run ruff format --check .
29 changes: 29 additions & 0 deletions .github/workflows/python_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Python Lint Check

on:
push:
branches:
- main
pull_request: {}

jobs:
python-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.7.1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'

- name: Install dependencies
run: poetry install

- name: Format code
run: poetry run ruff check .
47 changes: 47 additions & 0 deletions .github/workflows/python_pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will run pytest, prioritizing rebustness over speed.
# This is in contrast to the 'failfast' workflow, which prioritizes speed over robustness.
name: Pytest (All)

on:
push:
branches:
- main
pull_request: {}

jobs:
pytest:
name: Pytest (All, Python ${{ matrix.python-version }})
# Don't run on forks
if: github.repository_owner == 'airbytehq'

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [
# TODO: Re-enable 3.9 and 3.11 once we have stable tests across all versions.
# '3.9',
'3.10',
# '3.11',
]
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.7.1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install dependencies
run: poetry install

- name: Run Pytest
env:
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
run: poetry run pytest
33 changes: 33 additions & 0 deletions .github/workflows/python_pytest_fast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will run pytest, prioritizing speed over robustness.
# This is in contrast to the 'all' workflow, which prioritizes robustness over speed.
name: Pytest (Fast Tests Only)

on:
push:
branches:
- main
pull_request: {}

jobs:
pytest-fast:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.7.1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'

- name: Install dependencies
run: poetry install

- name: Run Pytest (Fast Tests Only)
env:
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
run: poetry run pytest -m "not slow and not requires_creds" --exitfirst
16 changes: 16 additions & 0 deletions .github/workflows/slash_command_dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Slash Command Dispatch

on:
issue_comment:
types: [created]

jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commands: |
autofix
1 change: 0 additions & 1 deletion airbyte/caches/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.

"""A SQL Cache implementation."""
from __future__ import annotations

Expand Down
Loading

0 comments on commit e2e8f0b

Please sign in to comment.