-
Notifications
You must be signed in to change notification settings - Fork 195
260 lines (251 loc) · 9.07 KB
/
3x.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
name: Terminus 3.x
on:
push:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
functional_tests_group:
description: Run arbitrary functional tests group by name or all (short and long) tests (default)
required: true
default: all
tmate_enabled:
description: Enable tmate debugging
required: true
default: "0"
jobs:
# Checkout in separate job because docker image is alpine based and checkout action doesn't work.
checkout_build:
runs-on: ubuntu-latest
container:
image: quay.io/pantheon-public/php-ci:v7.4
name: Checkout & build Phar
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Save repo content as artifact
uses: actions/upload-artifact@v3
with:
name: full-workspace
path: ${{ github.workspace }}
- name: Full Composer Install
run: composer install
- name: Validate Code
run: composer code:lint
- name: Phar Build
run: |
mkdir $HOME/box
composer require humbug/box --working-dir=$HOME/box
export PATH=~/box/vendor/bin:$PATH
composer phar:build
- name: Save terminus.phar as artifact
uses: actions/upload-artifact@v3
with:
name: terminus-phar
path: terminus.phar
if-no-files-found: error
functional:
runs-on: ${{ matrix.operating-system }}
name: Functional testing matrix - PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
if: ${{ github.repository_owner == 'pantheon-systems' }}
strategy:
matrix:
operating-system: [ 'macos-latest' ]
php-versions: [ '7.4', '8.2' ]
max-parallel: 1
env:
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
TERMINUS_SITE: ${{ secrets.TERMINUS_SITE }}
TERMINUS_ORG: ${{ secrets.TERMINUS_ORG }}
TERMINUS_BASE_DIR: ${{ secrets.TERMINUS_BASE_DIR }}
TERMINUS_PLUGINS_DIR: ${{ secrets.TERMINUS_PLUGINS_DIR }}
TERMINUS_PLUGINS2_DIR: ${{ secrets.TERMINUS_PLUGINS2_DIR }}
TERMINUS_DEPENDENCIES_BASE_DIR: ${{ secrets.TERMINUS_DEPENDENCIES_BASE_DIR }}
TERMINUS_USER: ${{ secrets.TERMINUS_USER }}
needs: [ checkout_build ]
steps:
- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.TERMINUS_SITE_OWNER_SSH_PRIVATE_KEY }}
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd, mbstring, zip, ssh2-1.3.1, pcov
coverage: pcov
ini-values: error_reporting=E_ALL
- name: Download repo content from artifact
uses: actions/download-artifact@v3
with:
name: full-workspace
- name: Download terminus.phar as artifact
uses: actions/download-artifact@v3
with:
name: terminus-phar
- name: Install Composer Dependencies
run: composer install --no-interaction --prefer-dist
- name: Setup tmate session
if: ${{ github.event.inputs.tmate_enabled == 1 }}
uses: mxschmitt/action-tmate@v3
- name: Functional Tests (short)
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event.inputs.functional_tests_group == 'all' }}
run: composer test:short
- name: Functional Tests (long)
if: ${{ github.event_name == 'schedule' || github.event.inputs.functional_tests_group == 'all' }}
run: composer test:long
- name: Functional Tests (arbitrary group)
if: ${{ github.event.inputs.functional_tests_group != '' && github.event.inputs.functional_tests_group != 'all' }}
run: composer test:group -- ${{ github.event.inputs.functional_tests_group }}
- name: Coverage Report
run: composer coverage
- name: Save coverage as artifact
uses: actions/upload-artifact@v3
with:
name: CoverageReport
path: docs/TestCoverage.md
- name: Finish sesssion
if: ${{ always() && github.event.inputs.tmate_enabled == 1 }}
run: |
while [ ! -f /tmp/finish ]
do
sleep 2
done
exit 0
release:
runs-on: ubuntu-latest
name: Release
container:
image: quay.io/pantheon-public/php-ci:1.x
needs: [ functional ]
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'pantheon-systems/terminus' }}
steps:
- name: Download terminus.phar as artifact
uses: actions/download-artifact@v2
with:
name: terminus-phar
- name: Release
uses: softprops/action-gh-release@v1
with:
files: terminus.phar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package_macos:
runs-on: macos-latest
name: Package a Homebrew release
needs: [ release ]
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'pantheon-systems/terminus' }}
steps:
- name: Bump Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
token: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}}
tap: pantheon-systems/external
tag: ${{github.ref}}
revision: ${{github.sha}}
formula: terminus
package_linux:
runs-on: ubuntu-latest
name: Package .deb Release
container:
image: quay.io/pantheon-public/php-ci:v7.4
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
needs: [ release ]
steps:
- name: Download repo content from artifact
uses: actions/download-artifact@v2
with:
name: full-workspace
- name: Download terminus.phar as artifact
uses: actions/download-artifact@v2
with:
name: terminus-phar
- name: Full Composer Install
run: composer install
- name: Prepare needed folder and fix permissions
run: mkdir -p ~/.terminus/cache/tokens && mv ./terminus.phar ./terminus && chmod +x ./terminus
- name: Passegers, gather ye packages
run: composer bundle:linux
- name: Save terminus deb as artifact
uses: actions/upload-artifact@v2
with:
name: terminus-deb
path: ./*.deb
if-no-files-found: error
publish_linux:
runs-on: ubuntu-latest
name: Publish .deb Release
strategy:
matrix:
# Add needed repositories in the form of <package_name>/<distro>/<version>.
repository:
- 'terminus/debian/buster'
- 'terminus/debian/bullseye'
- 'terminus/debian/bookworm'
- 'terminus/ubuntu/bionic'
- 'terminus/ubuntu/focal'
- 'terminus/ubuntu/groovy'
- 'terminus/ubuntu/hirsute'
- 'terminus/ubuntu/impish'
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
needs: [ 'package_linux' ]
steps:
- name: Download terminus deb as artifact
uses: actions/download-artifact@v2
with:
name: terminus-deb
- uses: docker://lpenz/ghaction-packagecloud:v0.2
with:
user: stovak
repository: ${{ matrix.repository }}
path: |
*.deb
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
# # NOT CURRENTLY USED
# behat_tests:
# runs-on: ubuntu-latest
# name: Behat Tests
# needs: [ checkout_build ]
# if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
# strategy:
# matrix:
# php-versions: [ '7.4', '8.0' ]
# fail-fast: false
# env:
# TERMINUS_VERBOSITY: 22
# TERMINUS_EXECUTABLE: terminus
# TERMINUS_TEST_MODE: 1
# TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
# steps:
# - name: Setup PHP with PECL extension
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php-versions }}
# extensions: gd, mbstring, zip
# coverage: pcov
# - name: Download repo content from artifact
# uses: actions/download-artifact@v2
# with:
# name: full-workspace
# - name: Download terminus.phar as artifact
# uses: actions/download-artifact@v2
# with:
# name: terminus-phar
# - name: Install Composer Dependencies
# run: composer install --no-interaction --prefer-dist
# - name: Fix permissions
# run: chmod +x ./bin/terminus
# - name: Behat Tests
# run: composer test:behat
# # NOT CURRENTLY USED
# package_macos:
# runs-on: macos-latest
# name: Package a Homebrew release
# if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'pantheon-systems' }}
# needs: [ 'functional_tests', 'behat_tests' ]
# steps:
# - name: Brew Tap Terminus
# run: brew install stovak/terminus/terminus
# - name: Update tap with new release
# run: brew bump-formula-pr --url=${{ steps.tagged.outputs.url }} --no-browse --no-audit --commit stovak/terminus/terminus