Repository navigation
153 lines (129 loc) · 3.88 KB
/
Copy pathci.yml
File metadata and controls
153 lines (129 loc) · 3.88 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
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
PHP_VERSION: "8.3"
NODE_VERSION: "22"
jobs:
backend:
name: backend (PHP 8.3 / Laravel)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: fintrack_test
POSTGRES_USER: fintrack
POSTGRES_PASSWORD: fintrack
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U fintrack -d fintrack_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: mbstring, intl, pdo_pgsql, zip
coverage: xdebug
tools: composer:v2
- name: Ensure Laravel directories exist
working-directory: backend
run: mkdir -p bootstrap/cache storage/framework/cache/data storage/framework/sessions storage/framework/views storage/logs
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: composer-${{ runner.os }}-${{ hashFiles('backend/composer.lock') }}
restore-keys: composer-${{ runner.os }}-
- name: Install dependencies
working-directory: backend
run: composer install --prefer-dist --no-interaction --no-progress
- name: Prepare environment
working-directory: backend
run: |
cp .env.example .env
php artisan key:generate
- name: Run test suite with PostgreSQL
working-directory: backend
env:
DB_CONNECTION: pgsql
DB_HOST: 127.0.0.1
DB_PORT: 5432
DB_DATABASE: fintrack_test
DB_USERNAME: fintrack
DB_PASSWORD: fintrack
DB_SCHEMA: public
run: php artisan test --coverage-clover=coverage.xml
frontend:
name: frontend (React 19 / Vitest)
runs-on: ubuntu-latest
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: frontend/package-lock.json
- name: Install dependencies & test
working-directory: frontend
run: |
npm ci
npm test
npm run build
secrets:
name: segredos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Varredura de credenciais no histórico
run: bash .github/scripts/scan-secrets.sh
contracts:
name: contratos openapi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Lint do OpenAPI
run: npx --yes @redocly/cli@latest lint contracts/openapi/fintrack-api.yaml
images:
name: imagens docker
runs-on: ubuntu-latest
needs: [backend, frontend, contracts]
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build da imagem backend
uses: docker/build-push-action@v6
with:
context: .
file: backend/Dockerfile
push: false
tags: fintrack/backend:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build da imagem all-in-one local
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: false
tags: fintrack/all-in-one:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max