-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will run tests on all supported PHP version 5.6 through 8.0 and check the coding style.
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# This file lints the code and runs tests. | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
env: | ||
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist" | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php: | ||
- '8.0' | ||
- '7.4' | ||
- '7.3' | ||
- '7.2' | ||
- '7.1' | ||
- '7.0' | ||
- '5.6' | ||
include: | ||
- php: '7.0' | ||
cs_fixer: true | ||
name: 'Check with PHP ${{ matrix.php }}' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Nix | ||
uses: cachix/install-nix-action@v12 | ||
|
||
- name: Set up Nix cache | ||
uses: cachix/cachix-action@v8 | ||
with: | ||
name: fossar | ||
|
||
- name: Update flake.nix to match the current CI job from matrix | ||
run: sed -i 's/matrix.phpPackage = "php";/matrix.phpPackage = builtins.replaceStrings ["."] [""] "php${{ matrix.php }}";/' flake.nix | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-composer-modules | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install dependencies | ||
run: nix-shell --run 'composer install' | ||
|
||
- name: Lint source code | ||
if: matrix.cs_fixer | ||
run: nix-shell --run 'php-cs-fixer fix' | ||
|
||
- name: Run unit tests | ||
run: nix-shell --run 'composer test' |