This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
183 lines (166 loc) · 5.88 KB
/
ci.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
#
# Copyright 2021 SkyAPM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: CI
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0']
skywalking-version: ['9.0.0', '8.9.1', '8.9.0', '8.8.1', '8.7.0-es7', '8.7.0-es6', '8.6.0-es7', '8.6.0-es6', '8.5.0-es6', '8.4.0-es6']
name: PHP ${{ matrix.php-version }} Test on SW ${{ matrix.skywalking-version }}
services:
skywalking:
image: apache/skywalking-oap-server:${{ matrix.skywalking-version }}
ports:
- 11800:11800
- 12800:12800
mysql:
image: mysql:5
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: "skywalking"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
ports:
- 6379:6379
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
memcached:
image: memcached
ports:
- 11211:11211
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Check License
uses: apache/skywalking-eyes/header@501a28d2fb4a9b962661987e50cf0219631b32ff
- name: Setup PHP
uses: shivammathur/setup-php@v2
env:
YAR_LIBS: libcurl4-openssl-dev
with:
php-version: ${{ matrix.php-version }}
extensions: curl, json, redis, pdo_mysql, memcached, yar-laruence/yar@yar-2.2.0
tools: php-config, phpize, composer
- name: Install library
run: |
sudo apt-get update
sudo apt-get install -y curl libcurl4-openssl-dev nginx
sudo apt-get install -y build-essential autoconf libtool pkg-config cmake
sudo apt-get install -y autoconf automake libtool curl make g++ unzip
if ! [ -e /usr/bin/php-fpm ]; then
sudo apt-get install -y php${{ matrix.php-version }}-fpm
sudo cp /usr/sbin/php-fpm${{ matrix.php-version }} /usr/bin/php-fpm
fi
cd e2e
composer install
cd ..
- name: Build SkyWalking-PHP
run: |
cd /home/runner/work/SkyAPM-php-sdk/SkyAPM-php-sdk
phpize
./configure
make -j$(nproc)
sudo make install
- name: Start FPM and Nginx
run: |
ulimit -c unlimited
sudo cp e2e/99-skywalking.ini $(php -i | grep 'additional .ini' | sed -e "s|.*=> s*||")
sudo cp e2e/99-skywalking.ini $(php-fpm -i | grep 'additional .ini' | sed -e "s|.*=> s*||")
sudo cp e2e/nginx.conf /etc/nginx/conf.d/
sudo sed -i "s/VERSION/${{ matrix.php-version }}/g" /etc/nginx/conf.d/nginx.conf
sudo cp -r e2e/vendor e2e/tests /var/www/html/
sudo cp e2e/tests.php e2e/index.php /var/www/html/
sudo systemctl restart php${{ matrix.php-version }}-fpm
sudo systemctl restart nginx
sleep 15
- name: E2E tests
run: |
ulimit -c unlimited
cd e2e
sudo php -dskywalking.enable=0 e2e.php ${{ matrix.php-version }}
sudo cat /tmp/skywalking-php.log
- uses: actions/upload-artifact@v2
if: failure()
with:
name: crashes
path: /var/crash
publish:
if: github.repository == 'SkyAPM/SkyAPM-php-sdk'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
php-version: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0']
name: Publish PHP ${{ matrix.php-version }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: ${{ github.event_name != 'pull_request' }}
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event_name != 'pull_request' }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: |
skyapm/skywalking-php
ghcr.io/skyapm/skywalking-php
- name: Set output
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/*/} | sed "s/\//\-/")
- name: Check output
run: echo ${{ steps.vars.outputs.tag }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile
build-args: PHP_VERSION=${{ matrix.php-version }}
push: ${{ github.event_name != 'pull_request' }}
tags: |
skyapm/skywalking-php:${{ steps.vars.outputs.tag }}-${{ matrix.php-version }}-fpm-alpine
ghcr.io/skyapm/skywalking-php:${{ steps.vars.outputs.tag }}-${{ matrix.php-version }}-fpm-alpine
labels: ${{ steps.meta.outputs.labels }}