when:
- event: ["push", "pull_request"]
branch: master
paths:
- web/**
- flake.nix
- flake.lock
- nix/pkgs/web-static-files.nix
- nix/pkgs/glisten.nix
- .tangled/workflows/web.yml
engine: microvm
image: nixos
dependencies:
- nodejs
# adapter-bun needs bun 1.4 and the image's nixpkgs has 1.3
- unstable#bun
cache:
- key: web-pnpm-store
hash:
- web/pnpm-lock.yaml
fallback: true
paths:
- web/.pnpm-store
- key: web-lint
# the tailwind rule reads app.css, which eslint's cache doesn't track
hash:
- web/pnpm-lock.yaml
- web/src/app.css
- web/eslint.config.js
paths:
- web/.eslintcache
- web/node_modules/.cache/prettier
steps:
- name: install web deps and static assets
command: |
set -e
nix build .#web-static-files --out-link web-static-files &
nix_static=$!
nix build .#glisten --out-link glisten &
nix_glisten=$!
cd web
corepack pnpm install --frozen-lockfile --store-dir .pnpm-store
wait "$nix_static" "$nix_glisten"
mkdir -p static
rm -rf static/fonts static/logos
cp -fr --no-preserve=ownership,mode ../web-static-files/* static
mkdir -p src/lib/glisten
rm -rf src/lib/glisten/wasm src/lib/glisten/languages.json
cp -fr --no-preserve=ownership,mode ../glisten/* src/lib/glisten
- name: lint web
command: |
cd web
corepack pnpm run lint
- name: typecheck web
command: |
cd web
corepack pnpm run check
- name: test web
command: |
cd web
corepack pnpm run test
- name: build web
command: |
cd web
corepack pnpm run build