Skip to content

Autotest

Autotest #36

Workflow file for this run

name: Autotest
on: workflow_dispatch
# WL cannot spawn evaluation kernel using entitlements
# LinkObject::linkd: Unable to communicate with closed link LinkObject["/Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app/Contents/MacOS/WolframKernel" -wstp, 6290, 13].
# >> $Failed
jobs:
autotest:
runs-on: macos-14
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_ID }}"
WOLFRAM_PASS: "${{ secrets.WOLFRAM_PASS }}"
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"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
echo -e "${CYAN}🚀 Starting Wolfram server...${NC}"
wolframscript -f Scripts/start.wls -entitlement "$WOLFRAMSCRIPT_ENTITLEMENTID" > /tmp/wolfram.log 2>&1 &
echo $! > wolfram.pid
echo -e "${YELLOW}📺 Tailing logs...${NC}"
tail -f /tmp/wolfram.log | sed "s/^/[WOLFRAM] /" &
echo $! > tail.pid
echo -e "${CYAN}⏳ Waiting for Wolfram to be ready...${NC}"
for i in {1..260}; do
if grep -q "Open http://" /tmp/wolfram.log; then
echo -e "${GREEN}✅ Server ready!${NC}"
break
fi
sleep 1
done
if ! grep -q "Open http://" /tmp/wolfram.log; then
echo -e "${RED}❌ Timeout. Last log lines:${NC}"
tail -n 20 /tmp/wolfram.log | sed "s/^/[WOLFRAM] /"
kill $(cat tail.pid)
exit 1
fi
echo -e "${CYAN}🧪 Running Playwright tests...${NC}"
npx playwright test 2>&1 | sed "s/^/[PLAYWRIGHT] /"
echo -e "${CYAN}🧼 Cleaning up log tailer...${NC}"
kill $(cat tail.pid)
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 3