Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/GitHub actions #346

Merged
merged 31 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0b6cc59
migrated project to use poetry
jdepoix Sep 26, 2024
5f96588
added black formatter
jdepoix Sep 26, 2024
b9d9f23
added ruff linter
jdepoix Sep 26, 2024
d35cb58
changed to use ruff format for formatting instead of black
jdepoix Nov 11, 2024
3c1acf3
added GitHub Action CI for formatting, linting and testing
jdepoix Nov 11, 2024
d7a974a
fixed poe install in ci.yml
jdepoix Nov 11, 2024
8cf7470
upgraded setup-python action to v5
jdepoix Nov 11, 2024
3f5c0bc
updated lockfile
jdepoix Nov 11, 2024
e5bd9ae
added coveralls integration
jdepoix Nov 11, 2024
eef0b92
fixed ci.yml formatting
jdepoix Nov 11, 2024
07eae03
removed python 3.14 build
jdepoix Nov 11, 2024
3ecdcff
coveralls command now specifies coverage format
jdepoix Nov 11, 2024
ed40684
coverage now is reported in cobertura format
jdepoix Nov 11, 2024
0967845
testing if coverall will fail build
jdepoix Nov 11, 2024
339fc4b
commented test back in
jdepoix Nov 11, 2024
c64cad6
added publish step to CI
jdepoix Nov 11, 2024
f92e3d6
temporarly added testpypi url
jdepoix Nov 11, 2024
2a1525d
changed pypi publish to use token auth
jdepoix Nov 11, 2024
48cce90
temporary change to test publish in CI
jdepoix Nov 11, 2024
ee996f7
updated test PyPi URL
jdepoix Nov 11, 2024
7881a1d
publish is now automatically executed for new tags
jdepoix Nov 11, 2024
47eae6d
temporary change to test coverage in CI
jdepoix Nov 11, 2024
93fe432
temporary change to test coverage in CI
jdepoix Nov 11, 2024
d631ceb
coverage report stage will now fail immediatelly
jdepoix Nov 11, 2024
c738da2
fixed missing coverage data
jdepoix Nov 11, 2024
9bb8794
fixed typo in ci.yml
jdepoix Nov 11, 2024
402b4cb
fixed coverage stage
jdepoix Nov 11, 2024
006edf9
commented test back in
jdepoix Nov 11, 2024
0064257
added GH Action build status badge to README
jdepoix Nov 11, 2024
32ea9c1
deleted travis.yml
jdepoix Nov 11, 2024
ec3fbe9
added precommit poe task
jdepoix Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .coveragerc

This file was deleted.

95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
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@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install poetry poethepoet
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", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry poethepoet
poetry install --with test
- name: Run tests
run: |
poe ci-test
- name: Report intermediate coverage report
uses: coverallsapp/github-action@v2
with:
file: coverage.xml
format: cobertura
flag-name: run-python-${{ matrix.python-version }}
parallel: true

coverage:
needs: test
runs-on: ubuntu-latest

steps:
- name: Finalize coverage report
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "run-python-3.8,run-python-3.9,run-python-3.10,run-python-3.11,run-python-3.12,run-python-3.13"
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install poetry poethepoet
poetry install --with test
- name: Check coverage
run: poe coverage

publish:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: [coverage, static-checks]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install poetry
poetry install
- name: Build
run: poetry build
- name: Publish
run: poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ dist
build
*.egg-info
upload_new_version.sh
.coverage
.coverage
coverage.xml
.DS_STORE
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BAENLEW8VUJ6G&source=url">
<img src="https://img.shields.io/badge/Donate-PayPal-green.svg" alt="Donate">
</a>
<a href="https://app.travis-ci.com/jdepoix/youtube-transcript-api">
<img src="https://travis-ci.com/jdepoix/youtube-transcript-api.svg?branch=master" alt="Build Status">
<a href="https://github.com/jdepoix/youtube-transcript-api/actions">
<img src="https://github.com/jdepoix/youtube-transcript-api/actions/workflows/ci.yml/badge.svg?branch=master" alt="Build Status">
</a>
<a href="https://coveralls.io/github/jdepoix/youtube-transcript-api?branch=master">
<img src="https://coveralls.io/repos/github/jdepoix/youtube-transcript-api/badge.svg?branch=master" alt="Coverage Status">
Expand Down Expand Up @@ -49,12 +49,6 @@ It is recommended to [install this module by using pip](https://pypi.org/project
pip install youtube-transcript-api
```

If you want to use it from source, you'll have to install the dependencies manually:

```
pip install -r requirements.txt
```

You can either integrate this module [into an existing application](#api) or just use it via a [CLI](#cli).

## API
Expand Down Expand Up @@ -371,10 +365,29 @@ Using the CLI:
youtube_transcript_api <first_video_id> <second_video_id> --cookies /path/to/your/cookies.txt
```


## Warning

This code uses an undocumented part of the YouTube API, which is called by the YouTube web-client. So there is no guarantee that it won't stop working tomorrow, if they change how things work. I will however do my best to make things working again as soon as possible if that happens. So if it stops working, let me know!
This code uses an undocumented part of the YouTube API, which is called by the YouTube web-client. So there is no guarantee that it won't stop working tomorrow, if they change how things work. I will however do my best to make things working again as soon as possible if that happens. So if it stops working, let me know!

## Contributing

To setup the project locally run (requires [poetry](https://python-poetry.org/docs/) to be installed):
```shell
poetry install --with test,dev
```

There's [poe](https://github.com/nat-n/poethepoet?tab=readme-ov-file#quick-start) tasks to run tests, coverage, the linter and formatter (you'll need to pass all of those for the build to pass):
```shell
poe test
poe coverage
poe format
poe lint
```

If you just want to make sure that your code passes all the necessary checks to get a green build, you can simply run:
```shell
poe precommit
```

## Donations

Expand Down
3 changes: 0 additions & 3 deletions coverage.sh

This file was deleted.

Loading