Skip to content

Commit

Permalink
GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev committed Mar 10, 2024
1 parent 31c8d0e commit 52394bd
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 23 deletions.
69 changes: 47 additions & 22 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,60 @@
name: tests

on: [ push, pull_request ]
on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.0, 8.1, 8.2, 8.3]
laravel: ['9.*', '10.*', '11.*']
dependency-version: [prefer-lowest, prefer-stable]
exclude:
- laravel: 9.*
php: 8.2
- laravel: 9.*
php: 8.3
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 8.1
include:
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Make chown
run: sudo chown -R $USER:$USER ${{ github.workspace }}
- uses: actions/checkout@v2

- name: Checkout code
uses: actions/checkout@v2

- name: Docker compose up
run: docker-compose up -d
- name: Validate composer.json and composer.lock
run: composer validate
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run test suite
run: vendor/bin/phpunit --coverage-clover coverage.xml
# - uses: codecov/codecov-action@v1
# with:
# file: ./coverage.xml
# flags: unittests
# fail_ci_if_error: true
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit --testdox
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable" : true
"prefer-stable": true
}

0 comments on commit 52394bd

Please sign in to comment.