Skip to content

Build and Test

Build and Test #332

Workflow file for this run

name: Build and Test
run-name: Build and Test
on:
workflow_dispatch:
push:
branches:
- "main"
- "dev"
pull_request:
branches:
- "main"
- "dev"
paths:
- ".github/workflows/build.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
browser: [electron, chrome]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install elan
uses: leanprover/lean-action@v1
with:
lake-package-directory: Projects/mathlib-demo
use-mathlib-cache: false
use-github-cache: false
auto-config: false
build: false
test: false
lint: false
- name: Build sample projects
run: npm run build:server
- name: Ensure sample project 'mathlib-demo' is built
run: |
cd Projects/mathlib-demo
lake build --no-build
- name: Ensure sample project 'stable' is built
run: |
cd Projects/stable
lake build --no-build
- name: Install dependencies
run: npm ci
- name: Build client for production
run: npm run build:client
- name: Run Cypress tests (No Video)
id: cypress_no_video
run: npm test
env:
CYPRESS_DEFAULT_BROWSER: ${{ matrix.browser }}
CYPRESS_VIDEO: false
- name: Upload screenshots on failure
if: failure() && steps.cypress_no_video.conclusion == 'failure'
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/screenshots
- name: Run Cypress tests (With Video)
id: cypress_with_video
if: failure() && steps.cypress_no_video.conclusion == 'failure'
run: npm test
env:
CYPRESS_DEFAULT_BROWSER: ${{ matrix.browser }}
CYPRESS_VIDEO: true
CYPRESS_VIDEO_COMPRESSION: true
- name: Upload videos
if: failure() && steps.cypress_no_video.conclusion == 'failure'
uses: actions/upload-artifact@v4
with:
name: cypress-videos-${{ matrix.os }}-${{ matrix.browser }}
path: cypress/videos