Skip to content

Test the project

Test the project #425

Workflow file for this run

name: Test
run-name: Test the project
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
NODE_VERSION: 24
jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
browser:
- electron
# - chrome
# - firefox
# - webkit
# - chromium
# exclude:
# - os: macos-latest
# browser: chromium
include:
- os: ubuntu-latest
name: Linux
- os: macos-latest
name: macOS
- os: windows-latest
name: Windows
name: ${{ matrix.name }} - ${{ matrix.browser }}
runs-on: ${{ matrix.os }}
continue-on-error: false
steps:
- name: Setup firefox (macOS)
if: matrix.os == 'macos-latest' && matrix.browser == 'firefox'
uses: browser-actions/setup-firefox@v1
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
- uses: leanprover/lean-action@v1
with:
build: true
test: true
lint: false
use-github-cache: false
use-mathlib-cache: false
check-reservoir-eligibility: false
lake-package-directory: "server"
- run: elan default stable
- name: Build the project
run: |
npm install
npm run build
npm run build:test
- name: Run Cypress tests (Development mode)
run: npm run test
- name: Upload Cypress screenshots
if: failure()
uses: actions/upload-artifact@v6
with:
name: "cypress-screenshots-${{ matrix.name }}-${{ matrix.browser }}"
path: cypress/screenshots
retention-days: 2
if-no-files-found: ignore
- name: Install Bubblewrap
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install bubblewrap
- name: Configure AppArmor for Bubblewrap (https://etbe.coker.com.au/2024/04/24/ubuntu-24-04-bubblewrap/)
if: matrix.os == 'ubuntu-latest'
run: |
sudo tee /etc/apparmor.d/bwrap > /dev/null << 'EOF'
abi <abi/4.0>,
include <tunables/global>
profile bwrap /usr/bin/bwrap flags=(unconfined) {
userns,
# Site-specific additions and overrides. See local/README for details.
include if exists <local/bwrap>
}
EOF
sudo systemctl reload apparmor
- name: Run Cypress tests (Production mode)
if: matrix.os == 'ubuntu-latest'
run: npm run test:prod
all:
name: all
needs: test
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- run: |
if [[ "${{ needs.test.result }}" != "success" ]]; then
echo "Matrix failed"
exit 1
fi