Nightly E2E Tests #206
This file contains hidden or 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: Nightly E2E Tests | |
| on: | |
| schedule: | |
| # Main branch: 6 AM UTC (10 PM PST / 1 AM EST) | |
| - cron: '0 6 * * *' | |
| # Develop branch: 11 AM UTC (3 AM PST / 6 AM EST) - 5 hours later | |
| - cron: '0 11 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| test_filter: | |
| description: 'Specific test to run (e.g., tests/e2e/test_downloads.py::TestDownloadReport)' | |
| required: false | |
| default: '' | |
| custom_branch: | |
| description: 'Override branch to test (leave empty to test the branch you triggered from)' | |
| required: false | |
| default: '' | |
| jobs: | |
| # Determine which branch to test | |
| resolve-branch: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'teng-lin/notebooklm-py' | |
| outputs: | |
| branch: ${{ steps.resolve.outputs.branch }} | |
| is_standard: ${{ steps.resolve.outputs.is_standard }} | |
| steps: | |
| - name: Resolve target branch | |
| id: resolve | |
| run: | | |
| if [ "${{ github.event_name }}" = "schedule" ]; then | |
| # Scheduled: determine from cron expression | |
| if [ "${{ github.event.schedule }}" = "0 6 * * *" ]; then | |
| echo "branch=main" >> $GITHUB_OUTPUT | |
| else | |
| echo "branch=develop" >> $GITHUB_OUTPUT | |
| fi | |
| echo "is_standard=true" >> $GITHUB_OUTPUT | |
| else | |
| # Manual: use custom_branch if set, otherwise use triggering branch | |
| CUSTOM="${{ inputs.custom_branch }}" | |
| if [ -n "$CUSTOM" ]; then | |
| TARGET="$CUSTOM" | |
| else | |
| TARGET="${{ github.ref_name }}" | |
| fi | |
| echo "branch=$TARGET" >> $GITHUB_OUTPUT | |
| # Check if it's main or develop | |
| if [ "$TARGET" = "main" ] || [ "$TARGET" = "develop" ]; then | |
| echo "is_standard=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_standard=false" >> $GITHUB_OUTPUT | |
| fi | |
| fi | |
| echo "Resolved branch: $(cat $GITHUB_OUTPUT | grep branch= | cut -d= -f2)" | |
| # Run E2E tests on the resolved branch | |
| e2e: | |
| name: E2E Tests (${{ needs.resolve-branch.outputs.branch }}/${{ matrix.os }}) | |
| needs: resolve-branch | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| concurrency: | |
| group: nightly-${{ needs.resolve-branch.outputs.branch }}-${{ matrix.os }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ needs.resolve-branch.outputs.branch }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[all]" | |
| - name: Get Playwright version | |
| id: playwright-version | |
| shell: bash | |
| run: | | |
| echo "version=$(pip show playwright | grep '^Version:' | cut -d' ' -f2)" >> $GITHUB_OUTPUT | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cache/ms-playwright | |
| ~/AppData/Local/ms-playwright | |
| key: playwright-${{ matrix.os }}-${{ steps.playwright-version.outputs.version }} | |
| - name: Install Playwright browsers | |
| run: playwright install chromium | |
| - name: Install Playwright system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: playwright install-deps | |
| - name: Run E2E tests | |
| env: | |
| NOTEBOOKLM_AUTH_JSON: ${{ secrets.NOTEBOOKLM_AUTH_JSON }} | |
| NOTEBOOKLM_READ_ONLY_NOTEBOOK_ID: ${{ secrets.NOTEBOOKLM_READ_ONLY_NOTEBOOK_ID }} | |
| NOTEBOOKLM_GENERATION_NOTEBOOK_ID: ${{ secrets.NOTEBOOKLM_GENERATION_NOTEBOOK_ID }} | |
| shell: bash | |
| run: | | |
| echo "Testing branch: ${{ needs.resolve-branch.outputs.branch }}" | |
| TEST_FILTER="${{ inputs.test_filter }}" | |
| if [ -n "$TEST_FILTER" ]; then | |
| # Run specific test(s) when filter provided | |
| pytest "$TEST_FILTER" -s -v --tb=short --reruns 2 --reruns-delay 30 | |
| elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
| # Linux: run all E2E tests except variants | |
| pytest tests/e2e -m "not variants" -s -v --tb=short --reruns 2 --reruns-delay 30 | |
| else | |
| # Windows: run only read-only tests (safer, avoids write operations) | |
| pytest tests/e2e -m "readonly and not variants" -s -v --tb=short --reruns 2 --reruns-delay 30 | |
| fi |