Skip to content

Commit 86b26f6

Browse files
nfebetatevikg1
authored andcommitted
GitHub actions (#132)
* added github workflow(action) for build and test ci tasks Signed-off-by: fenn-cs <fenn25.fn@gmail.com> * updated php_codesniffer dep Signed-off-by: fenn-cs <fenn25.fn@gmail.com> * removed travis ci config file Signed-off-by: fenn-cs <fenn25.fn@gmail.com> (cherry picked from commit 70d45ad)
1 parent bf004d0 commit 86b26f6

File tree

4 files changed

+74
-96
lines changed

4 files changed

+74
-96
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 & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +0,0 @@
1-
language: php
2-
3-
php:
4-
- 7.0
5-
- 7.1
6-
- 7.2
7-
8-
services:
9-
- mysql
10-
11-
env:
12-
global:
13-
- PHPLIST_DATABASE_NAME=phplist PHPLIST_DATABASE_USER=travis PHPLIST_DATABASE_PASSWORD=''
14-
matrix:
15-
- DEPENDENCIES=latest
16-
- DEPENDENCIES=oldest
17-
18-
notifications:
19-
slack:
20-
rooms:
21-
secure: cwCoc5P28/IG7s+P9Hj5cw4jbVXHDuYcTQoj9CJNNzWb5/Mfu7472EzjRkFP9FL86LGa3JfnoTHBRxfvDS4I1soapPX8hHNZFL68iOgXtKxpWpYTeJszV09W2Cc2EzOWn/Th1Q6D5DfLPGmDTgaIiFS70FJ+3VOwNl0GFjtryAJxRdzGTRkbKDZUd/jA6JXOEu3+Rk9rZeHl90bI7CWDJS5sz5Ubzy7mmEFyn4+S1ktFkKeCOdD+CS3r4DCv1TufAg6fRMflBU5chw8sypqtEE6FqlH1bYZ3OMLaQ4MZZH+4yL+EfnUx4zmXN0L7tOSGKNeoCwiTk5AnlJzUaop0+d3FQXNEvsXvq1UuIEe8lm8bkn1gMvMBvo0rh2YpWLErHBFXclS03uSUYU0EQPz/kAuNfDD7a+v62vgSTi8t/7Pqr099J/V6b7cAtlqf1x38/U5QKVOZ4g2zUV3nVbPpoaR8pC/PJ0Jvz4g6vIaWiSqtCWkUV2CDHblSNt+ySIfadwgFBBbylPOXNBorzkRn+QUFbeq2iOMM0FLnhKc+XPIyK1ewmCfm5bj1kUOfoN09zSwauigNI3Ag6MWPAZNY0qpDyCqGOm8KcFCX5X57eekNHjRNM3Zac3OSTjlQ9jV9MmDCHWxvrmKBGM9a5d5u6bS/8Mqxgm/FsNk4b1HgsN8=
22-
on_success: change
23-
on_failure: always
24-
25-
sudo: false
26-
27-
cache:
28-
directories:
29-
- vendor
30-
- "$HOME/.composer/cache"
31-
32-
before_install:
33-
- phpenv config-rm xdebug.ini
34-
35-
install:
36-
- >
37-
echo;
38-
if [ "$DEPENDENCIES" = "latest" ]; then
39-
echo "Installing the latest dependencies";
40-
composer update --with-dependencies --prefer-stable --prefer-dist
41-
else
42-
echo "Installing the lowest dependencies";
43-
composer update --with-dependencies --prefer-stable --prefer-dist --prefer-lowest
44-
fi;
45-
composer show;
46-
47-
before_script:
48-
- >
49-
echo;
50-
echo "Creating the database and importing the database schema";
51-
mysql -e "CREATE DATABASE ${PHPLIST_DATABASE_NAME};";
52-
mysql -u root -e "GRANT ALL ON ${PHPLIST_DATABASE_NAME}.* TO '${PHPLIST_DATABASE_USER}'@'%';";
53-
mysql ${PHPLIST_DATABASE_NAME} < vendor/phplist/core/resources/Database/Schema.sql;
54-
55-
script:
56-
- >
57-
echo;
58-
echo "Validating the composer.json";
59-
composer validate --no-check-all --no-check-lock --strict;
60-
61-
- >
62-
echo;
63-
echo "Linting all PHP files";
64-
find src/ tests/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l;
65-
66-
- >
67-
echo;
68-
echo "Running the unit tests";
69-
vendor/bin/phpunit tests/Unit/;
70-
71-
- >
72-
echo;
73-
echo "Running the integration tests";
74-
vendor/bin/phpunit tests/Integration/;
75-
76-
- >
77-
echo;
78-
echo "Running the system tests";
79-
vendor/bin/phpunit tests/System/;
80-
81-
- >
82-
echo;
83-
echo "Running the static analysis";
84-
vendor/bin/phpstan analyse -l 5 src/ tests/;
85-
86-
- >
87-
echo;
88-
echo "Running PHPMD";
89-
vendor/bin/phpmd src/ text vendor/phplist/core/config/PHPMD/rules.xml;
90-
91-
- >
92-
echo;
93-
echo "Running PHP_CodeSniffer";
94-
vendor/bin/phpcs --standard=vendor/phplist/core/config/PhpCodeSniffer/ src/ tests/;

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.org/phpList/rest-api.svg?branch=master)](https://travis-ci.org/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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
},
8787
"extra": {
8888
"branch-alias": {
89-
"dev-ISSUE-337": "v5.0.x-dev"
89+
"dev-master": "5.0.x-dev"
9090
},
9191
"symfony-app-dir": "bin",
9292
"symfony-bin-dir": "bin",

0 commit comments

Comments
 (0)