-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (87 loc) · 2.54 KB
/
ci.yml
File metadata and controls
105 lines (87 loc) · 2.54 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
name: CI
on:
pull_request:
concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
jobs:
resolve-php-version:
name: Resolve PHP version
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
php-version: ${{ steps.config.outputs.php-version }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Resolve PHP version from composer.json
id: config
run: |
version=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | head -1)
echo "php-version=$version" >> "$GITHUB_OUTPUT"
build:
name: Build
needs: resolve-php-version
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: composer:2
php-version: ${{ needs.resolve-php-version.outputs.php-version }}
- name: Validate composer.json
run: composer validate --no-interaction
- name: Install dependencies
run: composer install --no-progress --optimize-autoloader --prefer-dist --no-interaction
- name: Upload vendor and composer.lock as artifact
uses: actions/upload-artifact@v7
with:
name: vendor-artifact
path: |
vendor
composer.lock
auto-review:
name: Auto review
needs: [resolve-php-version, build]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: composer:2
php-version: ${{ needs.resolve-php-version.outputs.php-version }}
- name: Download vendor artifact from build
uses: actions/download-artifact@v8
with:
name: vendor-artifact
path: .
- name: Run review
run: composer review
tests:
name: Tests
needs: [resolve-php-version, auto-review]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: composer:2
php-version: ${{ needs.resolve-php-version.outputs.php-version }}
- name: Download vendor artifact from build
uses: actions/download-artifact@v8
with:
name: vendor-artifact
path: .
- name: Run tests
run: composer tests