Skip to content

Commit 25c0406

Browse files
committed
add github actions scripts
1 parent 2836175 commit 25c0406

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/workflows/php.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Unit-tests
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'composer.json'
8+
- '**.yml'
9+
10+
jobs:
11+
test:
12+
name: Test on php ${{ matrix.php}} and ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
timeout-minutes: 10
15+
strategy:
16+
fail-fast: true
17+
matrix:
18+
php: [7.2, 7.3, 7.4] # 7.1
19+
os: [ubuntu-latest, macOS-latest] # windows-latest,
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
25+
# usage refer https://github.com/shivammathur/setup-php
26+
- name: Setup PHP
27+
timeout-minutes: 5
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php}}
31+
tools: pecl, php-cs-fixer, phpunit:8.5.8
32+
extensions: mbstring, dom, fileinfo, mysql, openssl, igbinary, redis # , swoole-4.4.19 #optional, setup extensions
33+
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
34+
coverage: none #optional, setup coverage driver: xdebug, none
35+
36+
- name: Install dependencies
37+
run: |
38+
composer install --no-progress
39+
# composer require phpunit/phpunit ^8.0 --no-progress # default
40+
41+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
42+
# Docs: https://getcomposer.org/doc/articles/scripts.md
43+
44+
- name: Run test suite
45+
run: phpunit -v # vendor/bin/phpunit -v

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Tag-release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
release:
10+
name: Test on php ${{ matrix.php}}
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
php: [7.3]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Set ENV for github-release
23+
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
24+
run: |
25+
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
26+
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
27+
28+
- uses: meeDamian/github-release@2.0
29+
with:
30+
gzip: false
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
tag: ${{ env.RELEASE_TAG }}
33+
name: ${{ env.RELEASE_TAG }}
34+
# files: kite-${{ env.RELEASE_TAG }}.phar

0 commit comments

Comments
 (0)