1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 03:32:05 +00:00

[workflows/ci.yml] Extend Python versions

* add 3.10 - 3.12
* use https://pypi.org/project/pynose/ for Py >= 3.9
* test Windows with 3.4
* set defaults (main, both) except push: (all, core)
This commit is contained in:
dirkf 2023-07-20 12:42:46 +01:00
parent 1fa8b86f0b
commit 74eef6bb5e

View file

@ -1,22 +1,34 @@
name: CI name: CI
env: env:
# add 3.10+ after patching nose (https://github.com/nose-devs/nose/issues/1099) all-cpython-versions: 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12
# or switching to fork of https://github.com/mdmintz/pynose main-cpython-versions: 2.7, 3.2, 3.5, 3.9, 3.11
all-cpython-versions: 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9
main-cpython-versions: 2.7, 3.2, 3.5, 3.9
pypy-versions: pypy-2.7, pypy-3.6, pypy-3.7 pypy-versions: pypy-2.7, pypy-3.6, pypy-3.7
cpython-versions: main cpython-versions: main
test-set: both test-set: core
on: on:
push: push:
inputs:
cpython-versions:
type: string
default: all
test-set:
type: string
default: core
pull_request: pull_request:
inputs:
cpython-versions:
type: string
default: main
test-set:
type: string
default: both
workflow_dispatch: workflow_dispatch:
inputs: inputs:
cpython-versions: cpython-versions:
type: choice type: choice
description: CPython versions (main = 2.7, 3.2, 3.5, 3.9) description: CPython versions (main = 2.7, 3.2, 3.5, 3.9, 3.11)
options: options:
- all - all
- main - main
@ -30,7 +42,7 @@ on:
- core - core
- download - download
required: true required: true
default: core default: both
permissions: permissions:
contents: read contents: read
@ -44,7 +56,8 @@ jobs:
test-set: ${{ steps.run.outputs.test-set }} test-set: ${{ steps.run.outputs.test-set }}
own-pip-versions: ${{ steps.run.outputs.own-pip-versions }} own-pip-versions: ${{ steps.run.outputs.own-pip-versions }}
steps: steps:
- id: run - name: Make version array
id: run
run: | run: |
# Make a JSON Array from comma/space-separated string (no extra escaping) # Make a JSON Array from comma/space-separated string (no extra escaping)
json_list() { \ json_list() { \
@ -66,7 +79,6 @@ jobs:
# versions with a special get-pip.py in a per-version subdirectory # versions with a special get-pip.py in a per-version subdirectory
printf 'own-pip-versions=%s\n' \ printf 'own-pip-versions=%s\n' \
"$(json_list 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6)" >> "$GITHUB_OUTPUT" "$(json_list 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6)" >> "$GITHUB_OUTPUT"
tests: tests:
name: Run tests name: Run tests
needs: select needs: select
@ -82,19 +94,18 @@ jobs:
fail-fast: true fail-fast: true
matrix: matrix:
os: [ubuntu-20.04] os: [ubuntu-20.04]
# outside steps, use github.env...., not env....
python-version: ${{ fromJSON(needs.select.outputs.cpython-versions) }} python-version: ${{ fromJSON(needs.select.outputs.cpython-versions) }}
python-impl: [cpython] python-impl: [cpython]
ytdl-test-set: ${{ fromJSON(needs.select.outputs.test-set) }} ytdl-test-set: ${{ fromJSON(needs.select.outputs.test-set) }}
run-tests-ext: [sh] run-tests-ext: [sh]
include: include:
- os: windows-2019 - os: windows-2019
python-version: 3.2 python-version: 3.4
python-impl: cpython python-impl: cpython
ytdl-test-set: ${{ contains(needs.select.outputs.test-set, 'core') && 'core' || 'nocore' }} ytdl-test-set: ${{ contains(needs.select.outputs.test-set, 'core') && 'core' || 'nocore' }}
run-tests-ext: bat run-tests-ext: bat
- os: windows-2019 - os: windows-2019
python-version: 3.2 python-version: 3.4
python-impl: cpython python-impl: cpython
ytdl-test-set: ${{ contains(needs.select.outputs.test-set, 'download') && 'download' || 'nodownload' }} ytdl-test-set: ${{ contains(needs.select.outputs.test-set, 'download') && 'download' || 'nodownload' }}
run-tests-ext: bat run-tests-ext: bat
@ -205,17 +216,14 @@ jobs:
make install ) make install )
rm -rf $openssl_name rm -rf $openssl_name
rmdir $openssl_ssl/certs && ln -s /etc/ssl/certs $openssl_ssl/certs rmdir $openssl_ssl/certs && ln -s /etc/ssl/certs $openssl_ssl/certs
# Download PyEnv from its GitHub repository. # Download PyEnv from its GitHub repository.
export PYENV_ROOT=${{ env.PYENV_ROOT }} export PYENV_ROOT=${{ env.PYENV_ROOT }}
export PATH=$PYENV_ROOT/bin:$PATH export PATH=$PYENV_ROOT/bin:$PATH
git clone "https://github.com/pyenv/pyenv.git" "$PYENV_ROOT" git clone "https://github.com/pyenv/pyenv.git" "$PYENV_ROOT"
# Prevent pyenv build trying (and failing) to update pip # Prevent pyenv build trying (and failing) to update pip
export GET_PIP=get-pip-2.6.py export GET_PIP=get-pip-2.6.py
echo 'import sys; sys.exit(0)' > ${GET_PIP} echo 'import sys; sys.exit(0)' > ${GET_PIP}
GET_PIP=$(realpath $GET_PIP) GET_PIP=$(realpath $GET_PIP)
# Build and install Python # Build and install Python
export CFLAGS="-I$openssl_inc" export CFLAGS="-I$openssl_inc"
export LDFLAGS="-L$openssl_lib" export LDFLAGS="-L$openssl_lib"
@ -322,7 +330,12 @@ jobs:
run: | run: |
echo "$PATH" echo "$PATH"
echo "$PYTHONHOME" echo "$PYTHONHOME"
$PIP -qq show nose || $PIP install nose # Use PyNose for recent Pythons instead of Nose
py3ver="${{ matrix.python-version }}"
py3ver=${py3ver#3.}
[ "$py3ver" != "${{ matrix.python-version }}" ] && py3ver=${py3ver%.*} || py3ver=0
[ "$py3ver" -ge 9 ] && nose=pynose || nose=nose
$PIP -qq show $nose || $PIP install $nose
- name: Install nose for other Python 2 - name: Install nose for other Python 2
if: ${{ matrix.python-impl == 'jython' || matrix.python-version == '2.6' }} if: ${{ matrix.python-impl == 'jython' || matrix.python-version == '2.6' }}
shell: bash shell: bash
@ -354,7 +367,7 @@ jobs:
' def setUp(self):' \ ' def setUp(self):' \
' self.ver = os.environ["PYTHON_VER"].split("-")' \ ' self.ver = os.environ["PYTHON_VER"].split("-")' \
' def test_python_ver(self):' \ ' def test_python_ver(self):' \
' self.assertEqual(sys.version[:3], self.ver[-1])' \ ' self.assertEqual(["%d" % v for v in sys.version_info[:2]], self.ver[-1].split(".")[:2])' \
' self.assertTrue(sys.version.startswith(self.ver[-1]))' \ ' self.assertTrue(sys.version.startswith(self.ver[-1]))' \
' self.assertIn(self.ver[0], sys.version.lower())' \ ' self.assertIn(self.ver[0], sys.version.lower())' \
' def test_python_impl(self):' \ ' def test_python_impl(self):' \
@ -370,7 +383,6 @@ jobs:
PYTHON_IMPL: ${{ matrix.python-impl }} PYTHON_IMPL: ${{ matrix.python-impl }}
run: | run: |
./devscripts/run_tests.${{ matrix.run-tests-ext }} ./devscripts/run_tests.${{ matrix.run-tests-ext }}
flake8: flake8:
name: Linter name: Linter
runs-on: ubuntu-latest runs-on: ubuntu-latest