GitHub Action script for PHP CI

Search for a command to run...

No comments yet. Be the first to comment.
All the tricks that I know and share to you guys, hopefully they would make your life easier
Hey guys, This command has been presented there for a while but I want to share it again 🥹 Before I usually do: php artisan make:migration CreateAbcTables php artisan make:model Abc php artisan make:factory Abc ... It's quite a hassle, isn't i...
Hey guys, An update after I posted the “Laravel Excel: How to append rows to an existing Excel file“ a while back. This post will give you another solution and probably a better way to export that fits every case. Problems Previously, when trying to ...

Hey guys, An easy topic for today! Make something a default (e.g., category, product, campaign, etc). Let’s go with the categories table for the examples. Let’s say we only want one category to be the default one. And find out which is the optimal wa...
Hey guys, Probably a chapter 2 of this https://sethphat.dev/why-is-wordpress-still-an-awesome-cms blog post, haha. Here was the story: I’ve been spending like 2 days figuring out which CMS I want to use for my new blog (for my new hobby lol) Let’s se...

Hey guys, Well damn, it has been a while since my last post lol, lazy & busy. But here I am, back to write useful tips for y’all 🥹 Let us do some exporting tasks for today, using Laravel Excel to export XLSX (yeah CSV is so 2010 lol). But, append mo...

Hey guys, Recently, I just bought Herd PRO (a yearly subscription). I’ve been using the basic Herd since the first release. So, my latest work required interaction with S3 storage, there are several ways to achieve that in the local env: Use Cloud (...

Hey guys,
A quick trick & sharing with y'all for my script to run PHPUnit with GitHub Action.
FYI some of my latest repositories are using this script:
Will be affected for:
A new commit to the main branch
New PRs that point to the main branch
Flow:
Install PHP 8.1 + pcov (best PHP coverage driver at the moment)
Install dependencies
(Optional) Setup env
Run the test with the coverage option
(Optional) Upload to CodeCov for the coverage result
name: Build & Test
on:
pull_request:
branches:
- 'main'
types: [ opened, synchronize, reopened, ready_for_review ]
push:
branches:
- 'main'
jobs:
build_php81:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
if: success()
- name: Setup PHP with coverage driver
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: pcov
- name: Setup
if: success()
run: |
php -v
composer install --no-interaction
- name: PHPUnit tests with coverage
if: success()
run: |
composer test-coverage
- name: upload coverage to codecov.io
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
Feel free to copy it and change it to your desired flow 😉
Cheers!