Skip to content

Commit

Permalink
GitHub Actions (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Jul 7, 2023
1 parent 9453a80 commit cb57f8b
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
on:
pull_request:
paths-ignore:
- '.editorconfig'
- '.gitignore'
- 'gnu-agpl-v3.0.md'
- 'LICENSE'
- 'psalm.xml'
- 'README.md'

push:
branches: [ 'master' ]
paths-ignore:
- '.editorconfig'
- '.gitignore'
- 'gnu-agpl-v3.0.md'
- 'LICENSE'
- 'psalm.xml'
- 'README.md'

name: build

jobs:
phpunit:
name: PHP ${{ matrix.php }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest', 'windows-latest' ]
php: [ '8.2' ]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
ini-values: date.timezone='UTC'
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Determine composer cache directory on Linux
if: matrix.os == 'ubuntu-latest'
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Determine composer cache directory on Windows
if: matrix.os == 'windows-latest'
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Cache dependencies installed with composer
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run tests with PHPUnit
run: vendor/bin/phpunit --configuration phpunit.xml.dist
62 changes: 62 additions & 0 deletions .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
pull_request:
paths-ignore:
- '.editorconfig'
- '.gitignore'
- 'gnu-agpl-v3.0.md'
- 'LICENSE'
- 'phpunit.xml.dist'
- 'psalm.xml'
- 'README.md'

push:
branches: [ 'master' ]
paths-ignore:
- '.editorconfig'
- '.gitignore'
- 'gnu-agpl-v3.0.md'
- 'LICENSE'
- 'phpunit.xml.dist'
- 'psalm.xml'
- 'README.md'

name: Composer require checker

jobs:
composer-require-checker:
name: PHP ${{ matrix.php }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest' ]
php: [ '8.2' ]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
ini-values: date.timezone='UTC'
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Determine composer cache directory on Linux
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Check dependencies
run: vendor/bin/composer-require-checker
60 changes: 60 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
pull_request:
paths-ignore:
- '.editorconfig'
- '.gitignore'
- 'gnu-agpl-v3.0.md'
- 'LICENSE'
- 'phpunit.xml.dist'
- 'README.md'

push:
branches: [ 'master' ]
paths-ignore:
- '.editorconfig'
- '.gitignore'
- 'gnu-agpl-v3.0.md'
- 'LICENSE'
- 'phpunit.xml.dist'
- 'README.md'

name: static analysis

jobs:
psalm:
name: PHP ${{ matrix.php }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest' ]
php: [ '8.2' ]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
ini-values: date.timezone='UTC'
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Determine composer cache directory on Linux
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Static analysis
run: vendor/bin/psalm --config=psalm.xml --shepherd --stats --output-format=github --php-version=${{ matrix.php }}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"brick/money": "^0.8.0"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.6",
"phpunit/phpunit": "^10.2",
"vimeo/psalm": "^5.13"
},
Expand Down
File renamed without changes.

0 comments on commit cb57f8b

Please sign in to comment.