Each push previously burned ~21 billable GitHub Actions minutes because the Windows POS build cost 10 (5 real × 2x Windows multiplier). That gives us ~95 pushes/month on the 2000-minute free tier — too tight for active dev. - POS job now gates on `startsWith(github.ref, 'refs/tags/v')` OR workflow_dispatch. Every-commit CI stays Linux-only. - CI trigger adds `tags: ['v*']` and workflow_dispatch so releases can build the .exe on demand. - docs/24x7.md: new table with per-job minute/multiplier breakdown and the break-even point where a self-hosted runner becomes cheaper (~200 commits/mo). Post-change estimate: ~11 billable min/commit → fits 180 commits/month in the free tier. Windows minutes only spent when tagging a release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
111 lines
2.9 KiB
YAML
111 lines
2.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*']
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
backend:
|
|
name: Backend (.NET 8)
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_DB: food_market_test
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '8.0.x'
|
|
|
|
- name: Restore
|
|
run: dotnet restore food-market.sln
|
|
|
|
- name: Build
|
|
run: dotnet build food-market.sln --no-restore -c Release
|
|
|
|
- name: Test
|
|
env:
|
|
ConnectionStrings__Default: Host=localhost;Port=5432;Database=food_market_test;Username=postgres;Password=postgres
|
|
run: dotnet test food-market.sln --no-build -c Release --verbosity normal || echo "No tests yet"
|
|
|
|
web:
|
|
name: Web (React + Vite)
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src/food-market.web
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'pnpm'
|
|
cache-dependency-path: src/food-market.web/pnpm-lock.yaml
|
|
|
|
- name: Install
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build (tsc + vite)
|
|
run: pnpm build
|
|
|
|
- name: Upload dist
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: web-dist-${{ github.sha }}
|
|
path: src/food-market.web/dist
|
|
retention-days: 14
|
|
|
|
# POS build costs 2x Windows minutes — run only on tags / manual trigger,
|
|
# not on every commit. Releases are built from tags anyway.
|
|
pos:
|
|
name: POS (WPF, Windows)
|
|
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '8.0.x'
|
|
|
|
- name: Restore
|
|
run: dotnet restore src/food-market.pos/food-market.pos.csproj
|
|
|
|
- name: Build POS
|
|
run: dotnet build src/food-market.pos/food-market.pos.csproj --no-restore -c Release
|
|
|
|
- name: Publish self-contained win-x64
|
|
run: dotnet publish src/food-market.pos/food-market.pos.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o publish
|
|
|
|
- name: Upload POS executable
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: food-market-pos-${{ github.sha }}
|
|
path: publish
|
|
retention-days: 14
|