-
Notifications
You must be signed in to change notification settings - Fork 196
158 lines (153 loc) · 5.67 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
name: Terminus 4.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"
# Cancel previous runs of this same branch/PR/etc.
concurrency:
group: 'ci-${{ github.head_ref || github.ref }}'
cancel-in-progress: true
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:v8.2
name: Checkout & build Phar
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Save repo content as artifact
uses: actions/upload-artifact@v4
with:
name: full-workspace
path: ${{ github.workspace }}
- name: Full Composer Install
run: composer install --dev
- 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@v4
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: [ '8.2', '8.4' ]
max-parallel: 1
env:
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
TERMINUS_SITE: ${{ vars.TERMINUS_SITE }}
TERMINUS_SITE_WP: ${{ vars.TERMINUS_SITE_WP }}
TERMINUS_SITE_WP_NETWORK: ${{ vars.TERMINUS_SITE_WP_NETWORK }}
TERMINUS_ORG: ${{ vars.TERMINUS_ORG }}
TERMINUS_BASE_DIR: ${{ vars.TERMINUS_BASE_DIR }}
TERMINUS_PLUGINS_DIR: ${{ vars.TERMINUS_PLUGINS_DIR }}
TERMINUS_PLUGINS2_DIR: ${{ vars.TERMINUS_PLUGINS2_DIR }}
TERMINUS_DEPENDENCIES_BASE_DIR: ${{ vars.TERMINUS_DEPENDENCIES_BASE_DIR }}
TERMINUS_USER: ${{ secrets.TERMINUS_USER }}
TERMINUS_HOST: ${{ vars.TERMINUS_HOST }}
TERMINUS_PORT: ${{ vars.TERMINUS_PORT }}
TERMINUS_VERIFY_HOST_CERT: ${{ vars.TERMINUS_VERIFY_HOST_CERT }}
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMBEBREW_NO_AUTO_UPDATE: 1
needs: [ checkout_build ]
steps:
- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.TERMINUS_SITE_OWNER_SSH_PRIVATE_KEY }}
- run: brew update && brew upgrade icu4c
if: runner.os == 'macOS'
continue-on-error: true
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd, mbstring, zip, ssh2-1.4.1, pcov
coverage: pcov
ini-values: error_reporting=E_ALL
- name: Download repo content from artifact
uses: actions/download-artifact@v4
with:
name: full-workspace
- name: Download terminus.phar as artifact
uses: actions/download-artifact@v4
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: 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:v8.2
needs: [ functional ]
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'pantheon-systems/terminus' }}
steps:
- name: Download terminus.phar as artifact
uses: actions/download-artifact@v4
with:
name: terminus-phar
- name: Release
uses: softprops/action-gh-release@v1
with:
files: terminus.phar
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_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