coolify/.github/workflows/tests.yaml
peaklabs-dev bc7850053d
ci: update and improve workflows
- add concurrency groups to cancel the in-progress workflow if a new
one is triggered
- update and pin all action versions to full-length SHAs
- update and pin all dependency versions to specific versions
- ensure git credentials are not persisted when using actions/checkout
2025-12-01 21:47:28 +01:00

107 lines
3.9 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Tests
on:
push:
branches:
- "**v5.x**"
permissions:
contents: read
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
jobs:
composer-validate:
name: Validate composer.json
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # https://github.com/actions/checkout/releases/tag/v6.0.0
with:
persist-credentials: false
- name: Setup PHP 8.5
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # https://github.com/shivammathur/setup-php/releases/tag/2.36.0
with:
php-version: "8.5.0" # https://github.com/php/php-src/releases/tag/php-8.5.0
- name: Validate composer.json
run: composer validate --check-lock --strict
composer-audit:
name: Composer Audit
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
needs: [composer-validate]
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # https://github.com/actions/checkout/releases/tag/v6.0.0
with:
persist-credentials: false
- name: Setup PHP 8.5
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # https://github.com/shivammathur/setup-php/releases/tag/2.36.0
with:
php-version: "8.5.0" # https://github.com/php/php-src/releases/tag/php-8.5.0
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # https://github.com/actions/cache/releases/tag/v4.3.0
with:
path: /vendor
key: php-${{ hashFiles('composer.lock') }}
- name: Install PHP dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-interaction
- name: Run Composer audit
run: composer audit --locked --abandoned=fail
bun-audit:
name: Bun Audit
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
needs: [composer-validate]
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # https://github.com/actions/checkout/releases/tag/v6.0.0
with:
persist-credentials: false
- name: Setup Bun
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # https://github.com/oven-sh/setup-bun/releases/tag/v2.0.2
with:
bun-version: 1.3.3 # https://github.com/oven-sh/bun/releases/tag/bun-v1.3.3
- name: Run Bun audit
run: bun audit --frozen-lockfile
test:
name: Tests
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
needs: [composer-audit, bun-audit]
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # https://github.com/actions/checkout/releases/tag/v6.0.0
with:
persist-credentials: false
- name: Setup PHP 8.5 with Xdebug
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # https://github.com/shivammathur/setup-php/releases/tag/2.36.0
with:
php-version: "8.5.0" # https://github.com/php/php-src/releases/tag/php-8.5.0
coverage: xdebug-3.5.0 # https://github.com/xdebug/xdebug/releases/tag/3.5.0
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # https://github.com/actions/cache/releases/tag/v4.3.0
with:
path: /vendor
key: php-${{ hashFiles('composer.lock') }}
- name: Install PHP dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-interaction
- name: Run tests
run: composer test:all