Tests #197
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: Tests | |
on: | |
push: | |
pull_request: | |
branches: [ master, main ] | |
schedule: | |
# Run daily at 2 AM UTC | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
test-suite: [ | |
runner1-config-build, | |
runner2-actions-execution, | |
runner3-environment-setup, | |
runner4-ui-welcome | |
] | |
name: Test ${{ matrix.test-suite }} (${{ matrix.os }}) | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
if: matrix.os != 'windows-latest' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'npm' | |
- name: Setup WSL2 (Windows) | |
if: matrix.os == 'windows-latest' | |
uses: Vampire/setup-wsl@v5 | |
with: | |
wsl-version: 2 | |
distribution: Ubuntu-22.04 | |
- name: Install system dependencies (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
# Update package lists | |
sudo apt update | |
# Install virtual display for VSCode extension testing | |
sudo apt install -y xvfb | |
- name: Install system dependencies (Windows/WSL2) | |
if: matrix.os == 'windows-latest' | |
shell: wsl-bash {0} | |
run: | | |
# Update package lists | |
sudo apt update | |
# Install virtual display for VSCode extension testing | |
sudo apt install -y xvfb | |
# Install NSS libraries for Electron/VSCode extension testing | |
sudo apt install -y libnss3 libnss3-dev libatk-bridge2.0-0 libdrm2 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libxss1 libasound2 libgtk-3-0 | |
- name: Install node (WSL2) | |
if: matrix.os == 'windows-latest' | |
shell: wsl-bash {0} | |
run: | | |
# Unset npm_config_prefix to avoid conflicts with nvm | |
unset npm_config_prefix | |
# Download and install nvm: | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash | |
# in lieu of restarting the shell | |
\. "$HOME/.nvm/nvm.sh" | |
# Download and install Node.js: | |
nvm install 22 | |
node --version | |
npm --version | |
# Add Node.js to PATH | |
echo '. "$HOME/.nvm/nvm.sh"' >> ~/.bashrc | |
- name: Install npm dependencies (WSL2) | |
if: matrix.os == 'windows-latest' | |
shell: wsl-bash {0} | |
run: | | |
\. "$HOME/.nvm/nvm.sh" | |
npm ci | |
- name: Install webview dependencies (WSL2) | |
if: matrix.os == 'windows-latest' | |
shell: wsl-bash {0} | |
run: | | |
\. "$HOME/.nvm/nvm.sh" | |
cd webview-ui && npm ci && cd .. | |
- name: Compile TypeScript (WSL2) | |
if: matrix.os == 'windows-latest' | |
shell: wsl-bash {0} | |
run: | | |
\. "$HOME/.nvm/nvm.sh" | |
npm run compile | |
- name: Install npm dependencies (Unix) | |
if: matrix.os != 'windows-latest' | |
run: npm ci | |
- name: Install webview dependencies (Unix) | |
if: matrix.os != 'windows-latest' | |
run: cd webview-ui && npm ci && cd .. | |
- name: Compile TypeScript (Unix) | |
if: matrix.os != 'windows-latest' | |
run: npm run compile | |
- name: Run test suite - ${{ matrix.test-suite }} (WSL2) | |
if: matrix.os == 'windows-latest' | |
shell: wsl-bash {0} | |
run: | | |
\. "$HOME/.nvm/nvm.sh" | |
case "${{ matrix.test-suite }}" in | |
"runner1-config-build") | |
SUITES="apBuildConfig apBuildConfigPanel apToolsConfig taskProvider" | |
;; | |
"runner2-actions-execution") | |
SUITES="apActions apLaunch apProgramUtils" | |
;; | |
"runner3-environment-setup") | |
SUITES="apCloneArdupilot apEnvironmentValidator apConnectedDevices" | |
;; | |
"runner4-ui-welcome") | |
SUITES="apUIHooks apLog apCommonUtils" | |
;; | |
esac | |
for suite in $SUITES; do | |
echo "Running test suite: $suite" | |
xvfb-run -a npm run test:$suite | |
done | |
- name: Run test suite - ${{ matrix.test-suite }} (Unix) | |
if: matrix.os != 'windows-latest' | |
run: | | |
case "${{ matrix.test-suite }}" in | |
"runner1-config-build") | |
SUITES="apBuildConfig apBuildConfigPanel apToolsConfig taskProvider" | |
;; | |
"runner2-actions-execution") | |
SUITES="apActions apLaunch apProgramUtils" | |
;; | |
"runner3-environment-setup") | |
SUITES="apCloneArdupilot apEnvironmentValidator apConnectedDevices" | |
;; | |
"runner4-ui-welcome") | |
SUITES="apUIHooks apLog" | |
;; | |
esac | |
for suite in $SUITES; do | |
echo "Running test suite: $suite" | |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then | |
xvfb-run -a npm run test:$suite | |
else | |
npm run test:$suite | |
fi | |
done | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ matrix.test-suite }}-${{ matrix.os }} | |
path: | | |
test-results/ | |
coverage/ | |
*.log | |
retention-days: 30 |