Skip to content

Commit

Permalink
Merge pull request #346 from jdepoix/feature/github-actions
Browse files Browse the repository at this point in the history
migrated CI to GitHub Actions and setup project to use poetry
  • Loading branch information
jdepoix authored Nov 11, 2024
2 parents 0b7a44c + ec3fbe9 commit ceda81b
Show file tree
Hide file tree
Showing 22 changed files with 1,324 additions and 594 deletions.
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

0 comments on commit ceda81b

Please sign in to comment.