-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (73 loc) · 2.37 KB
/
frontend.yml
File metadata and controls
88 lines (73 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Frontend - Build and Lint
on:
push:
branches: [main, develop]
paths:
- "frontend/**"
- ".github/workflows/frontend.yml"
workflow_run:
workflows: ["Build and Push Backend Image", "Build and Push Frontend Image"]
types: [completed]
workflow_dispatch:
workflow_call:
jobs:
build-and-lint:
name: Build and Lint Frontend
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.13
- name: Install dependencies
working-directory: ./frontend
run: bun install --frozen-lockfile
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "9.0.x"
- name: Restore dependencies
run: dotnet restore PhantomDave.BankTracking.Api/PhantomDave.BankTracking.Api.csproj
- name: Spin up Database with Docker Compose
run: docker compose up database -d --wait
- name: Start API in background
working-directory: ./PhantomDave.BankTracking.Api
run: |
dotnet run > api.log 2>&1 &
echo $! > api.pid
env:
ASPNETCORE_ENVIRONMENT: Development
- name: Wait for API to be ready
uses: jtalk/url-health-check-action@v5
with:
url: http://localhost:5095/graphql
max-attempts: 15
retry-delay: 2s
- name: Show API logs on failure
if: failure()
working-directory: ./PhantomDave.BankTracking.Api
run: |
echo "=== API Logs ==="
cat api.log || echo "No log file found"
- name: Generate GraphQL types
working-directory: ./frontend
run: bun run codegen
- name: Lint and fix
if: ${{ github.event.pull_request.base.ref == 'main' }}
working-directory: ./frontend
run: bun run lint:fix
- name: Commit lint fixes
if: ${{ github.event.pull_request.base.ref == 'main' }}
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "chore: auto-fix frontend lint"
file_pattern: "frontend/**"
- name: Build
working-directory: ./frontend
run: bun run build -- --configuration=development