[ci] Improve workflow checks (#14316)

Authored by: bashonly
pull/14268/head
bashonly 5 days ago committed by GitHub
parent 8ab262c66b
commit ae3923b6b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,12 +3,14 @@ on:
push: push:
paths: paths:
- .github/workflows/* - .github/workflows/*
- bundle/docker/linux/*.sh
- devscripts/setup_variables.py - devscripts/setup_variables.py
- devscripts/setup_variables_tests.py - devscripts/setup_variables_tests.py
- devscripts/utils.py - devscripts/utils.py
pull_request: pull_request:
paths: paths:
- .github/workflows/* - .github/workflows/*
- bundle/docker/linux/*.sh
- devscripts/setup_variables.py - devscripts/setup_variables.py
- devscripts/setup_variables_tests.py - devscripts/setup_variables_tests.py
- devscripts/utils.py - devscripts/utils.py
@ -32,6 +34,7 @@ jobs:
env: env:
ACTIONLINT_TARBALL: ${{ format('actionlint_{0}_linux_amd64.tar.gz', env.ACTIONLINT_VERSION) }} ACTIONLINT_TARBALL: ${{ format('actionlint_{0}_linux_amd64.tar.gz', env.ACTIONLINT_VERSION) }}
run: | run: |
python -m devscripts.install_deps -o --include test
sudo apt -y install shellcheck sudo apt -y install shellcheck
python -m pip install -U pyflakes python -m pip install -U pyflakes
curl -LO "${ACTIONLINT_REPO}/releases/download/v${ACTIONLINT_VERSION}/${ACTIONLINT_TARBALL}" curl -LO "${ACTIONLINT_REPO}/releases/download/v${ACTIONLINT_VERSION}/${ACTIONLINT_TARBALL}"
@ -41,6 +44,9 @@ jobs:
- name: Run actionlint - name: Run actionlint
run: | run: |
./actionlint -color ./actionlint -color
- name: Check Docker shell scripts
run: |
shellcheck bundle/docker/linux/*.sh
- name: Test GHA devscripts - name: Test GHA devscripts
run: | run: |
python -m devscripts.setup_variables_tests pytest -Werror --tb=short devscripts/setup_variables_tests.py

@ -24,6 +24,7 @@ if [[ -z "${EXCLUDE_CURL_CFFI:-}" ]]; then
fi fi
runpy -m venv /yt-dlp-build-venv runpy -m venv /yt-dlp-build-venv
# shellcheck disable=SC1091
source /yt-dlp-build-venv/bin/activate source /yt-dlp-build-venv/bin/activate
# Inside the venv we use venvpy instead of runpy # Inside the venv we use venvpy instead of runpy
venvpy -m ensurepip --upgrade --default-pip venvpy -m ensurepip --upgrade --default-pip

@ -1,4 +1,3 @@
# Allow direct execution
import os import os
import sys import sys
@ -55,7 +54,7 @@ def _test(github_repository, note, repo_vars, repo_secrets, inputs, expected=Non
assert result == exp, f'unexpected result: {github_repository} {note}' assert result == exp, f'unexpected result: {github_repository} {note}'
def main(): def test_setup_variables():
DEFAULT_VERSION_WITH_REVISION = dt.datetime.now(tz=dt.timezone.utc).strftime('%Y.%m.%d.%H%M%S') DEFAULT_VERSION_WITH_REVISION = dt.datetime.now(tz=dt.timezone.utc).strftime('%Y.%m.%d.%H%M%S')
DEFAULT_VERSION = calculate_version() DEFAULT_VERSION = calculate_version()
BASE_REPO_VARS = { BASE_REPO_VARS = {
@ -323,9 +322,3 @@ def main():
'pypi_project': None, 'pypi_project': None,
'pypi_suffix': None, 'pypi_suffix': None,
}, ignore_revision=True) }, ignore_revision=True)
print('all tests passed')
if __name__ == '__main__':
main()

Loading…
Cancel
Save