Skip to content

Commit ad2c6e9

Browse files
authored
Merge pull request #25 from Yurunsoft/github-actions
自动化测试迁移到 Github Actions
2 parents 1bf452e + 35ec03a commit ad2c6e9

6 files changed

Lines changed: 101 additions & 58 deletions

File tree

.github/docker-compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: '3.4'
2+
services:
3+
swoole:
4+
container_name: "swoole"
5+
build:
6+
context: .
7+
dockerfile: ./swoole.dockerfile
8+
args:
9+
SWOOLE_DOCKER_VERSION: ${SWOOLE_DOCKER_VERSION}
10+
volumes:
11+
- "${GITHUB_WORKSPACE}:/guzzle-swoole:rw"
12+
working_dir: /guzzle-swoole
13+
ulimits:
14+
core: -1
15+
privileged: true
16+
command: tail -f /etc/group
17+
18+
php8:
19+
container_name: "php8"
20+
build:
21+
context: .
22+
dockerfile: ./swoole-php8.dockerfile
23+
args:
24+
SWOOLE_DOCKER_VERSION: ${SWOOLE_DOCKER_VERSION}
25+
volumes:
26+
- "${GITHUB_WORKSPACE}:/guzzle-swoole:rw"
27+
working_dir: /guzzle-swoole
28+
ulimits:
29+
core: -1
30+
privileged: true
31+
command: tail -f /etc/group

.github/prepare-test.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
__DIR__=$(cd `dirname $0`; pwd)
4+
5+
cd $__DIR__
6+
7+
containerName=$1
8+
9+
docker-compose up -d $containerName \
10+
&& docker exec $containerName php -v \
11+
&& docker exec $containerName php --ri swoole \
12+
&& docker exec $containerName composer -V \
13+
&& docker ps -a \
14+
&& docker exec $containerName composer update

.github/swoole-php8.dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ARG SWOOLE_DOCKER_VERSION
2+
FROM zhangrunyu/swoole-php8:${SWOOLE_DOCKER_VERSION}

.github/swoole.dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ARG SWOOLE_DOCKER_VERSION
2+
FROM phpswoole/swoole:${SWOOLE_DOCKER_VERSION}

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: ci
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ci:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
swoole: [
13+
4.5.8-php7.1, 4.5.8-php7.2, 4.5.8-php7.3, 4.5.8-php7.4
14+
,4.4.22-php7.1, 4.4.22-php7.2, 4.4.22-php7.3, 4.4.22-php7.4
15+
,4.3.6-php7.1, 4.3.6-php7.2, 4.3.6-php7.3
16+
]
17+
18+
env:
19+
SWOOLE_DOCKER_VERSION: ${{ matrix.swoole }}
20+
21+
steps:
22+
- uses: actions/checkout@v1
23+
24+
- name: prepare
25+
run: |
26+
./.github/prepare-test.sh swoole
27+
28+
- name: test
29+
run: docker exec swoole composer test
30+
31+
ci-php8:
32+
runs-on: ubuntu-latest
33+
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
swoole: [
38+
4.5.9-php8.0
39+
]
40+
41+
env:
42+
SWOOLE_DOCKER_VERSION: ${{ matrix.swoole }}
43+
44+
steps:
45+
- uses: actions/checkout@v1
46+
47+
- name: prepare
48+
run: |
49+
./.github/prepare-test.sh php8
50+
51+
- name: test
52+
run: docker exec php8 composer test

.travis.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)