feat: add admin-web Docker build & push workflow with semantic-release #11
30
.github/workflows/admin-web-docker.yml
vendored
30
.github/workflows/admin-web-docker.yml
vendored
@@ -17,8 +17,35 @@ env:
|
||||
NODE_VERSION: "22"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Admin Web Tests
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
if: |
|
||||
!contains(github.event.head_commit.message, '[skip ci]') &&
|
||||
!contains(github.event.head_commit.message, '[ci skip]')
|
||||
defaults:
|
||||
run:
|
||||
working-directory: admin-web
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: npm
|
||||
cache-dependency-path: admin-web/package-lock.json
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Type check
|
||||
run: npx tsc --noEmit
|
||||
- name: Run unit tests
|
||||
run: npx vitest run
|
||||
|
||||
build-validation:
|
||||
name: Docker Build Validation
|
||||
needs: [test]
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
@@ -47,6 +74,7 @@ jobs:
|
||||
|
||||
semantic-release:
|
||||
name: Semantic Release
|
||||
needs: [test]
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
if: |
|
||||
@@ -100,7 +128,7 @@ jobs:
|
||||
|
||||
build-and-push:
|
||||
name: Build & Push Docker Image
|
||||
needs: semantic-release
|
||||
needs: [semantic-release, test]
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
if: |
|
||||
|
||||
40
.github/workflows/ci.yml
vendored
40
.github/workflows/ci.yml
vendored
@@ -12,7 +12,6 @@ jobs:
|
||||
name: Detect Changes
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
admin-web: ${{ steps.filter.outputs.admin-web }}
|
||||
youtube-worker: ${{ steps.filter.outputs.youtube-worker }}
|
||||
supabase-functions: ${{ steps.filter.outputs.supabase-functions }}
|
||||
steps:
|
||||
@@ -22,9 +21,6 @@ jobs:
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
admin-web:
|
||||
- 'admin-web/**'
|
||||
- '.github/workflows/ci.yml'
|
||||
youtube-worker:
|
||||
- 'youtube-worker/**'
|
||||
- '.github/workflows/ci.yml'
|
||||
@@ -33,40 +29,6 @@ jobs:
|
||||
- 'youtube-worker/**'
|
||||
- '.github/workflows/ci.yml'
|
||||
|
||||
# ── Admin Web: Next.js ──
|
||||
admin-web-test:
|
||||
name: Admin Web CI
|
||||
needs: changes
|
||||
if: needs.changes.outputs.admin-web == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: admin-web
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: admin-web/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Type check
|
||||
run: npx tsc --noEmit
|
||||
|
||||
- name: Run unit tests
|
||||
run: npx vitest run
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Run E2E tests
|
||||
run: npx playwright test
|
||||
|
||||
# ── YouTube Worker: Node.js microservice ──
|
||||
youtube-worker-check:
|
||||
name: YouTube Worker
|
||||
@@ -95,7 +57,7 @@ jobs:
|
||||
# ── Deploy: Supabase edge functions + YouTube worker ──
|
||||
deploy-functions:
|
||||
name: Deploy
|
||||
needs: [changes, admin-web-test, youtube-worker-check]
|
||||
needs: [changes, youtube-worker-check]
|
||||
if: |
|
||||
always() &&
|
||||
github.ref == 'refs/heads/main' &&
|
||||
|
||||
@@ -263,9 +263,9 @@ check_workflow_valid() {
|
||||
yaml_valid ".github/workflows/admin-web-docker.yml" "admin-web-docker.yml is valid YAML"
|
||||
}
|
||||
|
||||
# --- workflow: exactly 3 jobs --------------------------------------- #
|
||||
# --- workflow: exactly 4 jobs --------------------------------------- #
|
||||
check_workflow_jobs() {
|
||||
local label="workflow has exactly 3 jobs: build-validation + semantic-release + build-and-push"
|
||||
local label="workflow has exactly 4 jobs: test + build-validation + semantic-release + build-and-push"
|
||||
local f=".github/workflows/admin-web-docker.yml"
|
||||
if [[ ! -f "$f" ]]; then
|
||||
fail "$label" "file missing"
|
||||
@@ -281,16 +281,16 @@ print(','.join(sorted(jobs)))
|
||||
fail "$label" "could not parse jobs"
|
||||
return
|
||||
fi
|
||||
if [[ "$out" == "build-and-push,build-validation,semantic-release" ]]; then
|
||||
if [[ "$out" == "build-and-push,build-validation,semantic-release,test" ]]; then
|
||||
pass "$label"
|
||||
else
|
||||
fail "$label" "jobs=[$out]"
|
||||
fi
|
||||
}
|
||||
|
||||
# --- workflow: build-and-push needs semantic-release --------------- #
|
||||
# --- workflow: build-and-push needs semantic-release + test ---------- #
|
||||
check_workflow_needs() {
|
||||
local label="build-and-push needs: semantic-release"
|
||||
local label="build-and-push needs: [semantic-release, test]"
|
||||
local f=".github/workflows/admin-web-docker.yml"
|
||||
if [[ ! -f "$f" ]]; then
|
||||
fail "$label" "file missing"
|
||||
@@ -305,7 +305,7 @@ n=bp.get('needs')
|
||||
if isinstance(n,list): print(','.join(n))
|
||||
else: print(str(n))
|
||||
" "$f" 2>/dev/null || true)
|
||||
if [[ "$out" == "semantic-release" ]]; then
|
||||
if [[ "$out" == "semantic-release,test" ]]; then
|
||||
pass "$label"
|
||||
else
|
||||
fail "$label" "needs='$out'"
|
||||
|
||||
Reference in New Issue
Block a user