Skip to content

Commit

Permalink
migrated from Travis CI to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
craue committed Mar 21, 2023
1 parent 702ffca commit b0992fa
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 109 deletions.
15 changes: 7 additions & 8 deletions .gitattributes
@@ -1,8 +1,7 @@
/Tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis_install_dependencies.sh export-ignore
/.travis.yml export-ignore
/phpstan-config.neon export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/phpstan-config.neon export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/Tests export-ignore
Expand Up @@ -2,12 +2,6 @@

set -euv

export COMPOSER_NO_INTERACTION=1
composer self-update

# install Symfony Flex
composer require --no-progress --no-scripts --no-plugins symfony/flex

case "${DEPS:-}" in
'lowest')
COMPOSER_UPDATE_ARGS='--prefer-lowest'
Expand All @@ -22,6 +16,11 @@ case "${DEPS:-}" in

if [ -n "${SYMFONY_VERSION:-}" ]; then
composer config extra.symfony.require "${SYMFONY_VERSION}"
# ensure the given version is installed for all components - this is needed at least for (PHP 7.3 + Symfony 4.4) & (PHP 7.4 + Symfony 5.4)
# TODO remove as soon as PHP >= 8 is required
if [ "$(php -r 'echo PHP_MAJOR_VERSION;')" = "7" ]; then
composer require --no-update "symfony/symfony:${SYMFONY_VERSION}"
fi
fi
esac

Expand Down
143 changes: 143 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,143 @@
name: Tests

on:
pull_request: ~
push: ~

defaults:
run:
shell: bash

permissions:
contents: read

concurrency:
group: ${{ github.workflow }} @ ${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
test:
name: "PHP ${{ matrix.php }} - ${{ matrix.DEPS || format('Symfony {0}', matrix.SYMFONY_VERSION) }}${{ (matrix.allow-failure && ' 🔕') || '' }}"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allow-failure || false }}
strategy:
fail-fast: false
matrix:
include:
-
php: '7.3'
DEPS: 'lowest'
WITH_DOCTRINE_CACHE_BUNDLE: 'yes'
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2&max[indirect]=1230'
-
php: '8.2'
DEPS: 'unmodified'
WITH_STATIC_ANALYSIS: 'yes'
-
php: '7.3'
SYMFONY_VERSION: '4.4.*'
WITH_DOCTRINE_CACHE_BUNDLE: 'yes'
SYMFONY_DEPRECATIONS_HELPER: 'max[indirect]=4'
-
php: '7.4'
SYMFONY_VERSION: '5.4.*'
-
php: '8.0'
SYMFONY_VERSION: '5.4.*'
-
php: '8.1'
SYMFONY_VERSION: '5.4.*'
-
php: '8.2'
SYMFONY_VERSION: '6.3.*'
MIN_STABILITY: 'dev'
allow-failure: true

services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: set up MySQL
run: |
sudo systemctl start mysql
echo '
CREATE DATABASE IF NOT EXISTS test;
DROP USER IF EXISTS "tester"@"localhost";
CREATE USER "tester"@"localhost" IDENTIFIED WITH mysql_native_password BY "";
GRANT ALL ON test.* TO "tester"@"localhost";
FLUSH PRIVILEGES;
' > /tmp/mysql-init.sql
mysql --user=root --password=root -e 'source /tmp/mysql-init.sql'
- name: checkout
uses: actions/checkout@v3

- name: setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: mysql, redis
coverage: pcov
ini-values: memory_limit=-1
tools: flex
env:
fail-fast: true # interrupt on extension setup error

- name: get Composer's cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: cache Composer's package cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.DEPS || format('symfony-{0}', matrix.SYMFONY_VERSION) }}

- name: install dependencies
run: bash .github/install_dependencies.sh
env:
DEPS: "${{ matrix.DEPS }}"
MIN_STABILITY: "${{ matrix.MIN_STABILITY }}"
SYMFONY_VERSION: "${{ matrix.SYMFONY_VERSION }}"
WITH_DOCTRINE_CACHE_BUNDLE: "${{ matrix.WITH_DOCTRINE_CACHE_BUNDLE }}"

- name: show installed dependencies
run: composer show

- name: validate composer.json
if: ${{ matrix.WITH_STATIC_ANALYSIS == 'yes' }}
run: composer validate --strict --no-check-lock

- name: run PHPStan
if: ${{ matrix.WITH_STATIC_ANALYSIS == 'yes' }}
run: vendor/bin/phpstan analyse

- name: run PHPUnit
run: |
mkdir -p build/logs
vendor/bin/phpunit -v --coverage-clover build/logs/clover.xml
env:
REDIS_DSN: redis://localhost:6379
SYMFONY_DEPRECATIONS_HELPER: "${{ matrix.SYMFONY_DEPRECATIONS_HELPER }}"

- name: upload code coverage data
if: ${{ github.repository == 'craue/CraueConfigBundle' }}
env:
COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
uses: nick-fields/retry@v2
with:
command: |
PHP_COVERALLS_VERSION=`curl --retry 5 -Is https://github.com/php-coveralls/php-coveralls/releases/latest | grep -i 'Location:' | sed 's/.*\/tag\/\(.*\)$/\1/' | tr -d "[:cntrl:]"`
echo "using php-coveralls '${PHP_COVERALLS_VERSION}'"
wget -q "https://github.com/php-coveralls/php-coveralls/releases/download/${PHP_COVERALLS_VERSION}/php-coveralls.phar" -O php-coveralls.phar
php php-coveralls.phar -v
max_attempts: 3
timeout_seconds: 10
90 changes: 0 additions & 90 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Information

[![Build Status](https://app.travis-ci.com/craue/CraueConfigBundle.svg?branch=master)](https://app.travis-ci.com/craue/CraueConfigBundle)
[![Tests](https://github.com/craue/CraueConfigBundle/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/craue/CraueConfigBundle/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/craue/CraueConfigBundle/badge.svg?branch=master)](https://coveralls.io/github/craue/CraueConfigBundle?branch=master)

CraueConfigBundle manages configuration settings stored in the database and makes them accessible via a service in your
Expand Down
2 changes: 1 addition & 1 deletion Tests/config/config.yml
Expand Up @@ -9,7 +9,7 @@ doctrine:
host: 127.0.0.1
port: ~
dbname: test
user: travis
user: tester
password: ~
orm:
auto_generate_proxy_classes: '%kernel.debug%'
Expand Down
16 changes: 16 additions & 0 deletions Tests/config/config_hacks.php
Expand Up @@ -23,3 +23,19 @@
'storage_id' => 'session.storage.mock_file',
],
]);

// TODO remove as soon as Symfony >= 6 is required
if (Kernel::VERSION_ID >= 50200 && Kernel::VERSION_ID < 60000) {
$container->loadFromExtension('framework', [
'form' => [
'legacy_error_messages' => false,
],
]);
}

// TODO remove as soon as Symfony >= 7 is required
if (Kernel::VERSION_ID < 70000) {
$container->loadFromExtension('framework', [
'http_method_override' => false,
]);
}
3 changes: 0 additions & 3 deletions phpstan-config.neon
Expand Up @@ -11,6 +11,3 @@ parameters:
-
message: '#^Unsafe usage of new static\(\)\.$#'
path: Entity/BaseSetting.php
-
message: '#^Strict comparison using !== between false and false will always evaluate to false\.$#'
path: Twig/Extension/ConfigTemplateExtension.php

0 comments on commit b0992fa

Please sign in to comment.