Add unit tests #45
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: E2E tests | |
on: push | |
jobs: | |
e2e: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- uses: FedericoCarboni/setup-ffmpeg@v3 | |
- uses: actions/checkout@v3 | |
- uses: astral-sh/setup-uv@v3 | |
- name: Install Python 3.12 | |
run: uv python install 3.12 | |
- name: Install project | |
run: uv tool install . | |
- name: Transcribe video | |
run: yt2doc --video https://podcasts.apple.com/gb/podcast/why-should-you-think-like-an-economist/id1523898793?i=1000487091931 -o output.md | |
- name: Display output.md | |
run: cat output.md | |
- name: Check if the output has more than 2000 characters on Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: test $(wc -c < output.md) -gt 2000 | |
- name: Check if the output has more than 2000 characters on Windows | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: (Get-Item output.md).Length -gt 2000 | |
- name: Check if the output has more than 10 blank lines on Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: test $(awk 'BEGIN {paragraphs=0} /^$/ {paragraphs++} END {print paragraphs+1}' output.md) -gt 10 | |
- name: Check if the output has more than 10 blank lines on Windows | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: ((Get-Content output.md -Raw) -split '\r?\n\r?\n').Count -gt 10 |