End to end test workflow #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
workflow_dispatch: | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint-format: | |
name: Lint and format check | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
if: always() | |
- name: Install Ruff and autopep8 | |
if: always() | |
run: pip install ruff autopep8 | |
- name: Python lint check (Ruff) | |
if: always() | |
run: ruff check --output-format=github -v plugin/ | |
- name: Python lint check (autopep8) | |
if: always() | |
run: autopep8 --diff plugin/ | |
- name: Install server dependencies | |
if: always() | |
run: cd server && yarn install | |
- name: Server lint check (ESlint) | |
if: always() | |
run: cd server && npx eslint --max-warnings=0 src/ | |
- name: Server format check (Prettier) | |
if: always() | |
run: cd server && npx prettier --check 'src/**/*.{js,ts}' | |
script-method: | |
name: Test plugin | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download yt-dlp | |
run: curl -L https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/latest/download/yt-dlp -o yt-dlp && chmod +x ./yt-dlp | |
- name: Install and build server dependencies | |
run: cd server/ && yarn install --frozen-lockfile && npx tsc | |
- name: Install plugin | |
run: | | |
mkdir ~/yt-dlp-plugins && curl -L "https://github.com/coletdjnz/yt-dlp-get-pot/releases/download/v0.1.1/yt-dlp-get-pot.zip" -o ~/yt-dlp-plugins/yt-dlp-get-pot.zip | |
cp -aT plugin/ ~/yt-dlp-plugins/bgutil-ytdlp-pot-provider/ | |
- name: Test script method | |
run: | | |
script_response=$(./yt-dlp -vF --print-traffic BaW_jenozKc --extractor-args "youtube:getpot_bgutil_script=server/build/generate_once.js" 2>&1) | |
echo $script_response | |
if [[ "$script_response" != *"BgUtilScriptPot: Generating POT via script"* ]]; then | |
echo "::error file=plugin/yt_dlp_plugins/extractor/getpot_bgutil_script.py::BgUtilScriptPot was not invoked" | |
exit 1 | |
fi | |
- name: Test server method | |
if: always() | |
timeout-minutes: 3 | |
run: | | |
cd server/ | |
node build/main.js& | |
cd .. | |
echo "Waiting for server to be up..." | |
until curl --silent --fail http://127.0.0.1:4416/ping; do | |
sleep 0.5 | |
done | |
script_response=$(./yt-dlp -vF --print-traffic BaW_jenozKc --extractor-args "youtube:getpot_bgutil_baseurl=http://127.0.0.1:4416" 2>&1) | |
echo $script_response | |
if [[ "$script_response" != *"BgUtilHTTPPot: Generating POT via HTTP server"* ]]; then | |
echo "::error file=plugin/yt_dlp_plugins/extractor/getpot_bgutil_http.py::BgUtilHTTPPot was not invoked" | |
exit 1 | |
fi |