Files
eleith 48b696a19d
ci/woodpecker/pr/cli Pipeline was successful
ci/woodpecker/pr/config Pipeline was successful
ci/woodpecker/pr/web Pipeline was successful
ci/woodpecker/push/cli Pipeline was successful
ci/woodpecker/push/config Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
Remove duplicate and unrelated CI checks
2026-10-25 09:42:07 -07:00

148 lines
4.6 KiB
YAML

name: CI (Web App)
on:
push:
branches: [main]
tags: ['@directory/web@*']
paths:
- '*'
- .changeset/**
- docs/**
- .github/workflows/**
- .woodpecker/**
- apps/web/**
- packages/**
pull_request:
paths:
- '*'
- .changeset/**
- docs/**
- .github/workflows/**
- .woodpecker/**
- apps/web/**
- packages/**
permissions:
contents: read
jobs:
check:
name: Web checks
runs-on: ubuntu-24.04
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.5.0
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build web and shared dependencies
run: pnpm --filter '@directory/web...' build
- name: Check types
run: pnpm --filter @directory/web check
- name: Lint repository
run: pnpm lint
- name: Unit tests
run: pnpm --filter @directory/web test:coverage
e2e:
name: Web E2E
needs: check
runs-on: ubuntu-24.04
container:
image: ghcr.io/eleith/containers-playwright:1.61.1-node26@sha256:31ca7ae8b89997e60b60dec15487ea25ac9ea7b1eea45ea967f0f873c89af1ab
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check image toolchain
run: |
node --version
pnpm --version
node --eval "if (process.versions.node !== '26.5.0') throw new Error('Expected Node 26.5.0')"
test "$(pnpm --version)" = "11.9.0"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build web and shared dependencies
run: pnpm --filter '@directory/web...' build
- name: Browser tests
run: pnpm --filter @directory/web test:e2e
build-push:
name: Publish web image
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/@directory/web@'))
needs: [check, e2e]
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
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.5.0
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Check schema drift before building
run: pnpm schema:check
- name: Build config dependency
run: pnpm --filter @directory/config build
- name: Check config dependency
run: |
pnpm --filter @directory/config check
pnpm --filter @directory/config test
- name: Check release version
if: github.ref_type == 'tag'
run: |
node --input-type=module <<'NODE'
import { readFileSync } from 'node:fs';
const tag = process.env.GITHUB_REF_NAME ?? '';
const match = /^@directory\/web@((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*))$/.exec(tag);
if (!match || match[0] !== tag) {
throw new Error('Expected a stable @directory/web@<major>.<minor>.<patch> tag');
}
const version = JSON.parse(readFileSync('apps/web/package.json', 'utf8')).version;
if (match[1] !== version) {
throw new Error('Release tag must exactly match apps/web/package.json version');
}
NODE
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/eleith/directory
flavor: latest=false
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=match,pattern=^@directory/web@(\d+\.\d+\.\d+)$,group=1
type=match,pattern=^@directory/web@(\d+\.\d+)\.\d+$,group=1
type=match,pattern=^@directory/web@(\d+)\.\d+\.\d+$,group=1
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push web image
uses: docker/build-push-action@v7
with:
context: .
file: apps/web/Dockerfile
target: prod
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}