diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml index cff1c4e..5c97b6d 100644 --- a/.woodpecker/build.yaml +++ b/.woodpecker/build.yaml @@ -1,8 +1,11 @@ -# PR pipeline: lint, build, test on the branch (separate steps, shared workspace). -# Runs when a pull request is opened or updated. -# Does not build Docker image or deploy. +# Build workflow: runs after lint (shared workspace). +# Same triggers as lint: PR, push/tag/manual on main, or manual. when: - event: pull_request + - event: pull_request + - event: push + branch: main + - event: tag + - event: manual steps: - name: build diff --git a/.woodpecker/deploy.yaml b/.woodpecker/deploy.yaml index 77f6b3a..bbfe7ee 100644 --- a/.woodpecker/deploy.yaml +++ b/.woodpecker/deploy.yaml @@ -1,12 +1,12 @@ -# Deploy pipeline: lint, test, build, then Docker image → registry → Portainer webhook. -# Runs on push to main, tag, or manual run. -# See lint-and-build.yaml for PR-only (lint + test + build). +# Deploy workflow: Docker image → push to registry → Portainer webhook. +# Runs on push to main, tag, or manual (only when on main). +# Waits for lint, build, and test workflows to succeed first. when: branch: main event: [push, tag, manual] steps: - - name: 'Docker image build' + - name: docker-build image: docker:latest environment: REGISTRY_REPO: git.mifi.dev/mifi-ventures/landing @@ -30,7 +30,7 @@ steps: - build - test - - name: 'Push to registry' + - name: push image: docker:latest environment: REGISTRY_URL: git.mifi.dev @@ -54,9 +54,9 @@ steps: - docker push $REGISTRY_REPO:latest - echo "✓ Images pushed successfully" depends_on: - - 'Docker image build' + - docker-build - - name: 'Trigger Portainer stack redeploy' + - name: deploy image: curlimages/curl:latest environment: PORTAINER_WEBHOOK_URL: @@ -74,4 +74,4 @@ steps: fi echo "✓ Portainer redeploy triggered (HTTP $code)" depends_on: - - 'Push to registry' + - push diff --git a/.woodpecker/lint.yaml b/.woodpecker/lint.yaml index 27326eb..3fecaa6 100644 --- a/.woodpecker/lint.yaml +++ b/.woodpecker/lint.yaml @@ -1,8 +1,11 @@ -# PR pipeline: lint, build, test on the branch (separate steps, shared workspace). -# Runs when a pull request is opened or updated. -# Does not build Docker image or deploy. +# Lint workflow: install deps + run lint (shared workspace with build, test). +# Runs on pull requests, push/tag/manual on main, or manual from any branch. when: - event: pull_request + - event: pull_request + - event: push + branch: main + - event: tag + - event: manual steps: - name: install diff --git a/.woodpecker/test.yaml b/.woodpecker/test.yaml index bac563c..b8af659 100644 --- a/.woodpecker/test.yaml +++ b/.woodpecker/test.yaml @@ -1,8 +1,11 @@ -# PR pipeline: lint, build, test on the branch (separate steps, shared workspace). -# Runs when a pull request is opened or updated. -# Does not build Docker image or deploy. +# Test workflow: runs after lint and build (shared workspace). +# Same triggers as lint: PR, push/tag/manual on main, or manual. when: - event: pull_request + - event: pull_request + - event: push + branch: main + - event: tag + - event: manual steps: - name: test diff --git a/README.md b/README.md index d4dfaf2..61b8178 100644 --- a/README.md +++ b/README.md @@ -104,8 +104,10 @@ mifi-ventures-landing/ │ ├── devcontainer.json # Dev container config (extensions) │ └── Dockerfile # Dev container image (Node) ├── .woodpecker/ # CI/CD pipelines (see below) -│ ├── lint-and-build.yaml # PR: lint, test, build (no deploy) -│ └── deploy.yaml # main: lint, test, build, Docker, push, webhook +│ ├── lint.yaml # install + lint (runs on PR, main, manual) +│ ├── build.yaml # build (after lint) +│ ├── test.yaml # test (after lint + build) +│ └── deploy.yaml # Docker → push → webhook (main only, after lint/build/test) ├── Dockerfile # Production container (nginx:alpine) ├── nginx.conf # nginx web server configuration ├── svelte.config.js # SvelteKit config (adapter-static) @@ -140,10 +142,10 @@ mifi-ventures-landing/ ### Pipeline Overview -Woodpecker uses two workflows (`.woodpecker/lint-and-build.yaml` and `.woodpecker/deploy.yaml`): +Woodpecker uses four workflows (`.woodpecker/lint.yaml`, `build.yaml`, `test.yaml`, `deploy.yaml`): -- **Pull requests**: Opening or updating a PR runs **lint** (ESLint + Stylelint), **tests** (Vitest), and a **test build** (SvelteKit + Critters) on the branch. No Docker image or deploy. -- **Push to main** (or tag / manual run): Runs the same lint, test, and build, then: +- **Pull requests** (and **push/tag/manual on main**): Run **lint** → **build** → **test** in order (shared workspace). No Docker or deploy on PRs. +- **Push to main** (or tag / manual on main): After lint, build, and test succeed, **deploy** runs: 1. **Build** — Builds Docker image tagged with commit SHA + `latest` 2. **Push** — Pushes images to private Docker registry