From 6dc7ff42e68c41c9a1df75311c322d619fc5a2c3 Mon Sep 17 00:00:00 2001 From: Nabeel Molham Date: Tue, 20 Aug 2024 09:32:32 +1000 Subject: [PATCH] Add CI github action --- .github/workflows/ci.yaml | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..29a99ac59 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,60 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +jobs: + php-tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + php: ['8.2'] + os: ['ubuntu-20.04'] + include: + - php: '8.1' + os: 'ubuntu-latest' + - php: '8.0' + os: 'ubuntu-20.04' + - php: '7.4' + os: 'ubuntu-20.04' + fail-fast: false + env: + COVERAGE_CACHE_PATH: phpunit-coverage-cache + PHP_VERSION: ${{ matrix.php }} + + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Switch to PHP ${{ env.PHP_VERSION }} + run: | + sudo update-alternatives --set php /usr/bin/php$PHP_VERSION + sudo update-alternatives --set phar /usr/bin/phar$PHP_VERSION + sudo update-alternatives --set phar.phar /usr/bin/phar.phar$PHP_VERSION + sudo update-alternatives --set phpize /usr/bin/phpize$PHP_VERSION + sudo update-alternatives --set php-config /usr/bin/php-config$PHP_VERSION + + - name: Enable pcov + run: | + sudo phpdismod xdebug + sudo phpenmod pcov + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install Dependencies + run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: Execute tests (Unit tests) via Codeception + run: | + vendor/bin/codeception run unit