-
-
Notifications
You must be signed in to change notification settings - Fork 132
110 lines (93 loc) · 2.98 KB
/
Copy pathmain.yml
File metadata and controls
110 lines (93 loc) · 2.98 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
name: "Tutorial CI"
on:
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
workflow_dispatch:
env:
# Phalcon v5 C extension constraint (installed from source via PIE)
PHALCON_CONSTRAINT: "^5.0"
EXTENSIONS: "mbstring, intl, json, pdo_mysql"
permissions: { }
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
quality:
name: "Code quality"
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
- name: "Setup PHP"
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.3'
extensions: ${{ env.EXTENSIONS }}
tools: composer:v2
- name: "Validate composer"
run: composer validate --no-check-all --no-check-publish
- name: "Install dependencies"
uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4
with:
composer-options: "--prefer-dist"
- name: "PHPCS"
run: composer cs
- name: "PHPStan"
run: composer analyze
- name: "PHP CS Fixer (dry-run)"
run: composer cs-fixer
tests:
name: "Tests (PHP ${{ matrix.php }}, Phalcon ${{ matrix.variant }})"
permissions:
contents: read
runs-on: ubuntu-latest
needs:
- quality
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
variant: ['v5', 'v6']
services:
mysql:
image: mysql:8.0
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: tutorial
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
- name: "Setup PHP"
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.EXTENSIONS }}
tools: composer:v2
- name: "Install Phalcon v5 (cphalcon) via PIE"
if: matrix.variant == 'v5'
run: |
curl -fsSL https://github.com/php/pie/releases/latest/download/pie.phar -o pie.phar
sudo "$(which php)" pie.phar install --no-interaction "phalcon/cphalcon:${{ env.PHALCON_CONSTRAINT }}"
php -m | grep -i phalcon
- name: "Install dependencies"
uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4
with:
composer-options: "--prefer-dist"
- name: "Load database schema"
run: mysql -h 127.0.0.1 -uroot -psecret tutorial < resources/schemas/tutorial.sql
- name: "Tests"
run: composer test