-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (118 loc) · 4.52 KB
/
Copy pathci.yml
File metadata and controls
148 lines (118 loc) · 4.52 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# =============================================================================
# SpatialSync — Main CI Pipeline
# Runs on every push to main and every PR
# 2026 Industry Standard: Shift-left quality gates
# =============================================================================
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PHP_VERSION: '8.3'
NODE_VERSION: '22'
jobs:
# ---------------------------------------------------------------------------
# 1. PHP Quality Gate — Laravel Pint + PHPStan
# ---------------------------------------------------------------------------
php-quality:
name: 🐘 PHP Quality
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: mbstring, bcmath, gd, zip, pdo_pgsql, pgsql
tools: composer:v2
coverage: none
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Create .env for CI
run: cp .env.example .env
- name: Install PHP dependencies (without scripts)
run: composer install --no-interaction --prefer-dist --no-progress --no-scripts
- name: Generate app key
run: php -r "file_put_contents('.env', preg_replace('/^APP_KEY=.*/m', 'APP_KEY=base64:' . base64_encode(random_bytes(32)), file_get_contents('.env')));"
- name: Run Laravel Pint (Code Style)
run: |
vendor/bin/pint
vendor/bin/pint --test --ansi
- name: Run PHPStan (Static Analysis)
run: vendor/bin/phpstan analyse --no-progress --error-format=github
# ---------------------------------------------------------------------------
# 2. JavaScript Quality Gate — ESLint + Prettier
# ---------------------------------------------------------------------------
js-quality:
name: 📦 JS Quality
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install Node dependencies
run: npm ci --no-audit --no-fund
- name: Lint JavaScript
run: npx eslint resources/js/ --max-warnings=0
- name: Check formatting (Prettier)
run: npx prettier --check "resources/**/*.{js,css}"
# ---------------------------------------------------------------------------
# 3. Build Gate — Vite Production Build
# ---------------------------------------------------------------------------
build:
name: 🏗️ Production Build
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [php-quality, js-quality]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install Node dependencies
run: npm ci --no-audit --no-fund
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: mbstring, bcmath, gd, zip, pdo_pgsql, pgsql
tools: composer:v2
coverage: none
- name: Create .env for CI
run: cp .env.example .env
- name: Install PHP dependencies (without scripts)
run: composer install --no-interaction --prefer-dist --no-progress --no-scripts
- name: Generate app key
run: php -r "file_put_contents('.env', preg_replace('/^APP_KEY=.*/m', 'APP_KEY=base64:' . base64_encode(random_bytes(32)), file_get_contents('.env')));"
- name: Build frontend assets
run: npm run build
- name: Cache production build
uses: actions/cache@v4
with:
path: public/build
key: build-${{ github.sha }}
restore-keys: |
build-