mirror of
https://github.com/yt-dlp/ejs.git
synced 2026-06-13 00:32:11 +00:00
313 lines
8.7 KiB
YAML
313 lines
8.7 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
paths:
|
|
- ".github/workflows/ci.yml"
|
|
- ".github/workflows/release.yml"
|
|
- "hatch_build.py"
|
|
- "package.json"
|
|
- "pyproject.toml"
|
|
- "rollup.config.js"
|
|
- "run.ts"
|
|
- "src/**"
|
|
- "yt_dlp_ejs/**"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/ci.yml"
|
|
- ".github/workflows/release.yml"
|
|
- "hatch_build.py"
|
|
- "package.json"
|
|
- "pyproject.toml"
|
|
- "rollup.config.js"
|
|
- "run.ts"
|
|
- "src/**"
|
|
- "yt_dlp_ejs/**"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
python_tests:
|
|
name: Python tests
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', pypy-3.11]
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Install Deno v2.x (latest)
|
|
uses: denoland/setup-deno@v2
|
|
with:
|
|
deno-version: v2.x
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Build project
|
|
run: |
|
|
# `pip install -e` omits the force-included JS, so use `build` instead
|
|
python -m pip install -U build
|
|
python -m build
|
|
unzip -u dist/yt_dlp_ejs-*.whl "yt_dlp_ejs/*"
|
|
- name: Run Python tests
|
|
timeout-minutes: 5
|
|
run: |
|
|
python -m unittest
|
|
# python -Werror -m unittest
|
|
|
|
prepare:
|
|
name: Prepare JS runtime tests
|
|
needs: [python_tests]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Install Deno v2.x (latest)
|
|
uses: denoland/setup-deno@v2
|
|
with:
|
|
deno-version: v2.x
|
|
- name: Install Deno requirements
|
|
run: |
|
|
deno install
|
|
- name: Build control bundle
|
|
run: |
|
|
deno task bundle
|
|
- name: Generate bundle hashes
|
|
run: |
|
|
pushd dist
|
|
sha256sum -- yt.solver.*.js | tee SHA2-256SUMS
|
|
popd
|
|
- name: Upload bundle hashes
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: bundle-hashes
|
|
path: |
|
|
dist/SHA2-256SUMS
|
|
compression-level: 0
|
|
- name: Download player JS files
|
|
run: |
|
|
deno run \
|
|
--no-prompt \
|
|
--allow-read=src/yt/solver/test/players/ \
|
|
--allow-write=src/yt/solver/test/players/ \
|
|
--allow-net=www.youtube.com \
|
|
src/yt/solver/test/download.ts
|
|
- name: Upload player JS artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: player-js
|
|
path: |
|
|
src/yt/solver/test/players/*
|
|
compression-level: 0
|
|
|
|
deno_build:
|
|
name: Test Deno build
|
|
needs: [prepare]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Install Deno
|
|
uses: denoland/setup-deno@v2
|
|
with:
|
|
deno-version: "2.0.0" # minimum supported version
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.10" # minimum supported version
|
|
- name: Install Python requirements
|
|
run: |
|
|
python -m pip install -U build
|
|
- name: Test Deno build
|
|
run: |
|
|
python -m build
|
|
- name: Verify artifact contents
|
|
run: |
|
|
tar -tvzf dist/yt_dlp_ejs-*.tar.gz
|
|
unzip -l dist/yt_dlp_ejs-*.whl | tee .wheel_contents
|
|
grep -q 'yt_dlp_ejs/yt/solver/core\.min\.js' .wheel_contents
|
|
grep -q 'yt_dlp_ejs/yt/solver/lib\.min\.js' .wheel_contents
|
|
- name: Install Deno requirements
|
|
run: |
|
|
deno install
|
|
- name: Bundle with Deno
|
|
run: |
|
|
deno task bundle
|
|
- name: Download bundle hashes
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
path: dist
|
|
name: bundle-hashes
|
|
- name: Verify bundle hashes
|
|
run: |
|
|
cd dist
|
|
sha256sum -c SHA2-256SUMS
|
|
|
|
deno_tests:
|
|
name: Run Deno tests
|
|
needs: [prepare]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Install Deno
|
|
uses: denoland/setup-deno@v2
|
|
with:
|
|
deno-version: "2.0.0" # minimum supported version
|
|
- name: Install Deno requirements
|
|
run: |
|
|
deno install
|
|
- name: Download player JS artifact
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
path: src/yt/solver/test/players
|
|
name: player-js
|
|
- name: Run Deno tests
|
|
run: |
|
|
deno test \
|
|
--no-prompt \
|
|
--allow-read=src/yt/solver/test/players/
|
|
|
|
bun_build:
|
|
name: Test Bun build
|
|
needs: [prepare]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Install Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: "1.0.31" # minimum supported version
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.10" # minimum supported version
|
|
- name: Install Python requirements
|
|
run: |
|
|
python -m pip install -U build
|
|
- name: Test Bun build
|
|
run: |
|
|
python -m build
|
|
- name: Verify artifact contents
|
|
run: |
|
|
tar -tvzf dist/yt_dlp_ejs-*.tar.gz
|
|
unzip -l dist/yt_dlp_ejs-*.whl | tee .wheel_contents
|
|
grep -q 'yt_dlp_ejs/yt/solver/core\.min\.js' .wheel_contents
|
|
grep -q 'yt_dlp_ejs/yt/solver/lib\.min\.js' .wheel_contents
|
|
- name: Install Bun requirements
|
|
run: |
|
|
bun install
|
|
- name: Bundle with Bun
|
|
run: |
|
|
bun --bun run bundle
|
|
- name: Download bundle hashes
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
path: dist
|
|
name: bundle-hashes
|
|
- name: Verify bundle hashes
|
|
run: |
|
|
cd dist
|
|
sha256sum -c SHA2-256SUMS
|
|
|
|
bun_tests:
|
|
name: Run Bun tests
|
|
needs: [prepare]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Install Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: "1.2.11" # XXX: We support 1.0.31, but test suite requires 1.2.11+
|
|
- name: Install Bun requirements
|
|
run: |
|
|
bun install
|
|
- name: Download player JS artifact
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
path: src/yt/solver/test/players
|
|
name: player-js
|
|
- name: Run Bun tests
|
|
run: |
|
|
bun test
|
|
|
|
node_build:
|
|
name: Test Node build
|
|
needs: [prepare]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Install Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: "20.0" # minimum supported version
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.10" # minimum supported version
|
|
- name: Install Python requirements
|
|
run: |
|
|
python -m pip install -U build
|
|
- name: Test Node build
|
|
run: |
|
|
python -m build
|
|
- name: Verify artifact contents
|
|
run: |
|
|
tar -tvzf dist/yt_dlp_ejs-*.tar.gz
|
|
unzip -l dist/yt_dlp_ejs-*.whl | tee .wheel_contents
|
|
grep -q 'yt_dlp_ejs/yt/solver/core\.min\.js' .wheel_contents
|
|
grep -q 'yt_dlp_ejs/yt/solver/lib\.min\.js' .wheel_contents
|
|
- name: Install Node requirements
|
|
run: |
|
|
npm install
|
|
- name: Bundle with Node
|
|
run: |
|
|
npm run bundle
|
|
- name: Download bundle hashes
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
path: dist
|
|
name: bundle-hashes
|
|
- name: Verify bundle hashes
|
|
run: |
|
|
cd dist
|
|
sha256sum -c SHA2-256SUMS
|
|
|
|
node_tests:
|
|
name: Run Node tests
|
|
needs: [prepare]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Install Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: "22.18" # XXX: We support 20.0, but test suite requires 22.18+
|
|
- name: Install Node requirements
|
|
run: |
|
|
npm install
|
|
- name: Download player JS artifact
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
path: src/yt/solver/test/players
|
|
name: player-js
|
|
- name: Run Node tests
|
|
run: |
|
|
node --test
|
|
|
|
all_passed:
|
|
needs: [deno_build, deno_tests, bun_build, bun_tests, node_build, node_tests]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: All checks passed
|
|
run: |
|
|
echo "All checks passed!"
|