Skip to content

Merge pull request #50 from bavix/w101 #220

Merge pull request #50 from bavix/w101

Merge pull request #50 from bavix/w101 #220

Workflow file for this run

name: phpunits
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
MEMCACHED_HOST: localhost
REDIS_HOST: localhost
REDIS_PORT: 6379
MEMCACHED_PORT: 11211
jobs:
units:
runs-on: ubuntu-latest
strategy:
matrix:
wallet-versions: [ 10.1, "10.0", 9.6, 9.5, 9.4, 8.4, 7.3 ]
php-versions: [ 8.3 ]
databases: [ pgsql, mysql ]
caches: [ redis, memcached ]
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 6379:6379
memcached:
image: memcached
options: >-
--health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 11211:11211
pgsql:
image: postgres
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: wallet
POSTGRES_DB: wallet
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
mysql:
image: bitnami/mysql:8.0
env:
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
MYSQL_ROOT_PASSWORD: wallet
MYSQL_DATABASE: wallet
options: >-
--health-cmd="mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 3306:3306
steps:
- name: Checkout
id: git-checkout
uses: actions/checkout@v4
- name: Setup PHP
id: php-install
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: bcmath, mbstring, pgsql, mysql, sqlite, redis, memcached
coverage: pcov
env:
runner: self-hosted
- name: Uploading the correct version
id: composer-correct
run: cp composer_${{ matrix.wallet-versions }}.json composer.json
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
id: composer-dependencies
run: composer install --prefer-dist --no-progress
- name: Replace old phpunit.xml
id: phpunit-9x-xml
run: cp phpunit.old.xml phpunit.xml
if: ${{ matrix.wallet-versions < 10 }}
- name: Prepare run test suite
id: unit-prepare
run: |
mkdir build
- name: Run test suite
id: unit-run
run: composer parabench
env:
CACHE_DRIVER: ${{ matrix.caches }}
DB_CONNECTION: ${{ matrix.databases }}
CACHE_PREFIX: ${{matrix.caches}}-${{ matrix.databases }}-${{ matrix.wallet-versions }}-${{ matrix.php-versions }}
- name: Save artifact
id: unit-artifact
run: |
cp build/junit.xml build/junit-${{matrix.wallet-versions}}-${{ matrix.php-versions }}-${{ matrix.caches }}-${{ matrix.databases }}.xml
env:
CACHE_DRIVER: ${{ matrix.caches }}
DB_CONNECTION: ${{ matrix.databases }}
CACHE_PREFIX: ${{matrix.caches}}-${{ matrix.databases }}-${{ matrix.wallet-versions }}-${{ matrix.php-versions }}
- name: Artifact upload
id: unit-upload
uses: actions/upload-artifact@v4
with:
name: junit-${{matrix.wallet-versions}}${{ matrix.php-versions }}${{ matrix.caches }}${{ matrix.databases }}
path: build/junit-${{matrix.wallet-versions}}-${{ matrix.php-versions }}-${{ matrix.caches }}-${{ matrix.databases }}.xml
artifacts:
if: ${{ github.event.pull_request != null }}
permissions: write-all
name: Display results
needs: units
runs-on: ubuntu-latest
steps:
- name: Download junit
id: artifacts-download
uses: actions/download-artifact@v4
with:
pattern: junit-*
merge-multiple: true
- uses: actions/setup-go@v5
id: artifacts-golang
with:
go-version: '>=1.18.0'
- name: Install junit-reporter
id: artifacts-tools-install
run: go install github.com/bavix/junit-reporter@latest
- name: Display all junit
id: artifacts-display-all
run: |
echo "stdout<<EOF" >> $GITHUB_OUTPUT
echo "$(~/go/bin/junit-reporter --path . --group --ticks --median)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Display major junit
id: artifacts-display-major
run: |
echo "stdout<<EOF" >> $GITHUB_OUTPUT
echo "$(~/go/bin/junit-reporter --path . --group --major --ticks --median)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Find Comment
uses: peter-evans/find-comment@v2
id: artifacts-fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Build output
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.artifacts-fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Build output
All versions:
${{ steps.artifacts-display-all.outputs.stdout }}
Major compare:
${{ steps.artifacts-display-major.outputs.stdout }}
edit-mode: replace