Skip to content

Commit 70d45ad

Browse files
authored
GitHub actions (#132)
* added github workflow(action) for build and test ci tasks Signed-off-by: fenn-cs <[email protected]> * updated php_codesniffer dep Signed-off-by: fenn-cs <[email protected]> * removed travis ci config file Signed-off-by: fenn-cs <[email protected]>
1 parent c31d6f9 commit 70d45ad

File tree

4 files changed

+75
-97
lines changed

4 files changed

+75
-97
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: phpList REST API Build
2+
on: [push, pull_request]
3+
jobs:
4+
main:
5+
name: phpList Base Dist on PHP ${{ matrix.php-versions }}, with dist ${{ matrix.dependencies }} [Build, Test]
6+
runs-on: ubuntu-20.04
7+
env:
8+
DB_DATABASE: phplist
9+
DB_USERNAME: root
10+
DB_PASSWORD: phplist
11+
BROADCAST_DRIVER: log
12+
services:
13+
mysql:
14+
image: mysql:5.7
15+
env:
16+
MYSQL_ALLOW_EMPTY_PASSWORD: false
17+
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }}
18+
MYSQL_DATABASE: ${{ env.DB_DATABASE }}
19+
ports:
20+
- 3306/tcp
21+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
26+
dependencies: ['latest', 'oldest']
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
- name: Setup PHP, with composer and extensions
31+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
32+
with:
33+
php-version: ${{ matrix.php-versions }}
34+
extensions: mbstring, dom, fileinfo, mysql
35+
coverage: xdebug #optional
36+
- name: Start mysql service
37+
run: sudo /etc/init.d/mysql start
38+
- name: Verify MySQL connection on host
39+
run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES"
40+
- name: Get composer cache directory
41+
id: composer-cache
42+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
43+
- name: Cache composer dependencies
44+
uses: actions/cache@v2
45+
with:
46+
path: ${{ steps.composer-cache.outputs.dir }}
47+
# Use composer.json for key, if composer.lock is not committed.
48+
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
49+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
50+
restore-keys: ${{ runner.os }}-composer-
51+
- name: Install the lowest dependencies
52+
run: composer update --with-dependencies --prefer-stable --prefer-dist --prefer-lowest
53+
if: ${{ matrix.dependencies }} == "latest"
54+
- name: Install current dependencies from composer.lock
55+
run: composer install
56+
if: ${{ matrix.dependencies }} == "oldest"
57+
- name: Set up database schema
58+
run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < vendor/phplist/core/resources/Database/Schema.sql
59+
- name: Validating composer.json
60+
run: composer validate --no-check-all --no-check-lock --strict;
61+
- name: Linting all php files
62+
run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l;
63+
- name: Run integration tests with phpunit
64+
run: vendor/bin/phpunit tests/Integration/
65+
- name: Running the system tests
66+
run: vendor/bin/phpunit tests/Integration/;
67+
- name: Running static analysis
68+
run: vendor/bin/phpstan analyse -l 5 src/ tests/;
69+
- name: Running PHPMD
70+
run: vendor/bin/phpmd src/ text vendor/phplist/core/config/PHPMD/rules.xml;
71+
- name: Running PHP_CodeSniffer
72+
run: vendor/bin/phpcs --standard=vendor/phplist/core/config/PhpCodeSniffer/ src/ tests/;

.travis.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# phpList 4 REST API
22

3-
[![Build Status](https://travis-ci.com/phpList/rest-api.svg?branch=master)](https://travis-ci.com/phpList/rest-api)
3+
[![Build Status](https://github.com/phpList/rest-api/workflows/phpList%20REST%20API%20Build/badge.svg)](https://github.com/phpList/rest-api/actions)
44
[![Latest Stable Version](https://poser.pugx.org/phplist/rest-api/v/stable.svg)](https://packagist.org/packages/phpList/rest-api)
55
[![Total Downloads](https://poser.pugx.org/phplist/rest-api/downloads.svg)](https://packagist.org/packages/phpList/rest-api)
66
[![Latest Unstable Version](https://poser.pugx.org/phplist/rest-api/v/unstable.svg)](https://packagist.org/packages/phpList/rest-api)

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
"source": "https://github.com/phpList/rest-api"
3131
},
3232
"require": {
33-
"php": "~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0",
34-
33+
"php": "^7.0|^8.0",
3534
"phplist/core": "4.0.x-dev",
3635
"friendsofsymfony/rest-bundle": "^2.3",
3736
"sensio/framework-extra-bundle": "5.1.0"
@@ -41,7 +40,7 @@
4140
"phpunit/phpunit-mock-objects": "^5.0.6",
4241
"phpunit/dbunit": "^3.0.0",
4342
"guzzlehttp/guzzle": "^6.3.0",
44-
"squizlabs/php_codesniffer": "^3.2.0",
43+
"squizlabs/php_codesniffer": "^3.5.8",
4544
"phpstan/phpstan": "^0.7.0",
4645
"nette/caching": "^2.5.0 || ^3.0.0",
4746
"nikic/php-parser": "^3.1.0",

0 commit comments

Comments
 (0)