|
1 | | -#name: phpList Core Build |
2 | | -#on: [push, pull_request] |
3 | | -#jobs: |
4 | | -# main: |
5 | | -# name: phpList on PHP ${{ matrix.php-versions }} [Build, Test] |
6 | | -# runs-on: ubuntu-22.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: ['8.1'] |
26 | | -# steps: |
27 | | -# - name: Checkout |
28 | | -# uses: actions/checkout@v3 |
29 | | -# - name: Setup PHP, with composer and extensions |
30 | | -# uses: shivammathur/setup-php@v2 |
31 | | -# with: |
32 | | -# php-version: ${{ matrix.php-versions }} |
33 | | -# extensions: mbstring, dom, fileinfo, mysql |
34 | | -# coverage: xdebug #optional |
35 | | -# - name: Install Symfony CLI |
36 | | -# run: | |
37 | | -# curl -sS https://get.symfony.com/cli/installer | bash |
38 | | -# mv $HOME/.symfony*/bin/symfony /usr/local/bin/symfony |
39 | | -# symfony version |
40 | | -# - name: Start mysql service |
41 | | -# run: sudo /etc/init.d/mysql start |
42 | | -# - name: Verify MySQL connection on host |
43 | | -# run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES" |
44 | | -# - name: Set up database schema |
45 | | -# run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < resources/Database/Schema.sql |
46 | | -# - name: Get composer cache directory |
47 | | -# id: composer-cache |
48 | | -# run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
49 | | -# - name: Cache composer dependencies |
50 | | -# uses: actions/cache@v3 |
51 | | -# with: |
52 | | -# path: ${{ steps.composer-cache.outputs.dir }} |
53 | | -# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
54 | | -# restore-keys: ${{ runner.os }}-composer- |
55 | | -# - name: Install Composer dependencies |
56 | | -# run: composer install --no-progress --prefer-dist --optimize-autoloader |
57 | | -# - name: Validating composer.json |
58 | | -# run: composer validate --no-check-all --no-check-lock --strict; |
59 | | -# - name: Linting all php files |
60 | | -# run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l bin/*; |
61 | | -# - name: Run units tests with phpunit |
62 | | -# run: vendor/bin/phpunit tests/Unit/ --testdox |
63 | | -# - name: Run integration tests with phpunit |
64 | | -# run: | |
65 | | -# export PHPLIST_DATABASE_NAME=${{ env.DB_DATABASE }} |
66 | | -# export PHPLIST_DATABASE_USER=${{ env.DB_USERNAME }} |
67 | | -# export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }} |
68 | | -# export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }} |
69 | | -# export PHPLIST_DATABASE_HOST=127.0.0.1 |
70 | | -# vendor/bin/phpunit tests/Integration/ |
71 | | -# - name: Running the system tests |
72 | | -# run: vendor/bin/phpunit tests/System/ --testdox; |
73 | | -# - name: Running static analysis |
74 | | -# run: vendor/bin/phpstan analyse -c phpstan.neon; |
75 | | -# - name: Running PHPMD |
76 | | -# run: vendor/bin/phpmd src/ text config/PHPMD/rules.xml; |
77 | | -# - name: Running PHP_CodeSniffer |
78 | | -# run: vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/; |
| 1 | +name: phpList Core Build |
| 2 | +on: [push, pull_request] |
| 3 | +jobs: |
| 4 | + main: |
| 5 | + name: phpList on PHP ${{ matrix.php-versions }} [Build, Test] |
| 6 | + runs-on: ubuntu-22.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: ['8.1'] |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v3 |
| 29 | + - name: Setup PHP, with composer and extensions |
| 30 | + uses: shivammathur/setup-php@v2 |
| 31 | + with: |
| 32 | + php-version: ${{ matrix.php-versions }} |
| 33 | + extensions: mbstring, dom, fileinfo, mysql |
| 34 | + coverage: xdebug #optional |
| 35 | + - name: Install Symfony CLI |
| 36 | + run: | |
| 37 | + curl -sS https://get.symfony.com/cli/installer | bash |
| 38 | + mv $HOME/.symfony*/bin/symfony /usr/local/bin/symfony |
| 39 | + symfony version |
| 40 | + - name: Start mysql service |
| 41 | + run: sudo /etc/init.d/mysql start |
| 42 | + - name: Verify MySQL connection on host |
| 43 | + run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES" |
| 44 | + - name: Set up database schema |
| 45 | + run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < resources/Database/Schema.sql |
| 46 | + - name: Get composer cache directory |
| 47 | + id: composer-cache |
| 48 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 49 | + - name: Cache composer dependencies |
| 50 | + uses: actions/cache@v3 |
| 51 | + with: |
| 52 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 53 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 54 | + restore-keys: ${{ runner.os }}-composer- |
| 55 | + - name: Install Composer dependencies |
| 56 | + run: composer install --no-progress --prefer-dist --optimize-autoloader |
| 57 | + - name: Validating composer.json |
| 58 | + run: composer validate --no-check-all --no-check-lock --strict; |
| 59 | + - name: Linting all php files |
| 60 | + run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l bin/*; |
| 61 | + - name: Run units tests with phpunit |
| 62 | + run: vendor/bin/phpunit tests/Unit/ --testdox |
| 63 | + - name: Run integration tests with phpunit |
| 64 | + run: | |
| 65 | + export PHPLIST_DATABASE_NAME=${{ env.DB_DATABASE }} |
| 66 | + export PHPLIST_DATABASE_USER=${{ env.DB_USERNAME }} |
| 67 | + export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }} |
| 68 | + export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }} |
| 69 | + export PHPLIST_DATABASE_HOST=127.0.0.1 |
| 70 | + vendor/bin/phpunit tests/Integration/ |
| 71 | + - name: Running the system tests |
| 72 | + run: vendor/bin/phpunit tests/System/ --testdox; |
| 73 | + - name: Running static analysis |
| 74 | + run: vendor/bin/phpstan analyse -c phpstan.neon; |
| 75 | + - name: Running PHPMD |
| 76 | + run: vendor/bin/phpmd src/ text config/PHPMD/rules.xml; |
| 77 | + - name: Running PHP_CodeSniffer |
| 78 | + run: vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/; |
0 commit comments