streamlink/.github/workflows/main.yml

178 lines
6.1 KiB
YAML
Raw Normal View History

2019-10-06 21:47:37 +02:00
name: Test, build and deploy
on:
push: {}
pull_request: {}
schedule:
- cron: '0 0 * * *'
2019-10-06 21:47:37 +02:00
env:
STREAMLINK_DIST_DIR: ${{ github.workspace }}/dist
SIGNING_KEY_ID: 2E390FA0
SIGNING_KEY_FILE: ${{ github.workspace }}/signing.key
2020-04-01 17:24:37 +02:00
DOCS_KEY_FILE: ${{ github.workspace }}/id_rsa_docs
2019-10-06 21:47:37 +02:00
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
2019-10-06 21:47:37 +02:00
matrix:
os: [ubuntu-20.04, windows-latest]
python: [3.6, 3.7, 3.8, 3.9]
2019-10-06 21:47:37 +02:00
# include:
# - python: X.Y-dev
# continue: true
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
2020-10-07 01:56:17 +02:00
- uses: actions/setup-python@v2
2019-10-06 21:47:37 +02:00
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
2020-04-07 14:34:37 +02:00
continue-on-error: ${{ matrix.continue || false }}
2019-10-06 21:47:37 +02:00
run: bash ./script/install-dependencies.sh
- name: Lint (flake8)
continue-on-error: ${{ matrix.continue || false }}
run: flake8 --count
- name: Lint (line terminators)
if: startsWith(matrix.os, 'ubuntu')
run: "! grep 'with CRLF line terminators' <(git ls-files | file -nNf-)"
- name: Lint (file permissions)
if: startsWith(matrix.os, 'ubuntu')
run: "! grep -Ev '^644' <(git ls-files src/ tests/ | xargs stat '--format=%a %n')"
2019-10-06 21:47:37 +02:00
- name: Test
2020-04-07 14:34:37 +02:00
continue-on-error: ${{ matrix.continue || false }}
run: pytest -r a --cov --cov-branch --cov-report=xml
2019-10-06 21:47:37 +02:00
- name: Upload coverage data
if: github.event_name != 'schedule'
2020-04-07 14:34:37 +02:00
continue-on-error: ${{ matrix.continue || false }}
uses: codecov/codecov-action@v1
with:
name: os:${{ matrix.os }} py:${{ matrix.python }}
2019-10-06 21:47:37 +02:00
documentation:
name: Test docs
if: github.event_name != 'schedule'
runs-on: ubuntu-20.04
2019-10-06 21:47:37 +02:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
2019-10-06 21:47:37 +02:00
- uses: actions/setup-python@v1
with:
python-version: 3.9
2019-10-06 21:47:37 +02:00
- name: Install dependencies
run: |
./script/install-dependencies.sh
python -m pip install -r docs-requirements.txt
- name: Build
run: make --directory=docs html
windows-installer:
name: Windows installer
runs-on: ubuntu-20.04
2019-10-06 21:47:37 +02:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
2019-10-06 21:47:37 +02:00
- uses: actions/setup-python@v1
with:
python-version: 3.9
2019-10-06 21:47:37 +02:00
- name: Install dependencies
run: |
./script/install-dependencies.sh
python -m pip install pynsist
2019-10-06 21:47:37 +02:00
sudo apt update
sudo apt install -y nsis imagemagick inkscape
- name: Installer file name
id: installer
run: echo ::set-output name=filename::streamlink-$(python setup.py --version | sed 's/+/_/')
2019-10-06 21:47:37 +02:00
- name: Build
run: ./script/makeinstaller.sh "${{ steps.installer.outputs.filename }}"
- name: Upload artifact
if: github.repository == 'streamlink/streamlink' && (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') || github.event_name == 'schedule')
uses: actions/upload-artifact@v2-preview
with:
name: ${{ steps.installer.outputs.filename }}-win32
path: ${{ env.STREAMLINK_DIST_DIR }}/${{ steps.installer.outputs.filename }}.exe
2020-03-18 02:45:13 +01:00
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
- windows-installer
runs-on: ubuntu-20.04
2020-03-18 02:45:13 +01:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
2020-03-18 02:45:13 +01:00
- uses: actions/setup-python@v1
with:
python-version: 3.9
2020-03-18 02:45:13 +01:00
- 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:
2020-04-01 17:24:37 +02:00
DOCS_KEY_PASSPHRASE: ${{ secrets.DOCS_KEY_PASSPHRASE }}
2020-03-18 02:45:13 +01:00
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-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 300
- name: Fetch tags
run: git fetch --depth=300 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
./script/install-dependencies.sh
2020-12-28 12:35:51 +01:00
python -m pip install -r docs-requirements.txt
python -m pip install --upgrade wheel twine
2020-12-28 12:35:51 +01:00
- name: Build man page
run: make --directory=docs man
- name: Installer file name
id: installer
run: echo ::set-output name=filename::streamlink-$(python setup.py --version | sed 's/+/_/')
- name: Download installer artifact
uses: actions/download-artifact@v2-preview
with:
name: ${{ steps.installer.outputs.filename }}-win32
path: ${{ env.STREAMLINK_DIST_DIR }}
- name: sdist and wheels
env:
2020-04-01 16:45:45 +02:00
RELEASE_KEY_PASSPHRASE: ${{ secrets.RELEASE_KEY_PASSPHRASE }}
run: ./script/build-and-sign.sh
- name: Github release
env:
RELEASES_API_KEY: ${{ secrets.RELEASES_API_KEY }}
run: ./script/github_releases.py "${STREAMLINK_DIST_DIR}/"*{.exe,.tar.gz{,.asc}}
- name: PyPI release
env:
PYPI_USER: streamlink
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: ./script/deploy-pypi.sh