149 lines
4.1 KiB
YAML
149 lines
4.1 KiB
YAML
name: "@luzzle/web"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "@luzzle/web@*"
|
|
paths:
|
|
- "apps/web/**"
|
|
- "packages/web/config/**"
|
|
- "packages/web/theme/**"
|
|
- "packages/web/db/**"
|
|
- "packages/web/jobs/**"
|
|
- "packages/web/pieces/**"
|
|
- "packages/web/templates/**"
|
|
- "apps/core/**"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "apps/web/**"
|
|
- "packages/web/config/**"
|
|
- "packages/web/theme/**"
|
|
- "packages/web/db/**"
|
|
- "packages/web/jobs/**"
|
|
- "packages/web/pieces/**"
|
|
- "packages/web/templates/**"
|
|
- "apps/core/**"
|
|
- ".github/workflows/web.yml"
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
# Keep the image's browser revision aligned with @playwright/test.
|
|
container:
|
|
image: ghcr.io/eleith/containers-playwright:1.61.1-node26@sha256:31ca7ae8b89997e60b60dec15487ea25ac9ea7b1eea45ea967f0f873c89af1ab
|
|
defaults:
|
|
run:
|
|
working-directory: apps/web
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: "26"
|
|
cache: "pnpm"
|
|
|
|
- name: Install dependencies
|
|
working-directory: .
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build shared packages
|
|
working-directory: .
|
|
run: pnpm --filter @luzzle/core --filter @luzzle/web.config --filter @luzzle/web.theme --filter @luzzle/web.db --filter @luzzle/web.jobs --filter @luzzle/web.pieces --filter @luzzle/web.templates build
|
|
|
|
# Lint and check both load the Vite configuration.
|
|
- name: mock config
|
|
run: touch config.yaml
|
|
|
|
- name: mock .env
|
|
run: touch .env
|
|
|
|
- name: Lint
|
|
run: pnpm run lint
|
|
|
|
- name: Check
|
|
run: pnpm run check
|
|
|
|
- name: Test
|
|
run: pnpm run test
|
|
|
|
- name: Built-in template HTTP/SSR integration
|
|
run: pnpm run test:templates
|
|
|
|
- name: Browser tests
|
|
# The HTTP integration suite already built the real app from this checkout.
|
|
run: pnpm run test:e2e
|
|
|
|
- name: Browser failure artifacts
|
|
if: failure()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: web-browser-failures
|
|
path: apps/web/test-results
|
|
if-no-files-found: ignore
|
|
retention-days: 7
|
|
|
|
build-push:
|
|
needs: check
|
|
if: github.event_name != 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Check Version
|
|
if: github.ref_type == 'tag'
|
|
run: |
|
|
VERSION_FROM_PKG=$(node -p "require('./apps/web/package.json').version")
|
|
TAG_NAME=${GITHUB_REF#refs/tags/}
|
|
VERSION_FROM_TAG=${TAG_NAME#@luzzle/web@}
|
|
|
|
if [ "$VERSION_FROM_TAG" != "$VERSION_FROM_PKG" ]; then
|
|
echo "Version mismatch: Tag version $VERSION_FROM_TAG does not match package.json version $VERSION_FROM_PKG"
|
|
exit 1
|
|
fi
|
|
echo "Version $VERSION_FROM_PKG matches."
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: ghcr.io/eleith/luzzle-web
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
type=match,pattern=@luzzle/web@(\d+),group=1
|
|
type=match,pattern=@luzzle/web@(\d+\.\d+),group=1
|
|
type=match,pattern=@luzzle/web@(\d+\.\d+\.\d+),group=1
|
|
|
|
- name: Create dummy npmrc
|
|
run: touch .npmrc
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: apps/web/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
secrets: |
|
|
"npmrc=.npmrc"
|