Files
FOSSBilling/.github/workflows/php.yml
T
2022-07-14 13:11:17 +03:00

68 lines
2.0 KiB
YAML

name: PHP Composer
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ["8.0", "8.1"]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Check PHP Version
run: php -v
- name: Validate composer.json and composer.lock
run: composer validate
working-directory: ./src
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: ./src/vendor
key: ${{ runner.os }}-php-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
working-directory: ./src
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
- name: Run test suite for composer updates.
run: composer install --prefer-dist --no-progress --no-suggest
working-directory: ./src
- name: Configure environment for Tests
run: |
cp ./src/bb-config-sample.php ./src/bb-config.php
mkdir -p ./src/bb-data/cache
mkdir -p ./src/bb-data/log
echo > ./src/bb-data/log/license.log
echo > ./src/bb-data/log/application.log
echo > ./src/bb-data/log/php_error.log
rm -rf ./src/install
- name: Run test suite for bb-modules
run: |
php ./src/vendor/bin/phpunit ./tests/bb-modules/
- name: Run test suite for bb-library
run: |
php ./src/vendor/bin/phpunit ./tests/bb-library/