-
Notifications
You must be signed in to change notification settings - Fork 542
127 lines (115 loc) · 4.35 KB
/
nightly.yml
File metadata and controls
127 lines (115 loc) · 4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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