Skip to content

Max Bet Chip

Max Bet Chip #95

Workflow file for this run

name: CI Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
frontend:
name: Frontend (Lint + Build)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: frontend
- name: Run TypeScript & CSS lint (check only)
run: |
npx eslint .
npx stylelint "**/*.css"
working-directory: frontend
- name: Run Prettier
run: npx prettier --check "**/*.{ts,css}"
working-directory: frontend
- name: Build frontend
run: npm run build
working-directory: frontend
backend:
name: Backend (Lint + Test)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Install Go dependencies
run: go mod download
working-directory: backend
- name: Run Go lint
run: |
go install golang.org/x/lint/golint@latest
golint ./...
working-directory: backend
- name: Check Go Formatting
run: |
fmt_out=$(gofmt -s -l .)
if [ -n "$fmt_out" ]; then
echo "Go files not properly formatted:"
echo "$fmt_out"
exit 1
fi
working-directory: backend
- name: Run Go Unit Tests
run: go test -v ./...
working-directory: backend
docker-build:
name: Docker Build
runs-on: ubuntu-latest
needs: [frontend, backend]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: .env for compose (dev values)
run: |
cat > .env <<'EOF'
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB_NAME=speedroulette
POSTGRES_DB_HOST=db
POSTGRES_DB_PORT=5432
REDIS_ADDRESS=redis:6379
REDIS_PASSWORD=
REDIS_DB=0
ENV=development
BUILD_MODE=nginxserver
FRONTEND_PORT=80
VITE_BACKEND_URL=http://backend:8080
EOF
- name: Build images
run: docker compose -f compose.yml build
cypress:
name: Cypress E2E
runs-on: ubuntu-latest
needs: docker-build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '22' }
- name: Install Cypress & deps
run: npm ci
working-directory: frontend
- name: Generate dev .env
run: |
cat > .env <<'EOF'
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB_NAME=speedroulette
POSTGRES_DB_HOST=db
POSTGRES_DB_PORT=5432
REDIS_ADDRESS=redis:6379
REDIS_PASSWORD=
REDIS_DB=0
ENV=development
BUILD_MODE=nginxserver
FRONTEND_PORT=80
VITE_BACKEND_URL=http://backend:8080
EOF
- name: Start stack
run: docker compose -f compose.yml up -d
- name: Wait for frontend
uses: jakejarvis/wait-action@master
with: { url: http://localhost:5173, timeout: 60 }
- name: Run Cypress specs
uses: cypress-io/github-action@v6
with:
working-directory: frontend
config: baseUrl=http://localhost:80
wait-on: http://localhost:80/index.html
wait-on-timeout: 120
- name: Stop stack
if: always()
run: docker compose -f compose.yml down --volumes