Skip to content

Commit

Permalink
Merge pull request #11 from liip/switch-to-github-actions
Browse files Browse the repository at this point in the history
switch build from travis-ci to github actions
  • Loading branch information
dbu authored Sep 22, 2022
2 parents e63bc7a + 1edbdb5 commit eacd733
Show file tree
Hide file tree
Showing 13 changed files with 779 additions and 176 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
latest:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php:
- '7.4'
- '8.0'
- '8.1'

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

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

- name: Update dependencies for PHP 8
if: matrix.php >= '8.0'
run: composer update --prefer-dist --no-interaction --no-progress --no-ansi

- name: Execute 7 tests
run: make phpcs
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: release

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
ini-values: phar.readonly=0

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

- name: Determine version name
id: get-version
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/}

- name: Update application version
run: sed -i 's/Varnish Plus CLI/Varnish Plus CLI ${{ steps.get-version.outputs.version }}/g' bin/varnish-plus-cli.php && cat bin/varnish-plus-cli.php

- name: Build PHP 7.4 phar with makefile
run: make dist

- name: Build PHP 8.0 phar with makefile
run: make dist-php8

- name: Check if we can run the phar
run: |
- ./dist/varnish-plus-cli.phar --version
- ./dist/varnish-plus-cli.8.0.phar --version
- name: Create Release
uses: ncipollo/release-action@v1
with:
# This token is provided by GitHub Actions.
# You DO NOT need to create your own token.
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.get-version.outputs.version }}
tag: ${{ steps.get-version.outputs.version }}
body: 'Stable release.'
artifacts: ./dist/varnish-plus-cli.phar, ./dist/varnish-plus-cli.8.0.phar
artifactContentType: application/x-php
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
/dist/

###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
8 changes: 4 additions & 4 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
declare(strict_types=1);
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$finder = Finder::create()
$finder = (new Finder())
->in(__DIR__)
;
return Config::create()
return (new Config())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
Expand Down Expand Up @@ -37,7 +37,7 @@
'no_binary_string' => true,
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_short_echo_tag' => true,
'echo_tag_syntax' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_unreachable_default_argument_value' => true,
Expand All @@ -51,7 +51,7 @@
'php_unit_mock' => true,
'php_unit_namespaced' => true,
'php_unit_no_expectation_annotation' => true,
'php_unit_ordered_covers' => true,
'phpdoc_order_by_value' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => true,
'php_unit_test_annotation' => true,
Expand Down
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

1.1.0
-----

* Support PHP 8 with the `varnish-plus-cli.8.0.phar` release artifact
* Drop support for PHP < 7.4
* Fixed deployment

1.0.2
-----

Expand Down
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@ SRC_FILES= $(shell find $(SRC_DIR) -name "*.php")
dist/varnish-plus-cli.phar: vendor box.json.dist tools/box bin/varnish-plus-cli.php $(SRC_FILES) composer.lock
./tools/box compile --quiet

dist/varnish-plus-cli.8.0.phar: vendor box.json.dist tools/box bin/varnish-plus-cli.php $(SRC_FILES) composer.lock
mv dist/varnish-plus-cli.phar dist/tmp
composer update --optimize-autoloader --no-dev --no-suggest --quiet
./tools/box compile --quiet
mv dist/varnish-plus-cli.phar dist/varnish-plus-cli.8.0.phar
mv dist/tmp dist/varnish-plus-cli.phar

tools/box:
wget --directory-prefix=tools --quiet https://github.com/humbug/box/releases/download/3.6.0/box.phar
wget --directory-prefix=tools --quiet https://github.com/humbug/box/releases/download/3.16.0/box.phar
mv tools/box.phar tools/box
chmod +x tools/box

tools/php-cs-fixer:
wget --directory-prefix=tools --quiet https://cs.sensiolabs.org/download/php-cs-fixer-v2.phar
mv tools/php-cs-fixer-v2.phar tools/php-cs-fixer
wget --directory-prefix=tools --quiet https://cs.symfony.com/download/php-cs-fixer-v3.phar
mv tools/php-cs-fixer-v3.phar tools/php-cs-fixer
chmod +x tools/php-cs-fixer

tools/phpstan:
wget --directory-prefix=tools --quiet https://github.com/phpstan/phpstan-shim/raw/0.10.5/phpstan
wget --directory-prefix=tools --quiet https://github.com/phpstan/phpstan/releases/download/1.8.5/phpstan.phar
mv tools/phpstan.phar tools/phpstan
chmod +x tools/phpstan

phpcs: vendor tools/php-cs-fixer tools/phpstan
composer validate --strict --no-check-lock
tools/php-cs-fixer fix --dry-run --stop-on-violation -v
tools/phpstan analyze --level=7 --no-progress bin/ src/

Expand All @@ -30,6 +39,8 @@ fix-cs: tools/php-cs-fixer

dist: dist/varnish-plus-cli.phar

dist-php8: dist/varnish-plus-cli.8.0.phar

clean:
rm -Rf tools/ dist/ vendor/

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"psr-4": { "App\\": "src/" }
},
"require": {
"php": "^7.2",
"php": "^7.4 || ^8.0",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.3",
"pnz/json-exception": "^0.1.0",
"psr/log": "^1.1",
"symfony/console": "^4.2",
"symfony/filesystem": "^4.2",
"pnz/json-exception": "^1.0.1",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"symfony/console": "^4.2 || ^5.0 || ^6.0",
"symfony/filesystem": "^4.2 || ^5.0 || ^6.0",
"twig/twig": "^2.5"
},
"config": {
Expand Down
Loading

0 comments on commit eacd733

Please sign in to comment.