-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (77 loc) · 2.37 KB
/
frontend.yml
File metadata and controls
93 lines (77 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
89
90
91
92
93
name: Frontend - Build and Lint
on:
push:
branches: [ main, develop ]
paths:
- 'frontend/**'
- '.github/workflows/frontend.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'frontend/**'
- '.github/workflows/frontend.yml'
jobs:
build-and-lint:
name: Build and Lint Frontend
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: ./frontend
run: npm ci
- name: Setup .NET
uses: actions/setup-dotnet@v4
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@v4
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: npm run codegen
- name: Format code with Prettier
working-directory: ./frontend
run: npx prettier --write "src/**/*.{ts,html,css,scss}"
- name: Commit formatted code
uses: stefanzweifel/git-auto-commit-action@v7
if: github.event_name == 'push'
with:
commit_message: 'chore: auto-format Frontend code'
file_pattern: 'frontend/src/**'
- name: Check TypeScript compilation
working-directory: ./frontend
run: npx tsc --noEmit
- name: Build
working-directory: ./frontend
run: npm run build -- --configuration=development