rename steps
All checks were successful
CI / Frontend lint (push) Successful in 26s
CI / Backend tests (push) Successful in 26s
CI / Frontend unit tests (push) Successful in 21s
Docker / build-and-push (push) Successful in 50s
CI / Frontend build (push) Successful in 24s
CI / Playwright e2e (push) Successful in 45s
All checks were successful
CI / Frontend lint (push) Successful in 26s
CI / Backend tests (push) Successful in 26s
CI / Frontend unit tests (push) Successful in 21s
Docker / build-and-push (push) Successful in 50s
CI / Frontend build (push) Successful in 24s
CI / Playwright e2e (push) Successful in 45s
This commit is contained in:
parent
948b49bb49
commit
921eeb624e
2 changed files with 0 additions and 0 deletions
80
.forgejo/workflows/publish.yml
Normal file
80
.forgejo/workflows/publish.yml
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
name: Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
tags: ["v*"]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Docker CLI
|
||||
run: |
|
||||
ARCH=$(uname -m)
|
||||
curl -fsSL "https://download.docker.com/linux/static/stable/${ARCH}/docker-27.5.1.tgz" \
|
||||
| tar xz --strip-components=1 -C /usr/local/bin docker/docker
|
||||
docker --version
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver-opts: |
|
||||
network=host
|
||||
|
||||
- name: Resolve registry vars
|
||||
id: registry
|
||||
env:
|
||||
CONTAINER_REGISTRY_HOST: ${{ vars.CONTAINER_REGISTRY_HOST }}
|
||||
run: |
|
||||
host="${CONTAINER_REGISTRY_HOST:-${{ gitea.server_url }}}"
|
||||
host="${host#https://}"
|
||||
host="${host#http://}"
|
||||
host="${host%/}"
|
||||
if [ "$host" = "forgejo:3000" ]; then
|
||||
host="127.0.0.1:13000"
|
||||
fi
|
||||
repo=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||
owner="${repo%%/*}"
|
||||
{
|
||||
echo "host=${host}"
|
||||
echo "owner=${owner}"
|
||||
echo "image=${host}/${repo}"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Log in to Forgejo Container Registry
|
||||
uses: https://github.com/docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ steps.registry.outputs.host }}
|
||||
username: ${{ steps.registry.outputs.owner }}
|
||||
password: ${{ secrets.FORGEJO_PACKAGE_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: https://github.com/docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ steps.registry.outputs.image }}
|
||||
tags: |
|
||||
type=sha,format=short
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- name: Build and push
|
||||
uses: https://github.com/docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
# The published image is deployed at https://schmelczer.dev/towers/,
|
||||
# so the SPA is built with that sub-path baked into <base href> and
|
||||
# the service-worker manifest. Change this if the deploy path changes.
|
||||
build-args: |
|
||||
BASE_HREF=/towers/
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ steps.registry.outputs.image }}:buildcache
|
||||
cache-to: type=registry,ref=${{ steps.registry.outputs.image }}:buildcache,mode=max
|
||||
190
.forgejo/workflows/test.yml
Normal file
190
.forgejo/workflows/test.yml
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
name: Backend tests
|
||||
runs-on: docker
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install uv
|
||||
run: |
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Set up Python
|
||||
run: uv python install 3.13
|
||||
|
||||
- name: Sync dependencies
|
||||
run: uv sync
|
||||
|
||||
- name: Run pytest
|
||||
run: uv run pytest -v
|
||||
|
||||
frontend-lint:
|
||||
name: Frontend lint
|
||||
runs-on: docker
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run ESLint
|
||||
run: npm run lint
|
||||
|
||||
frontend-test:
|
||||
name: Frontend unit tests
|
||||
runs-on: docker
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run Vitest
|
||||
run: npm test
|
||||
|
||||
frontend-build:
|
||||
name: Frontend build
|
||||
runs-on: docker
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build production bundle
|
||||
run: npm run build
|
||||
|
||||
e2e:
|
||||
name: Playwright e2e
|
||||
runs-on: docker
|
||||
needs: [backend, frontend-build]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Ensure Docker CLI
|
||||
run: |
|
||||
set -eux
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
DOCKER_VERSION=27.5.1
|
||||
curl -fsSL "https://download.docker.com/linux/static/stable/$(uname -m)/docker-${DOCKER_VERSION}.tgz" \
|
||||
| tar -xz -C /usr/local/bin --strip-components=1 docker/docker
|
||||
fi
|
||||
if ! docker compose version >/dev/null 2>&1; then
|
||||
COMPOSE_VERSION=v2.32.4
|
||||
mkdir -p /usr/local/lib/docker/cli-plugins
|
||||
curl -fsSL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)" \
|
||||
-o /usr/local/lib/docker/cli-plugins/docker-compose
|
||||
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
|
||||
fi
|
||||
docker --version
|
||||
docker compose version
|
||||
|
||||
- name: Start stack
|
||||
run: docker compose -p life-towers -f docker-compose.dev.yml up --build -d
|
||||
|
||||
- name: Wait for /api/v1/health
|
||||
run: |
|
||||
set -e
|
||||
cid=$(docker compose -p life-towers -f docker-compose.dev.yml ps -q life-towers)
|
||||
for i in $(seq 1 60); do
|
||||
status=$(docker inspect -f '{{.State.Health.Status}}' "$cid" 2>/dev/null || echo starting)
|
||||
if [ "$status" = healthy ]; then
|
||||
echo "stack healthy after ${i} attempts"
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
echo "stack failed to become healthy" >&2
|
||||
docker compose -p life-towers -f docker-compose.dev.yml logs >&2
|
||||
exit 1
|
||||
|
||||
- name: Run Playwright
|
||||
run: |
|
||||
set -eux
|
||||
# Sibling-container (Docker-out-of-Docker) setup: the host daemon can't
|
||||
# see this job's filesystem, so `-v "$(pwd)/frontend:/work"` would mount
|
||||
# an empty dir. Instead create the container, copy the source IN, run,
|
||||
# then copy artifacts back OUT — all via the CLI, which reads/writes the
|
||||
# job container's filesystem.
|
||||
cid=$(docker create \
|
||||
--network life-towers_default \
|
||||
-e PLAYWRIGHT_BASE_URL=http://life-towers:8000 \
|
||||
-e CI=true \
|
||||
mcr.microsoft.com/playwright:v1.60.0-noble \
|
||||
sh -c 'cd /work && npm ci && npx playwright test')
|
||||
# /work does not exist yet, so cp creates it from frontend's contents.
|
||||
docker cp ./frontend "$cid":/work
|
||||
# Run, but always copy artifacts back even when tests fail.
|
||||
set +e
|
||||
docker start -a "$cid"
|
||||
code=$?
|
||||
set -e
|
||||
docker cp "$cid":/work/playwright-report ./frontend/ || true
|
||||
docker cp "$cid":/work/visuals ./frontend/ || true
|
||||
docker rm -f "$cid" >/dev/null 2>&1 || true
|
||||
exit "$code"
|
||||
|
||||
- name: Upload Playwright report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: playwright-report
|
||||
path: frontend/playwright-report
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
|
||||
- name: Upload visual screenshots
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: playwright-visuals
|
||||
path: frontend/visuals
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
|
||||
- name: Dump container logs on failure
|
||||
if: failure()
|
||||
run: docker compose -p life-towers -f docker-compose.dev.yml logs
|
||||
|
||||
- name: Tear down stack
|
||||
if: always()
|
||||
run: docker compose -p life-towers -f docker-compose.dev.yml down -v
|
||||
Loading…
Reference in a new issue