Skip to content

Merge pull request #4 from php-toolkit/dependabot/github_actions/acti… #112

Merge pull request #4 from php-toolkit/dependabot/github_actions/acti…

Merge pull request #4 from php-toolkit/dependabot/github_actions/acti… #112

Workflow file for this run

name: Unit-Tests
# https://docs.github.com/cn/actions/reference/workflow-syntax-for-github-actions
on:
push:
paths:
- '**.php'
- 'composer.json'
- '**.yml'
jobs:
test:
name: Test on php ${{ matrix.php}}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
php: ['8.0', 8.1] # 7.2,
# os: [ubuntu-latest] # , macOS-latest, windows-latest,
coverage: ['none']
include:
- description: 'Log Code Coverage'
php: '8.0'
coverage: 'xdebug'
# will not testing on php 7.2
# - os: 'ubuntu-latest'
# php: '7.2'
# phpunit: '8.5.13'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: ${{ matrix.php }}
- name: Set ENV vars
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
- name: Display Env
run: env
# usage refer https://github.com/shivammathur/setup-php
- name: Setup PHP
timeout-minutes: 5
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
tools: php-cs-fixer, phpunit:${{ matrix.phpunit }} # pecl,
extensions: mbstring # , swoole-4.4.19 #optional, setup extensions
coverage: ${{ matrix.coverage }} #optional, setup coverage driver: xdebug, none
- name: Install dependencies
run: composer update --no-progress
- name: Generate changelog file
id: changelog
if: ${{ matrix.php == '8.1' }}
run: |
curl https://github.com/gookit/gitw/releases/latest/download/chlog-linux-amd64 -L -o /usr/local/bin/chlog
chmod a+x /usr/local/bin/chlog
chlog -c .github/changelog.yml -o changelog.md prev last
cat changelog.md
# phpunit -v --debug
# phpdbg -dauto_globals_jit=Off-qrr $(which phpunit) --coverage-clover ./test/clover.info
- name: Run test suite
run: |
php example/flags-demo.php -h
php example/sflags-demo.php --help
phpunit --coverage-clover ./test/clover.info
# - name: Coveralls parallel
# uses: coverallsapp/github-action@master
# if: matrix.coverage == 'xdebug'
# with:
# github-token: ${{ secrets.github_token }}
# path-to-lcov: ./test/clover.info
# flag-name: run-${{ matrix.php }}
# parallel: true
#
# finish:
# needs: test
# runs-on: ubuntu-latest
# steps:
# - name: Coveralls Finished
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.github_token }}
# parallel-finished: true