added GitHub Action CI for formatting, linting and testing
This commit is contained in:
parent
d35cb58cce
commit
3c1acf3d9c
|
@ -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
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue