-
Notifications
You must be signed in to change notification settings - Fork 0
195 lines (164 loc) · 5.32 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
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@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-rc-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-
- 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 --version
php githooks app:pre-build php
php githooks app:build
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: githooks-${{ matrix.php-versions }}
path: githooks-${{ matrix.php-versions }}.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@v4
- 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: Cache dependencies
uses: actions/cache@v4
with:
path: |
/home/runner/.cache/composer/files
key: ${{ runner.os }}-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-
# Install dependencies for run phpunit
- 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: Display structure of downloaded files
run: ls -R | grep githooks
- name: Extract and check build
run: php githooks app:extract-build
# - name: Extract and check builds 7.2
# if: ${{ '7.2' == matrix.php-versions }}
# run: |
# rm builds/php7.1/githooks
# git status
# ls -lah
# tar -xvf githooks-7.1/githooks-7.1.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 -xvf githooks-7.3/githooks-7.3.tar
# builds/php7.3/githooks --version
# - name: Extract and check builds 8.3
# if: ${{ '8.3' == matrix.php-versions }}
# run: |
# rm builds/githooks
# tar -xvf githooks-8.1/githooks-8.1.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@v4
- name: Delete Old Builds
run: rm builds/githooks builds/php7.1/githooks builds/php7.3/githooks
- 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 -xvf githooks-71.tar
tar -xvf githooks-73.tar
tar -xvf githooks-81.tar
ls -lah builds
git status
- name: Get Time
id: time
uses: nanzm/get-time-action@v1.1
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/git-commit-push@v1.3
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