130 lines
4.6 KiB
YAML
130 lines
4.6 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: tests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install Node.js v25
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 25
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
# Note: Install not supported Python version to test the forced installation of Python 3.13 by uv in `get-platformio.py`
|
|
- name: Install Python 3.12 via uv
|
|
run: uv python install 3.12
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Run tests
|
|
run: npm test
|
|
|
|
test-no-uv:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install Node.js v25
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 25
|
|
|
|
- name: Remove uv and Python (Unix)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
# Remove uv
|
|
sudo rm -f "$(which uv 2>/dev/null)" || true
|
|
rm -f "$HOME/.local/bin/uv" "$HOME/.cargo/bin/uv" || true
|
|
|
|
# Remove Python from known runner locations (Linux)
|
|
sudo rm -rf /usr/bin/python* /usr/local/bin/python* || true
|
|
sudo rm -rf /opt/hostedtoolcache/Python || true
|
|
|
|
# Remove Homebrew Python (macOS)
|
|
if command -v brew &>/dev/null; then
|
|
brew uninstall --ignore-dependencies --force \
|
|
python@3.9 python@3.10 python@3.11 python@3.12 python@3.13 python@3.14 \
|
|
python3 python 2>/dev/null || true
|
|
sudo rm -rf /usr/local/opt/python* /opt/homebrew/opt/python* || true
|
|
sudo rm -rf /usr/local/bin/python* /opt/homebrew/bin/python* || true
|
|
fi
|
|
|
|
# Remove Xcode CLT Python (macOS)
|
|
sudo rm -f /Library/Developer/CommandLineTools/usr/bin/python3* || true
|
|
sudo rm -f /Library/Developer/CommandLineTools/usr/bin/python* || true
|
|
# Remove python.org framework installer (macOS)
|
|
sudo rm -rf /Library/Frameworks/Python.framework || true
|
|
|
|
# Exhaustively remove any remaining python/python3 from PATH
|
|
for exe in python python3 python3.9 python3.10 python3.11 python3.12 python3.13 python3.14; do
|
|
while p=$(which "$exe" 2>/dev/null); do sudo rm -f "$p" || break; done
|
|
done
|
|
|
|
# Shadow any SIP-protected /usr/bin/python* that can't be deleted (macOS)
|
|
# by prepending a directory of dummy scripts to PATH
|
|
BLOCK_DIR="$HOME/.no-python-bin"
|
|
mkdir -p "$BLOCK_DIR"
|
|
for exe in python python3 python3.9 python3.10 python3.11 python3.12 python3.13 python3.14; do
|
|
printf '#!/bin/sh\nexit 127\n' > "$BLOCK_DIR/$exe"
|
|
chmod +x "$BLOCK_DIR/$exe"
|
|
done
|
|
echo "$BLOCK_DIR" >> "$GITHUB_PATH"
|
|
|
|
- name: Remove uv and Python (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
# Remove uv
|
|
$uvPath = Get-Command uv -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
|
|
if ($uvPath) { Remove-Item -Force $uvPath }
|
|
Remove-Item -Force "$env:USERPROFILE\.local\bin\uv.exe" -ErrorAction SilentlyContinue
|
|
Remove-Item -Force "$env:USERPROFILE\.cargo\bin\uv.exe" -ErrorAction SilentlyContinue
|
|
# Remove Python from known runner locations
|
|
Remove-Item -Recurse -Force "C:\hostedtoolcache\windows\Python" -ErrorAction SilentlyContinue
|
|
Remove-Item -Recurse -Force "C:\Python*" -ErrorAction SilentlyContinue
|
|
foreach ($exe in @('python.exe','python3.exe')) {
|
|
$p = Get-Command $exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
|
|
if ($p) { Remove-Item -Force $p -ErrorAction SilentlyContinue }
|
|
}
|
|
|
|
- name: Verify uv and Python are not available
|
|
shell: bash
|
|
run: |
|
|
uv --version && echo "WARNING: uv still present" || echo "OK: uv not found"
|
|
python --version && echo "WARNING: python still present" || echo "OK: python not found"
|
|
python3 --version && echo "WARNING: python3 still present" || echo "OK: python3 not found"
|
|
continue-on-error: true
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Run tests
|
|
run: npm test
|