-
Notifications
You must be signed in to change notification settings - Fork 0
214 lines (181 loc) · 6 KB
/
release.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Release
# https://github.com/shivammathur/setup-php
on:
push:
branches: [ rc** ]
pull_request:
branches-ignore: [ master ]
jobs:
build_rc:
name: Build php ${{ matrix.php-versions }} version
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.1', '7.3', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Install dependencies
run: |
chmod -R +x tools/*
tools/composer install --prefer-dist --no-progress
- name: Install Humbug/Box
run: tools/composer global require humbug/box
- name: Build the Aplication
run: |
php githooks app:pre-build
branch=${GITHUB_REF##*/}
echo ${branch}
prefix='rc-'
version=${branch#"$prefix"}
echo $version
php githooks app:build --build-version=${version}
# - name: Tar files to keep permissions
# run: |
# ls -lah builds/githooks builds/php7.1/githooks
# tar -cvf githooks-71.tar builds/php7.1/githooks
# tar -cvf githooks-73.tar builds/php7.3/githooks
# tar -cvf githooks-81.tar builds/githooks
# # ls -lah builds/githooks builds/php7.1/githooks
- name: Tar files to keep permissions 7.1
if: ${{ '7.1' == matrix.php-versions }}
run: tar -cvf githooks-71.tar builds/php7.1/githooks
- name: Tar files to keep permissions 7.3
if: ${{ '7.3' == matrix.php-versions }}
run: tar -cvf githooks-73.tar builds/php7.3/githooks
- name: Tar files to keep permissions 8.1
if: ${{ '8.1' == matrix.php-versions }}
run: tar -cvf githooks-81.tar builds/githooks
- name: Upload php 7.1 build
uses: actions/upload-artifact@v4
if: ${{ '7.1' == matrix.php-versions }}
with:
name: githooks-71
path: githooks-71.tar
- name: Upload php 7.3 build
uses: actions/upload-artifact@v4
if: ${{ '7.3' == matrix.php-versions }}
with:
name: githooks-73
path: githooks-73.tar
- name: Upload php 8.1 build
uses: actions/upload-artifact@v4
if: ${{ '8.1' == matrix.php-versions }}
with:
name: githooks-81
path: githooks-81.tar
test_rc:
name: Test the Build in php ${{ matrix.php-versions }}
runs-on: ${{ matrix.operating-system }}
needs: build_rc
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2', '8.0', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpcs, phpcbf, phpmd, phpstan, parallel-Lint, phpcpd
coverage: none
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
chmod -R +x tools/*
- uses: actions/download-artifact@v4
with:
path: ${{ github.GITHUB_WORKSPACE }}
- name: Extract and check builds 7.2
if: ${{ '7.2' == matrix.php-versions }}
run: |
rm builds/php7.1/githooks
tar -xf githooks-71/githooks-71.tar
builds/php7.1/githooks --version
- name: Extract and check builds 8.0
if: ${{ '8.0' == matrix.php-versions }}
run: |
rm builds/php7.3/githooks
tar -xf githooks-73/githooks-73.tar
builds/php7.3/githooks --version
- name: Extract and check builds 8.3
if: ${{ '8.3' == matrix.php-versions }}
run: |
rm builds/githooks
tar -xf githooks-81/githooks-81.tar
builds/githooks --version
git status
- name: Testing the Aplication
run: |
echo -e "\e[42m\e[30m**** Release Test Suite ****\033[0m"
vendor/bin/phpunit --group release
shell: bash
commit_rc:
name: Commit the Build
needs: test_rc
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Delete Old Builds
run: rm builds/githooks builds/php7.1/githooks && echo ${{ secrets.PAT_TOKEN_TO_COMMIT }}
- uses: actions/download-artifact@v4
with:
name: githooks-71
- uses: actions/download-artifact@v4
with:
name: githooks-73
- uses: actions/download-artifact@v4
with:
name: githooks-81
- name: Extract and check builds
run: |
tar -xf githooks-71.tar
tar -xf githooks-73.tar
tar -xf githooks-81.tar
ls -lah builds
git status
- name: Get Time
id: time
uses: nanzm/[email protected]
with:
timeZone: 1
format: 'DD-MM-YYYY HH:mm:ss'
- name: Extract version
id: version_id
run: |
branch=${GITHUB_REF##*/}
echo ${branch}
prefix='rc-'
version=${branch#"$prefix"}
echo $version
echo "::set-output name=version::${version}"
- name: Check Version
run: echo ${{ steps.version_id.outputs.version }} && echo ${{ steps.time.outputs.time }}
- uses: GuillaumeFalourd/[email protected]
with:
files: builds/githooks builds/php7.1/githooks builds/php7.3/githooks
commit_message: 'Release Candidate: ${{ steps.version_id.outputs.version }} - Build: ${{ steps.time.outputs.time }}'
- name: Check the commit
run: git log