Skip to content

V0.4.7

V0.4.7 #98

Workflow file for this run

name: Testing
on:
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
name: test
steps:
- name: Setup PHP Action
uses: shivammathur/[email protected]
with:
php-version: '8.1'
coverage: xdebug
- uses: actions/checkout@v3
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run test suite
run: composer run-script test
coverage:
needs: [ test ]
name: coverage
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Comment code coverage
uses: danhunsaker/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
clover-file: ./tests/clover.xml
- name: Store coverage output
run: |
output=$(composer run-script current-coverage)
echo "::set-output name=percent::$output"
id: pure-coverage
- name: Set color
uses: marcdomain/set-variables@v1
with:
variables: |
BADGE_COLOR: ${{ steps.pure-coverage.outputs.percent }} > 90 ? "green" : "yellow"
- uses: actions/checkout@v3
with:
ref: 'badges'
- name: generate current time
uses: gerred/[email protected]
id: current-time
- name: amend to history
uses: DamianReeves/write-file-action@master
with:
path: '.github/badges/history'
contents: |
${{steps.current-time.outputs.time}}
write-mode: append
- name: Generate the badge SVG image
uses: emibcn/badge-action@v1
id: badge
with:
label: 'Test coverage'
status: ${{ steps.pure-coverage.outputs.percent }}%
color: ${{ env.BADGE_COLOR }}
path: '.github/badges/test-badge.svg'
- name: Upload badge as artifact
uses: actions/upload-artifact@v2
with:
name: badge
path: '.github/badges/test-badge.svg'
if-no-files-found: error
- name: Commit badge
env:
BADGE: '.github/badges/test-badge.svg'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Add/Update badge"
- name: Push badge commit
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: 'badges'