Skip to content

Commit

Permalink
added GitHub Action CI for formatting, linting and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdepoix committed Nov 11, 2024
1 parent d35cb58 commit 3c1acf3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
push:
branches: [ "master" ]
pull_request:

jobs:
static-checks:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install poetry poe
poetry install --only dev
- name: Format
run: poe ci-format
- name: Lint
run: poe lint

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry poe
poetry install --with test
- name: Run tests
run: |
poe ci-test
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,30 @@ youtube_transcript_api = "youtube_transcript_api.__main__:main"

[tool.poe.tasks]
test = "pytest youtube_transcript_api"
ci-test.shell = "coverage run -m unittest discover && coverage report -m --fail-under=100"
coverage.shell = "coverage run -m unittest discover && coverage report -m"
format = "ruff format youtube_transcript_api"
ci-format = "ruff format youtube_transcript_api --check"
lint = "ruff check youtube_transcript_api"

[tool.poetry.dependencies]
python = ">=3.8,<3.13"
requests = "*"

[tool.poetry.group.test]
optional = true

[tool.poetry.group.test.dependencies]
pytest = "^8.3.3"
coverage = "^7.6.1"
mock = "^5.1.0"
httpretty = "^1.1.4"
coveralls = "^4.0.1"

[tool.poetry.group.dev]
optional = true

[tool.poetry.group.dev.dependencies]
ruff = "^0.6.8"

[tool.coverage.run]
Expand Down

0 comments on commit 3c1acf3

Please sign in to comment.