ci.github: rewrite workflows

- Split up workflows from `main` into `test`, `docs` and `release`
- Update `lint` workflow
- Remove `install-dependencies.sh` script
- Remove script dependencies from `dev-requirements.txt`
This commit is contained in:
bastimeyer 2023-11-15 17:08:49 +01:00 committed by Sebastian Meyer
parent 246a8db3a4
commit 07bdaca63f
7 changed files with 215 additions and 173 deletions

34
.github/workflows/docs.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Documentation
on:
push:
branches:
- master
tags:
- "**"
jobs:
documentation:
name: Build and deploy
if: github.repository == 'streamlink/streamlink'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Python dependencies
run: >
python -m pip install -U
-e .
-r docs-requirements.txt
- name: Build
run: make --directory=docs html
- name: Deploy
env:
DOCS_DEPLOY_TOKEN: ${{ secrets.DOCS_DEPLOY_TOKEN }}
run: ./script/deploy-docs.sh

View File

@ -28,8 +28,11 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: ./script/install-dependencies.sh
- name: Install Python dependencies
run: >
python -m pip install -U
-e .
-r dev-requirements.txt
- name: ruff
run: >
python -m ruff .
@ -43,10 +46,12 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
./script/install-dependencies.sh
python -m pip install -r docs-requirements.txt
- name: Install Python dependencies
run: >
python -m pip install -U
-e .
-r dev-requirements.txt
-r docs-requirements.txt
- name: mypy
run: |
python -m mypy --no-incremental

View File

@ -1,151 +0,0 @@
name: Test, build and deploy
on:
push:
branches-ignore:
- 'automated/**'
tags:
- '**'
pull_request: {}
schedule:
- cron: '0 0 * * *'
env:
STREAMLINK_DIST_DIR: ${{ github.workspace }}/dist
jobs:
test:
name: Test
strategy:
fail-fast: false
# please remember to change the `codecov.notify.after_n_builds` value in .codecov.yml
# when changing the build matrix and changing the number of test runners
matrix:
os:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
# include:
# - python: "3.13-dev"
# os: ubuntu-latest
# continue: true
# - python: "3.13-dev"
# os: windows-latest
# continue: true
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 300
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
continue-on-error: ${{ matrix.continue || false }}
run: bash ./script/install-dependencies.sh
- name: Test
continue-on-error: ${{ matrix.continue || false }}
run: pytest -r a --cov --cov-branch --cov-report=xml --durations 10
- name: Build shell completions
continue-on-error: ${{ matrix.continue || false }}
run: bash ./script/build-shell-completions.sh
- name: Upload coverage data
if: github.event_name != 'schedule'
continue-on-error: ${{ matrix.continue || false }}
uses: codecov/codecov-action@v3
with:
name: os:${{ matrix.os }} py:${{ matrix.python }}
documentation:
name: Test docs
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
./script/install-dependencies.sh
python -m pip install -r docs-requirements.txt
- name: Build
run: make --directory=docs html man
deploy-documentation:
name: Deploy docs
if: github.repository == 'streamlink/streamlink' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
needs:
- test
- documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
./script/install-dependencies.sh
python -m pip install -r docs-requirements.txt
- name: Build
run: make --directory=docs html
- name: Deploy
env:
DOCS_DEPLOY_TOKEN: ${{ secrets.DOCS_DEPLOY_TOKEN }}
run: ./script/deploy-docs.sh
release:
name: New release
if: github.repository == 'streamlink/streamlink' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs:
- deploy-documentation
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
./script/install-dependencies.sh
python -m pip install -r docs-requirements.txt
python -m pip install --upgrade Jinja2 build wheel twine
- name: Build shell completions
run: ./script/build-shell-completions.sh
- name: Build man page
run: make --directory=docs man
- name: sdist and wheels
env:
SIGNING_KEY_ID: 1AEB6400EDA27DA9
SIGNING_KEY_PASSPHRASE: ${{ secrets.SIGNING_KEY_PASSPHRASE }}
run: ./script/build-and-sign.sh
- name: Github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./script/github-release.py "${STREAMLINK_DIST_DIR}"/*.tar.gz{,.asc}
- name: PyPI release
env:
PYPI_USER: streamlink
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: ./script/deploy-pypi.sh

81
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,81 @@
name: Release
on:
push:
branches-ignore:
- "**"
tags:
- "**"
jobs:
build:
name: Build
if: github.repository == 'streamlink/streamlink'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Python dependencies
run: >
python -m pip install -U
-e .
-r docs-requirements.txt
shtab
build
wheel
- name: Build man page
run: make --directory=docs man
- name: Build shell completions
run: ./script/build-shell-completions.sh
- name: Build sdist and wheels
run: ./script/build-and-sign.sh
env:
SIGNING_KEY_ID: 1AEB6400EDA27DA9
SIGNING_KEY_PASSPHRASE: ${{ secrets.SIGNING_KEY_PASSPHRASE }}
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
deploy:
name: Deploy
if: github.repository == 'streamlink/streamlink'
needs:
- build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Python dependencies
run: >
python -m pip install -U
jinja2
requests
twine
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./script/github-release.py dist/*.tar.gz{,.asc}
- name: PyPI release
env:
PYPI_USER: streamlink
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: ./script/deploy-pypi.sh

89
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,89 @@
name: Test
on:
push:
branches-ignore:
- "automated/**"
tags-ignore:
- "**"
pull_request: {}
schedule:
- cron: "0 0 * * *"
jobs:
test:
name: Test
strategy:
fail-fast: false
# please remember to change the `codecov.notify.after_n_builds` value in .codecov.yml
# when changing the build matrix and changing the number of test runners
matrix:
runs-on:
- ubuntu-latest
- windows-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
# include:
# - runs-on: ubuntu-latest
# python-version: "3.13-dev"
# continue: true
# - runs-on: windows-latest
# python-version: "3.13-dev"
# continue: true
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: >
python -m pip install -U
-e .
-r dev-requirements.txt
brotli
shtab
continue-on-error: ${{ matrix.continue || false }}
- name: Test
continue-on-error: ${{ matrix.continue || false }}
run: pytest -r a --cov --cov-branch --cov-report=xml --durations 10
- name: Build shell completions
continue-on-error: ${{ matrix.continue || false }}
run: bash ./script/build-shell-completions.sh
- name: Upload coverage data
if: github.event_name != 'schedule'
continue-on-error: ${{ matrix.continue || false }}
uses: codecov/codecov-action@v3
with:
name: os:${{ matrix.runs-on }} py:${{ matrix.python-version }}
documentation:
name: Test docs
if: github.event_name != 'push'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Python dependencies
run: >
python -m pip install -U
-e .
-r docs-requirements.txt
- name: Build
run: make --directory=docs html man

View File

@ -24,7 +24,3 @@ types-freezegun
types-requests
types-setuptools
types-urllib3
# scripts
shtab # required by script/build-shell-completions.sh
inflection # required by script/generate-cdp.py

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
[[ "$CI" = true ]] || [[ -n "$GITHUB_ACTIONS" ]] || [[ -n "$VIRTUAL_ENV" ]] || exit 1
set -ex
python -m pip install --disable-pip-version-check --upgrade pip setuptools
python -m pip install --upgrade -r dev-requirements.txt
# https://github.com/streamlink/streamlink/issues/4021
python -m pip install brotli
python -m pip install -e .