Skip to content

chore: Update CI pipeline #87

chore: Update CI pipeline

chore: Update CI pipeline #87

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
# Least privilege: the workflow only ever reads the repo.
permissions:
contents: read
# A new push to the same ref cancels the in-flight run for it.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Actions are pinned to commit SHAs (tag comments alongside) so a moving tag
# can't change what runs. Bump them together with the comment.
jobs:
unit-tests:
name: Unit tests (Java ${{ matrix.java }}, Node ${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: ['21', '25'] # LTS: current and latest
node: ['22', '24'] # LTS: maintenance and active
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Java
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
with:
distribution: temurin
java-version: ${{ matrix.java }}
- name: Setup Clojure
uses: DeLaGuardo/setup-clojure@4c7a6f613e5089821bb3bb2a33a3ee115578580d # 13.6.1
with:
cli: latest
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node }}
# No `version:` — the pinned version comes from package.json's
# packageManager field, so CI and local dev always agree.
- name: Setup pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: Cache Maven deps
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: unit-deps-${{ runner.os }}-java-${{ matrix.java }}-${{ hashFiles('deps.edn', 'shadow-cljs.edn') }}
restore-keys: |
unit-deps-${{ runner.os }}-java-${{ matrix.java }}-
unit-deps-${{ runner.os }}-
deps-${{ runner.os }}-
- name: Install npm dependencies
run: pnpm install
- name: Run ClojureScript tests
run: pnpm test
e2e-tests:
name: E2E tests
runs-on: ubuntu-latest
# Single config on the latest LTS pair — the matrix above already covers
# version compatibility, and browser e2e is the expensive job.
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Java
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
with:
distribution: temurin
java-version: '25'
- name: Setup Clojure
uses: DeLaGuardo/setup-clojure@4c7a6f613e5089821bb3bb2a33a3ee115578580d # 13.6.1
with:
cli: latest
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24'
- name: Setup pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: Cache Maven deps
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: e2e-deps-${{ runner.os }}-${{ hashFiles('deps.edn', 'examples/*/deps.edn') }}
restore-keys: |
e2e-deps-${{ runner.os }}-
deps-${{ runner.os }}-
- name: Install root npm dependencies
run: pnpm install
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Build reagent example app
run: |
cd examples/reagent-app
pnpm install
pnpm exec msw init resources/public --save
pnpm run mocks
pnpm exec shadow-cljs compile demo
- name: Build UIx example app
run: |
cd examples/uix-app
pnpm install
pnpm exec msw init resources/public --save
pnpm run mocks
pnpm exec shadow-cljs compile demo
- name: Start servers and run Playwright tests
run: |
python3 -m http.server 8710 -d examples/reagent-app/resources/public &
python3 -m http.server 8720 -d examples/uix-app/resources/public &
# Wait for servers
for port in 8710 8720; do
for _ in $(seq 1 15); do
if curl -sf "http://localhost:$port" > /dev/null; then break; fi
sleep 1
done
done
pnpm test:e2e
- name: Upload Playwright report on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report
path: |
playwright-report/
test-results/
retention-days: 7