Merge pull request #7 from php-toolkit/dependabot/github_actions/soft… #119
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.3, 8.1, 8.2] | |
# os: [ubuntu-latest] # , macOS-latest, windows-latest, | |
coverage: ['none'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
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 | |
# phpunit -v --debug | |
# phpunit --coverage-clover ./test/clover.info | |
# 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 | |
# - 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 |