Skip to content

Commit

Permalink
update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
joemaller committed Feb 23, 2025
1 parent fd084a0 commit 7454036
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
33 changes: 14 additions & 19 deletions .github/workflows/phpunit-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,49 @@ name: PHPUnit Test Coverage

on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
branches: [main, master]

jobs:
build:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
runs-on: ubuntu-22.04
test:
runs-on: ubuntu-24.04

steps:
# https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v4

# https://github.com/marketplace/actions/setup-php-action
- name: Setup PHP and disable opcache
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Global install PHPUnit & update $PATH
run: |
composer global require phpunit/phpunit --prefer-dist
echo "$HOME/.composer/vendor/bin" >> $GITHUB_PATH
- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: |
composer install --prefer-dist --no-progress --no-suggest
composer require phpunit/phpunit
- name: Run test suite
env:
XDEBUG_MODE: coverage
run: vendor/bin/phpunit
run: phpunit

# The Coveralls repo token is found on the project's Settings page
# https://github.com/php-coveralls/php-coveralls
- name: Upload to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
COVERALLS_RUN_LOCALLY: yes
run: |
composer require 'php-coveralls/php-coveralls:2.5.2'
composer require 'php-coveralls/php-coveralls:2.7.0'
vendor/bin/php-coveralls \
--coverage_clover ./coverage.xml \
--json_path ./coveralls-upload.json \
--verbose
# https://github.com/codecov/codecov-action
- name: Upload coverage to Codecov
# https://github.com/marketplace/actions/codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
files: ./coverage.xml
Expand All @@ -58,9 +53,9 @@ jobs:
# The Code Climate Test Coverage Reporter ID can be found by visiting the project's
# Repo Settings pane, click Test Coverage in the left sidebar. Find the ID in the
# second section.
# https://github.com/paambaati/codeclimate-action
- name: Code Climate coverage
# https://github.com/marketplace/actions/code-climate-coverage-action
uses: paambaati/codeclimate-action@v5
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-from-version-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: Create Release from Version Tags

on:
push:
branches: [main, master]
tags: ["v*"]

jobs:
build:
runs-on: ubuntu-24.04
name: Build Release
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
runs-on: ubuntu-22.04

steps:
# https://github.com/marketplace/actions/checkout
Expand All @@ -35,7 +35,7 @@ jobs:
composer archive -f zip --dir=../ --file=${REPO}
- name: Create GitHub release
if: github.ref == 'refs/heads/main' && contains(github.ref, 'refs/tags/')
if: ${{ contains(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down

0 comments on commit 7454036

Please sign in to comment.