ci.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. name: CI
  2. env:
  3. 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
  4. main-cpython-versions: 2.7, 3.2, 3.5, 3.9, 3.11
  5. pypy-versions: pypy-2.7, pypy-3.6, pypy-3.7
  6. cpython-versions: main
  7. test-set: core
  8. on:
  9. push:
  10. # push inputs aren't known to GitHub
  11. inputs:
  12. cpython-versions:
  13. type: string
  14. default: all
  15. test-set:
  16. type: string
  17. default: core
  18. pull_request:
  19. # pull_request inputs aren't known to GitHub
  20. inputs:
  21. cpython-versions:
  22. type: string
  23. default: main
  24. test-set:
  25. type: string
  26. default: both
  27. workflow_dispatch:
  28. inputs:
  29. cpython-versions:
  30. type: choice
  31. description: CPython versions (main = 2.7, 3.2, 3.5, 3.9, 3.11)
  32. options:
  33. - all
  34. - main
  35. required: true
  36. default: main
  37. test-set:
  38. type: choice
  39. description: core, download
  40. options:
  41. - both
  42. - core
  43. - download
  44. required: true
  45. default: both
  46. permissions:
  47. contents: read
  48. jobs:
  49. select:
  50. name: Select tests from inputs
  51. runs-on: ubuntu-latest
  52. outputs:
  53. cpython-versions: ${{ steps.run.outputs.cpython-versions }}
  54. test-set: ${{ steps.run.outputs.test-set }}
  55. own-pip-versions: ${{ steps.run.outputs.own-pip-versions }}
  56. steps:
  57. # push and pull_request inputs aren't known to GitHub (pt3)
  58. - name: Set push defaults
  59. if: ${{ github.event_name == 'push' }}
  60. env:
  61. cpython-versions: all
  62. test-set: core
  63. run: |
  64. echo "cpython-versions=${{env.cpython-versions}}" >> "$GITHUB_ENV"
  65. echo "test_set=${{env.test_set}}" >> "$GITHUB_ENV"
  66. - name: Get pull_request inputs
  67. if: ${{ github.event_name == 'pull_request' }}
  68. env:
  69. cpython-versions: main
  70. test-set: both
  71. run: |
  72. echo "cpython-versions=${{env.cpython-versions}}" >> "$GITHUB_ENV"
  73. echo "test_set=${{env.test_set}}" >> "$GITHUB_ENV"
  74. - name: Make version array
  75. id: run
  76. run: |
  77. # Make a JSON Array from comma/space-separated string (no extra escaping)
  78. json_list() { \
  79. ret=""; IFS="${IFS},"; set -- $*; \
  80. for a in "$@"; do \
  81. ret=$(printf '%s"%s"' "${ret}${ret:+, }" "$a"); \
  82. done; \
  83. printf '[%s]' "$ret"; }
  84. tests="${{ inputs.test-set || env.test-set }}"
  85. [ $tests = both ] && tests="core download"
  86. printf 'test-set=%s\n' "$(json_list $tests)" >> "$GITHUB_OUTPUT"
  87. versions="${{ inputs.cpython-versions || env.cpython-versions }}"
  88. if [ "$versions" = all ]; then \
  89. versions="${{ env.all-cpython-versions }}"; else \
  90. versions="${{ env.main-cpython-versions }}"; \
  91. fi
  92. printf 'cpython-versions=%s\n' \
  93. "$(json_list ${versions}${versions:+, }${{ env.pypy-versions }})" >> "$GITHUB_OUTPUT"
  94. # versions with a special get-pip.py in a per-version subdirectory
  95. printf 'own-pip-versions=%s\n' \
  96. "$(json_list 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6)" >> "$GITHUB_OUTPUT"
  97. tests:
  98. name: Run tests
  99. needs: select
  100. permissions:
  101. contents: read
  102. packages: write
  103. runs-on: ${{ matrix.os }}
  104. env:
  105. PIP: python -m pip
  106. PIP_DISABLE_PIP_VERSION_CHECK: true
  107. PIP_NO_PYTHON_VERSION_WARNING: true
  108. strategy:
  109. fail-fast: true
  110. matrix:
  111. os: [ubuntu-20.04]
  112. python-version: ${{ fromJSON(needs.select.outputs.cpython-versions) }}
  113. python-impl: [cpython]
  114. ytdl-test-set: ${{ fromJSON(needs.select.outputs.test-set) }}
  115. run-tests-ext: [sh]
  116. include:
  117. - os: windows-2019
  118. python-version: 3.4
  119. python-impl: cpython
  120. ytdl-test-set: ${{ contains(needs.select.outputs.test-set, 'core') && 'core' || 'nocore' }}
  121. run-tests-ext: bat
  122. - os: windows-2019
  123. python-version: 3.4
  124. python-impl: cpython
  125. ytdl-test-set: ${{ contains(needs.select.outputs.test-set, 'download') && 'download' || 'nodownload' }}
  126. run-tests-ext: bat
  127. # jython
  128. - os: ubuntu-20.04
  129. python-version: 2.7
  130. python-impl: jython
  131. ytdl-test-set: ${{ contains(needs.select.outputs.test-set, 'core') && 'core' || 'nocore' }}
  132. run-tests-ext: sh
  133. - os: ubuntu-20.04
  134. python-version: 2.7
  135. python-impl: jython
  136. ytdl-test-set: ${{ contains(needs.select.outputs.test-set, 'download') && 'download' || 'nodownload' }}
  137. run-tests-ext: sh
  138. steps:
  139. - name: Prepare Linux
  140. if: ${{ startswith(matrix.os, 'ubuntu') }}
  141. shell: bash
  142. run: |
  143. # apt in runner, if needed, may not be up-to-date
  144. sudo apt-get update
  145. - name: Checkout
  146. uses: actions/checkout@v3
  147. #-------- Python 3 -----
  148. - name: Set up supported Python ${{ matrix.python-version }}
  149. id: setup-python
  150. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version != '2.6' && matrix.python-version != '2.7' && matrix.python-version != '3.12'}}
  151. # wrap broken actions/setup-python@v4
  152. # NB may run apt-get install in Linux
  153. uses: ytdl-org/setup-python@v1
  154. with:
  155. python-version: ${{ matrix.python-version }}
  156. cache-build: true
  157. allow-build: info
  158. - name: Locate supported Python ${{ matrix.python-version }}
  159. if: ${{ env.pythonLocation }}
  160. shell: bash
  161. run: |
  162. echo "PYTHONHOME=${pythonLocation}" >> "$GITHUB_ENV"
  163. export expected="${{ steps.setup-python.outputs.python-path }}"
  164. dirname() { printf '%s\n' \
  165. 'import os, sys' \
  166. 'print(os.path.dirname(sys.argv[1]))' \
  167. | ${expected} - "$1"; }
  168. expd="$(dirname "$expected")"
  169. export python="$(command -v python)"
  170. [ "$expd" = "$(dirname "$python")" ] || echo "PATH=$expd:${PATH}" >> "$GITHUB_ENV"
  171. [ -x "$python" ] || printf '%s\n' \
  172. 'import os' \
  173. 'exp = os.environ["expected"]' \
  174. 'python = os.environ["python"]' \
  175. 'exps = os.path.split(exp)' \
  176. 'if python and (os.path.dirname(python) == exp[0]):' \
  177. ' exit(0)' \
  178. 'exps[1] = "python" + os.path.splitext(exps[1])[1]' \
  179. 'python = os.path.join(*exps)' \
  180. 'try:' \
  181. ' os.symlink(exp, python)' \
  182. 'except AttributeError:' \
  183. ' os.rename(exp, python)' \
  184. | ${expected} -
  185. printf '%s\n' \
  186. 'import sys' \
  187. 'print(sys.path)' \
  188. | ${expected} -
  189. #-------- Python 3.12 -
  190. - name: Set up CPython 3.12 environment
  191. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version == '3.12' }}
  192. shell: bash
  193. run: |
  194. PYENV_ROOT=$HOME/.local/share/pyenv
  195. echo "PYENV_ROOT=${PYENV_ROOT}" >> "$GITHUB_ENV"
  196. - name: Cache Python 3.12
  197. id: cache312
  198. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version == '3.12' }}
  199. uses: actions/cache@v3
  200. with:
  201. key: python-3.12
  202. path: |
  203. ${{ env.PYENV_ROOT }}
  204. - name: Build and set up Python 3.12
  205. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version == '3.12' && ! steps.cache312.outputs.cache-hit }}
  206. # dl and build locally
  207. shell: bash
  208. run: |
  209. # Install build environment
  210. sudo apt-get install -y build-essential llvm libssl-dev tk-dev \
  211. libncursesw5-dev libreadline-dev libsqlite3-dev \
  212. libffi-dev xz-utils zlib1g-dev libbz2-dev liblzma-dev
  213. # Download PyEnv from its GitHub repository.
  214. export PYENV_ROOT=${{ env.PYENV_ROOT }}
  215. export PATH=$PYENV_ROOT/bin:$PATH
  216. git clone "https://github.com/pyenv/pyenv.git" "$PYENV_ROOT"
  217. pyenv install 3.12.0b4
  218. - name: Locate Python 3.12
  219. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version == '3.12' }}
  220. shell: bash
  221. run: |
  222. PYTHONHOME="${{ env.PYENV_ROOT }}/versions/3.12.0b4"
  223. echo "PYTHONHOME=$PYTHONHOME" >> "$GITHUB_ENV"
  224. echo "PATH=${PYTHONHOME}/bin:$PATH" >> "$GITHUB_ENV"
  225. #-------- Python 2.7 --
  226. - name: Set up Python 2.7
  227. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version == '2.7' }}
  228. # install 2.7
  229. shell: bash
  230. run: |
  231. sudo apt-get install -y python2 python-is-python2
  232. echo "PYTHONHOME=/usr" >> "$GITHUB_ENV"
  233. #-------- Python 2.6 --
  234. - name: Set up Python 2.6 environment
  235. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version == '2.6' }}
  236. shell: bash
  237. run: |
  238. openssl_name=openssl-1.0.2u
  239. echo "openssl_name=${openssl_name}" >> "$GITHUB_ENV"
  240. openssl_dir=$HOME/.local/opt/$openssl_name
  241. echo "openssl_dir=${openssl_dir}" >> "$GITHUB_ENV"
  242. PYENV_ROOT=$HOME/.local/share/pyenv
  243. echo "PYENV_ROOT=${PYENV_ROOT}" >> "$GITHUB_ENV"
  244. sudo apt-get install -y openssl ca-certificates
  245. - name: Cache Python 2.6
  246. id: cache26
  247. if: ${{ matrix.python-version == '2.6' }}
  248. uses: actions/cache@v3
  249. with:
  250. key: python-2.6.9
  251. path: |
  252. ${{ env.openssl_dir }}
  253. ${{ env.PYENV_ROOT }}
  254. - name: Build and set up Python 2.6
  255. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version == '2.6' && ! steps.cache26.outputs.cache-hit }}
  256. # dl and build locally
  257. shell: bash
  258. run: |
  259. # Install build environment
  260. sudo apt-get install -y build-essential llvm libssl-dev tk-dev \
  261. libncursesw5-dev libreadline-dev libsqlite3-dev \
  262. libffi-dev xz-utils zlib1g-dev libbz2-dev liblzma-dev
  263. # Download and install OpenSSL 1.0.2, back in time
  264. openssl_name=${{ env.openssl_name }}
  265. openssl_targz=${openssl_name}.tar.gz
  266. openssl_dir=${{ env.openssl_dir }}
  267. openssl_inc=$openssl_dir/include
  268. openssl_lib=$openssl_dir/lib
  269. openssl_ssl=$openssl_dir/ssl
  270. curl -L "https://www.openssl.org/source/$openssl_targz" -o $openssl_targz
  271. tar -xf $openssl_targz
  272. ( cd $openssl_name; \
  273. ./config --prefix=$openssl_dir --openssldir=${openssl_dir}/ssl \
  274. --libdir=lib -Wl,-rpath=${openssl_dir}/lib shared zlib-dynamic && \
  275. make && \
  276. make install )
  277. rm -rf $openssl_name
  278. rmdir $openssl_ssl/certs && ln -s /etc/ssl/certs $openssl_ssl/certs
  279. # Download PyEnv from its GitHub repository.
  280. export PYENV_ROOT=${{ env.PYENV_ROOT }}
  281. export PATH=$PYENV_ROOT/bin:$PATH
  282. git clone "https://github.com/pyenv/pyenv.git" "$PYENV_ROOT"
  283. # Prevent pyenv build trying (and failing) to update pip
  284. export GET_PIP=get-pip-2.6.py
  285. echo 'import sys; sys.exit(0)' > ${GET_PIP}
  286. GET_PIP=$(realpath $GET_PIP)
  287. # Build and install Python
  288. export CFLAGS="-I$openssl_inc"
  289. export LDFLAGS="-L$openssl_lib"
  290. export LD_LIBRARY_PATH="$openssl_lib"
  291. pyenv install 2.6.9
  292. - name: Locate Python 2.6
  293. if: ${{ matrix.python-impl == 'cpython' && matrix.python-version == '2.6' }}
  294. shell: bash
  295. run: |
  296. PYTHONHOME="${{ env.PYENV_ROOT }}/versions/2.6.9"
  297. echo "PYTHONHOME=$PYTHONHOME" >> "$GITHUB_ENV"
  298. echo "PATH=${PYTHONHOME}/bin:$PATH" >> "$GITHUB_ENV"
  299. echo "LD_LIBRARY_PATH=${{ env.openssl_dir }}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}" >> "$GITHUB_ENV"
  300. #-------- Jython ------
  301. - name: Set up Java 8
  302. if: ${{ matrix.python-impl == 'jython' }}
  303. uses: actions/setup-java@v3
  304. with:
  305. java-version: 8
  306. distribution: 'zulu'
  307. - name: Setup Jython environment
  308. if: ${{ matrix.python-impl == 'jython' }}
  309. shell: bash
  310. run: |
  311. echo "JYTHON_ROOT=${HOME}/jython" >> "$GITHUB_ENV"
  312. echo "PIP=pip" >> "$GITHUB_ENV"
  313. - name: Cache Jython
  314. id: cachejy
  315. if: ${{ matrix.python-impl == 'jython' && matrix.python-version == '2.7' }}
  316. uses: actions/cache@v3
  317. with:
  318. # 2.7.3 now available, may solve SNI issue
  319. key: jython-2.7.1
  320. path: |
  321. ${{ env.JYTHON_ROOT }}
  322. - name: Install Jython
  323. if: ${{ matrix.python-impl == 'jython' && matrix.python-version == '2.7' && ! steps.cachejy.outputs.cache-hit }}
  324. shell: bash
  325. run: |
  326. JYTHON_ROOT="${{ env.JYTHON_ROOT }}"
  327. curl -L "https://repo1.maven.org/maven2/org/python/jython-installer/2.7.1/jython-installer-2.7.1.jar" -o jython-installer.jar
  328. java -jar jython-installer.jar -s -d "${JYTHON_ROOT}"
  329. echo "${JYTHON_ROOT}/bin" >> "$GITHUB_PATH"
  330. - name: Set up cached Jython
  331. if: ${{ steps.cachejy.outputs.cache-hit }}
  332. shell: bash
  333. run: |
  334. JYTHON_ROOT="${{ env.JYTHON_ROOT }}"
  335. echo "${JYTHON_ROOT}/bin" >> $GITHUB_PATH
  336. - name: Install supporting Python 2.7 if possible
  337. if: ${{ steps.cachejy.outputs.cache-hit }}
  338. shell: bash
  339. run: |
  340. sudo apt-get install -y python2.7 || true
  341. #-------- pip ---------
  342. - name: Set up supported Python ${{ matrix.python-version }} pip
  343. if: ${{ (matrix.python-version != '3.2' && steps.setup-python.outputs.python-path) || matrix.python-version == '2.7' }}
  344. # This step may run in either Linux or Windows
  345. shell: bash
  346. run: |
  347. echo "$PATH"
  348. echo "$PYTHONHOME"
  349. # curl is available on both Windows and Linux, -L follows redirects, -O gets name
  350. python -m ensurepip || python -m pip --version || { \
  351. get_pip="${{ contains(needs.select.outputs.own-pip-versions, matrix.python-version) && format('{0}/', matrix.python-version) || '' }}"; \
  352. curl -L -O "https://bootstrap.pypa.io/pip/${get_pip}get-pip.py"; \
  353. python get-pip.py; }
  354. - name: Set up Python 2.6 pip
  355. if: ${{ matrix.python-version == '2.6' }}
  356. shell: bash
  357. run: |
  358. python -m pip --version || { \
  359. curl -L -O "https://bootstrap.pypa.io/pip/2.6/get-pip.py"; \
  360. curl -L -O "https://files.pythonhosted.org/packages/ac/95/a05b56bb975efa78d3557efa36acaf9cf5d2fd0ee0062060493687432e03/pip-9.0.3-py2.py3-none-any.whl"; \
  361. python get-pip.py --no-setuptools --no-wheel pip-9.0.3-py2.py3-none-any.whl; }
  362. # work-around to invoke pip module on 2.6: https://bugs.python.org/issue2751
  363. echo "PIP=python -m pip.__main__" >> "$GITHUB_ENV"
  364. - name: Set up other Python ${{ matrix.python-version }} pip
  365. if: ${{ matrix.python-version == '3.2' && steps.setup-python.outputs.python-path }}
  366. shell: bash
  367. run: |
  368. python -m pip --version || { \
  369. curl -L -O "https://bootstrap.pypa.io/pip/3.2/get-pip.py"; \
  370. curl -L -O "https://files.pythonhosted.org/packages/b2/d0/cd115fe345dd6f07ec1c780020a7dfe74966fceeb171e0f20d1d4905b0b7/pip-7.1.2-py2.py3-none-any.whl"; \
  371. python get-pip.py --no-setuptools --no-wheel pip-7.1.2-py2.py3-none-any.whl; }
  372. #-------- unittest ----
  373. - name: Upgrade Unittest for Python 2.6
  374. if: ${{ matrix.python-version == '2.6' }}
  375. shell: bash
  376. run: |
  377. # Work around deprecation of support for non-SNI clients at PyPI CDN (see https://status.python.org/incidents/hzmjhqsdjqgb)
  378. $PIP -qq show unittest2 || { \
  379. for u in "65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl" \
  380. "f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl" \
  381. "c7/a3/c5da2a44c85bfbb6eebcfc1dde24933f8704441b98fdde6528f4831757a6/linecache2-1.0.0-py2.py3-none-any.whl" \
  382. "17/0a/6ac05a3723017a967193456a2efa0aa9ac4b51456891af1e2353bb9de21e/traceback2-1.4.0-py2.py3-none-any.whl" \
  383. "72/20/7f0f433060a962200b7272b8c12ba90ef5b903e218174301d0abfd523813/unittest2-1.1.0-py2.py3-none-any.whl"; do \
  384. curl -L -O "https://files.pythonhosted.org/packages/${u}"; \
  385. $PIP install ${u##*/}; \
  386. done; }
  387. # make tests use unittest2
  388. for test in ./test/test_*.py ./test/helper.py; do
  389. sed -r -i -e '/^import unittest$/s/test/test2 as unittest/' "$test"
  390. done
  391. #-------- nose --------
  392. - name: Install nose for Python ${{ matrix.python-version }}
  393. if: ${{ (matrix.python-version != '3.2' && steps.setup-python.outputs.python-path) || (matrix.python-impl == 'cpython' && (matrix.python-version == '2.7' || matrix.python-version == '3.12')) }}
  394. shell: bash
  395. run: |
  396. echo "$PATH"
  397. echo "$PYTHONHOME"
  398. # Use PyNose for recent Pythons instead of Nose
  399. py3ver="${{ matrix.python-version }}"
  400. py3ver=${py3ver#3.}
  401. [ "$py3ver" != "${{ matrix.python-version }}" ] && py3ver=${py3ver%.*} || py3ver=0
  402. [ "$py3ver" -ge 9 ] && nose=pynose || nose=nose
  403. $PIP -qq show $nose || $PIP install $nose
  404. - name: Install nose for other Python 2
  405. if: ${{ matrix.python-impl == 'jython' || (matrix.python-impl == 'cpython' && matrix.python-version == '2.6') }}
  406. shell: bash
  407. run: |
  408. # Work around deprecation of support for non-SNI clients at PyPI CDN (see https://status.python.org/incidents/hzmjhqsdjqgb)
  409. $PIP -qq show nose || { \
  410. curl -L -O "https://files.pythonhosted.org/packages/99/4f/13fb671119e65c4dce97c60e67d3fd9e6f7f809f2b307e2611f4701205cb/nose-1.3.7-py2-none-any.whl"; \
  411. $PIP install nose-1.3.7-py2-none-any.whl; }
  412. - name: Install nose for other Python 3
  413. if: ${{ matrix.python-version == '3.2' && steps.setup-python.outputs.python-path }}
  414. shell: bash
  415. run: |
  416. $PIP -qq show nose || { \
  417. curl -L -O "https://files.pythonhosted.org/packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl"; \
  418. $PIP install nose-1.3.7-py3-none-any.whl; }
  419. - name: Set up nosetest test
  420. if: ${{ contains(needs.select.outputs.test-set, matrix.ytdl-test-set ) }}
  421. shell: bash
  422. run: |
  423. # set PYTHON_VER
  424. PYTHON_VER=${{ matrix.python-version }}
  425. [ "${PYTHON_VER#*-}" != "$PYTHON_VER" ] || PYTHON_VER="${{ matrix.python-impl }}-${PYTHON_VER}"
  426. echo "PYTHON_VER=$PYTHON_VER" >> "$GITHUB_ENV"
  427. echo "PYTHON_IMPL=${{ matrix.python-impl }}" >> "$GITHUB_ENV"
  428. # define a test to validate the Python version used by nosetests
  429. printf '%s\n' \
  430. 'from __future__ import unicode_literals' \
  431. 'import sys, os, platform' \
  432. 'try:' \
  433. ' import unittest2 as unittest' \
  434. 'except ImportError:' \
  435. ' import unittest' \
  436. 'class TestPython(unittest.TestCase):' \
  437. ' def setUp(self):' \
  438. ' self.ver = os.environ["PYTHON_VER"].split("-")' \
  439. ' def test_python_ver(self):' \
  440. ' self.assertEqual(["%d" % v for v in sys.version_info[:2]], self.ver[-1].split(".")[:2])' \
  441. ' self.assertTrue(sys.version.startswith(self.ver[-1]))' \
  442. ' self.assertIn(self.ver[0], ",".join((sys.version, platform.python_implementation())).lower())' \
  443. ' def test_python_impl(self):' \
  444. ' self.assertIn(platform.python_implementation().lower(), (os.environ["PYTHON_IMPL"], self.ver[0]))' \
  445. > test/test_python.py
  446. #-------- TESTS -------
  447. - name: Run tests
  448. if: ${{ contains(needs.select.outputs.test-set, matrix.ytdl-test-set ) }}
  449. continue-on-error: ${{ matrix.ytdl-test-set == 'download' || matrix.python-impl == 'jython' }}
  450. env:
  451. YTDL_TEST_SET: ${{ matrix.ytdl-test-set }}
  452. run: |
  453. ./devscripts/run_tests.${{ matrix.run-tests-ext }}
  454. flake8:
  455. name: Linter
  456. runs-on: ubuntu-latest
  457. steps:
  458. - uses: actions/checkout@v3
  459. - name: Set up Python
  460. uses: actions/setup-python@v4
  461. with:
  462. python-version: 3.9
  463. - name: Install flake8
  464. run: pip install flake8
  465. - name: Run flake8
  466. run: flake8 .