forked from fraskatinta/Behat
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (132 loc) · 5 KB
/
build.yml
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: Build
on:
push:
branches: [master]
pull_request: ~
release:
types: [created]
workflow_dispatch: ~
jobs:
tests:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
name: Build and test
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0, 8.1, 8.2]
os: [ubuntu-latest]
composer-mode: [update]
symfony-version: ['']
include:
# Get the existing 7.2 to publish the phar
- php: 7.2
os: ubuntu-latest
composer-mode: update
publish-phar: true
symfony-version: ''
# 7.2 build with lowest dependencies
- php: 7.2
os: ubuntu-latest
composer-mode: lowest
symfony-version: ''
# MacOS on latest PHP only
- php: 8.2
os: macos-latest
composer-mode: update
symfony-version: ''
# Windows on latest PHP only
- php: 8.2
os: windows-latest
composer-mode: update
symfony-version: ''
# Symfony jobs:
- php: 8.1
os: ubuntu-latest
composer-mode: update
symfony-version: '4.4'
- php: 8.2
os: ubuntu-latest
composer-mode: update
symfony-version: '5.4'
- php: 8.2
os: ubuntu-latest
composer-mode: update
symfony-version: '6.0'
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
ini-values: "phar.readonly=0,zend.exception_ignore_args=Off"
coverage: none
- name: Install symfony/flex
if: matrix.symfony-version != ''
run: |
composer config --global --no-plugins allow-plugins.symfony/flex true &&
composer global require symfony/flex
- name: Install latest dependencies
if: matrix.composer-mode == 'update'
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}.*
run: composer update
- name: Install lowest dependencies
if: matrix.composer-mode == 'lowest'
run: composer update --prefer-lowest
- name: Run tests (phpunit)
run: ./vendor/bin/phpunit
- name: Run tests (Behat)
run: ./bin/behat -fprogress --strict
- name: Run tests (Behat for PHP 8.0)
if: matrix.php >= 8.0
run: ./bin/behat -fprogress --strict --tags=@php8
- name: Build the PHAR
if: matrix.publish-phar == true
run: |
curl -LSs https://box-project.github.io/box2/installer.php | php &&
export PATH=.:$PATH &&
rm -Rf ./vendor &&
composer install --no-dev -o &&
box.phar build
- uses: actions/upload-artifact@v3
name: Publish the PHAR
if: matrix.publish-phar == true
with:
name: behat.phar
path: behat.phar
static-analysis:
runs-on: ubuntu-latest
name: Static analysis
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
ini-values: "zend.exception_ignore_args=Off"
coverage: none
- name: Install dependencies
run: composer update
- name: Run Psalm
run: ./vendor/bin/psalm --output-format=github
publish-phar:
runs-on: ubuntu-latest
name: Publish the PHAR for release
needs: tests
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v3
with:
name: behat.phar
path: .
- name: Upload behat.phar
uses: basefas/upload-release-asset-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ github.event.release.id }}
asset_path: behat.phar
asset_name: behat.phar