69 lines
1.6 KiB
YAML
69 lines
1.6 KiB
YAML
name: Build and Test Frontend
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop, 'feature/**' ]
|
|
paths:
|
|
- 'frontend/**'
|
|
- '.gitea/workflows/build-frontend.yml'
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
paths:
|
|
- 'frontend/**'
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 'lts/*'
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- name: Install dependencies
|
|
working-directory: ./frontend
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run linter
|
|
working-directory: ./frontend
|
|
run: pnpm run lint
|
|
|
|
- name: Run type check
|
|
working-directory: ./frontend
|
|
run: pnpm run type-check
|
|
|
|
- name: Run unit tests
|
|
working-directory: ./frontend
|
|
run: pnpm run test:unit
|
|
|
|
- name: Build Frontend
|
|
working-directory: ./frontend
|
|
run: pnpm run build
|
|
|
|
- name: Build container image
|
|
working-directory: ./frontend
|
|
run: |
|
|
podman build -t coppertone-frontend:${{ github.sha }} -f Containerfile .
|
|
podman build -t coppertone-frontend:latest -f Containerfile .
|
|
|
|
- name: Archive production artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: frontend-dist
|
|
path: ./frontend/dist
|
|
|
|
- name: Archive Nginx config
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: frontend-nginx-config
|
|
path: ./frontend/nginx.conf
|