-
Notifications
You must be signed in to change notification settings - Fork 17
169 lines (146 loc) · 4.76 KB
/
Copy pathci.yml
File metadata and controls
169 lines (146 loc) · 4.76 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PHP_VERSION: "8.4"
NODE_VERSION: "22"
jobs:
quality:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: Laravel Pint
command: composer test:lint
needs-node: "true"
cache-path: ""
cache-key: ""
- name: PHPStan
command: composer test:types
needs-node: "false"
cache-path: /tmp/phpstan
cache-key: phpstan
- name: Type Coverage
command: composer test:type-coverage
needs-node: "false"
cache-path: ""
cache-key: ""
- name: Composer Validate & Audit
command: |
composer validate
composer audit || {
EXIT_CODE=$?
echo "⚠️ Composer audit found vulnerabilities."
# Check if output contains high or critical severity
if composer audit 2>&1 | grep -qiE "(severity.*high|severity.*critical)"; then
echo "❌ Found high or critical severity vulnerabilities - failing!"
exit 1
else
echo "ℹ️ Only low/moderate severity vulnerabilities found (non-blocking)"
exit 0
fi
}
needs-node: "false"
cache-path: ""
cache-key: ""
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup
uses: ./.github/actions/setup
with:
flux-username: ${{ secrets.FLUX_USERNAME }}
flux-license-key: ${{ secrets.FLUX_LICENSE_KEY }}
pureline-username: ${{ secrets.PURELINE_USERNAME }}
pureline-license-key: ${{ secrets.PURELINE_LICENSE_KEY }}
- name: Install Composer Dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
- name: Cache Node.js dependencies
if: matrix.needs-node == 'true'
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install Node Dependencies
if: matrix.needs-node == 'true'
run: npm ci
- name: Cache Tool
if: matrix.cache-path != ''
uses: actions/cache@v6
with:
path: ${{ matrix.cache-path }}
key: ${{ runner.os }}-${{ matrix.cache-key }}-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.cache-key }}-
- name: Run ${{ matrix.name }}
run: ${{ matrix.command }}
tests:
name: Tests
runs-on: ubuntu-latest
env:
DB_CONNECTION: pgsql
DB_HOST: 127.0.0.1
DB_PORT: 5432
DB_DATABASE: testing
DB_USERNAME: sail
DB_PASSWORD: password
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: sail
POSTGRES_DB: testing
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup
uses: ./.github/actions/setup
with:
flux-username: ${{ secrets.FLUX_USERNAME }}
flux-license-key: ${{ secrets.FLUX_LICENSE_KEY }}
pureline-username: ${{ secrets.PURELINE_USERNAME }}
pureline-license-key: ${{ secrets.PURELINE_LICENSE_KEY }}
- name: Install Composer Dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
- name: Cache Node.js dependencies
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install Node Dependencies
run: npm ci
- name: Build Assets
run: npm run build
- name: Cache Rector
uses: actions/cache@v6
with:
path: /tmp/rector
key: ${{ runner.os }}-rector-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-rector-
- name: Cache PHPStan
uses: actions/cache@v6
with:
path: /tmp/phpstan
key: ${{ runner.os }}-phpstan-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-phpstan-
- name: Run Pest Tests
run: composer test:unit