Skip to content

Commit ec9ddc8

Browse files
nfebemichield
authored andcommitted
introduced ci with github workflows for builds and tests
Signed-off-by: Fenn-CS <[email protected]>
1 parent 9316bc3 commit ec9ddc8

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
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 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-latest
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']
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 latest dependencies
52+
run: composer update --with-dependencies --prefer-stable --prefer-dist
53+
if: ${{ matrix.dependencies }} == "latest"
54+
- name: Install lowest dependencies from
55+
run: composer update --with-dependencies --prefer-stable --prefer-dist --prefer-lowest
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/;

0 commit comments

Comments
 (0)