-
-
Notifications
You must be signed in to change notification settings - Fork 31
136 lines (121 loc) · 4.79 KB
/
test-update.yml
File metadata and controls
136 lines (121 loc) · 4.79 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
128
129
130
131
132
133
134
135
136
name: Autotest (update screenshots)
on: workflow_dispatch
jobs:
autotest:
runs-on: macos-latest
env:
WOLFRAM_SYSTEM_ID: MacOSX-ARM
WOLFRAMENGINE_CACHE_KEY: WolframEngine-B
WOLFRAMENGINE_INSTALLATION_DIRECTORY: "/Applications/Wolfram Engine.app"
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
- name: Install Python 3.11
run: |
brew install python@3.11
echo "/opt/homebrew/opt/python@3.11/bin" >> $GITHUB_PATH
echo "PYTHON=/opt/homebrew/opt/python@3.11/bin/python3.11" >> $GITHUB_ENV
- name: Check Python version
run: |
python3.11 -V
which python3.11
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '23' # or '25', etc.
architecture: 'arm64'
- name: Verify Node.js
run: |
node -v
npm -v
- name: Create Python virtual environment
run: |
python3.11 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
- name: Install Node.js dependencies
run: |
source venv/bin/activate
npm install
- name: Cache/restore Wolfram Engine install
id: cache-restore
uses: actions/cache@v4
with:
path: ${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}
key: wolframengine-${{ env.WOLFRAM_SYSTEM_ID }}-${{ env.WOLFRAMENGINE_CACHE_KEY }}
- name: Install Wolfram Engine
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
echo 'Installing Wolfram Engine...'
brew install --cask wolfram-engine
brew install libuv
echo 'Installed Wolfram Engine.'
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Install GNU timeout
run: |
brew install coreutils
- name: Activate WL
env:
WOLFRAMENGINE_EXECUTABLES_DIRECTORY: "${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}/Contents/Resources/Wolfram Player.app/Contents/MacOS"
WOLFRAM_ID: "${{ secrets.WOLFRAM_ID2 }}"
WOLFRAM_PASS: "${{ secrets.WOLFRAM_PASS2 }}"
WOLFRAMSCRIPT_KERNELPATH: "${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}/Contents/MacOS/WolframKernel"
run: |
export PATH="${{ env.WOLFRAMENGINE_EXECUTABLES_DIRECTORY }}:$PATH"
brew install coreutils
echo "Authenticating Wolfram..."
echo "Skipped."
- name: Run tests with live Wolfram logs
env:
WOLFRAMENGINE_EXECUTABLES_DIRECTORY: "${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}/Contents/Resources/Wolfram Player.app/Contents/MacOS"
WOLFRAMSCRIPT_ENTITLEMENTID: ${{ secrets.WOLFRAM_LICENSE_ENTITLEMENT_ID }}
WOLFRAMSCRIPT_KERNELPATH: "${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}/Contents/MacOS/WolframKernel"
run: |
export PATH="${{ env.WOLFRAMENGINE_EXECUTABLES_DIRECTORY }}:$PATH"
echo "🚀 Starting Wolfram server..."
wolframscript -f Scripts/start.wls -entitlement "$WOLFRAMSCRIPT_ENTITLEMENTID" > /tmp/wolfram.log 2>&1 &
echo $! > wolfram.pid
echo "📺 Tailing logs..."
tail -f /tmp/wolfram.log &
echo $! > tail.pid
echo "⏳ Waiting for Wolfram to be ready..."
for i in {1..260}; do
if grep -q "Open http://" /tmp/wolfram.log; then
echo "✅ Server ready!"
break
fi
sleep 1
done
if ! grep -q "Open http://" /tmp/wolfram.log; then
echo "❌ Timeout. Last log lines:"
tail -n 20 /tmp/wolfram.log
kill $(cat tail.pid)
exit 1
fi
echo "🧪 Running Playwright tests... (update-snapshots)"
npx playwright test --update-snapshots
echo "🧼 Cleaning up log tailer..."
kill $(cat tail.pid)
- name: Commit and push updated Playwright screenshots
if: ${{ !cancelled() }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add tests/__screenshots__
if git diff --cached --quiet; then
echo "🟢 No snapshot updates to commit."
else
git commit -m "📸 Update Playwright snapshots"
git push origin HEAD
fi
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 3