Skip to content

Commit

Permalink
Adapt Github Actions to 9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Sep 27, 2019
1 parent 5b57ea0 commit 142e732
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
46 changes: 28 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: "ubuntu-latest"
services:
app:
image: "glpi/githubactions-php:5.6"
image: "glpi/githubactions-php:7.0"
options: >-
--volume /glpi:/var/glpi
steps:
Expand All @@ -25,7 +25,9 @@ jobs:
docker exec ${{ job.services.app.id }} perl -i -0 -p -e 's/,?\s*"platform"\:\s*\{[^\}]*}//i' composer.json
docker exec ${{ job.services.app.id }} rm composer.lock
docker exec ${{ job.services.app.id }} composer --version
docker exec ${{ job.services.app.id }} composer install --optimize-autoloader --prefer-dist --no-interaction --no-progress --no-suggest
docker exec ${{ job.services.app.id }} echo "node version: $(node --version)"
docker exec ${{ job.services.app.id }} echo "npm version: $(npm --version)"
docker exec ${{ job.services.app.id }} bin/console dependencies install --ci
- name: "PHP Parallel Lint"
run: |
docker exec ${{ job.services.app.id }} vendor/bin/parallel-lint --exclude ./files/ --exclude ./plugins/ --exclude ./tools/vendor/ --exclude ./vendor/ .
Expand All @@ -34,7 +36,14 @@ jobs:
docker exec ${{ job.services.app.id }} vendor/bin/security-checker security:check
- name: "PHP CS"
run: |
docker exec ${{ job.services.app.id }} vendor/bin/phpcs -d memory_limit=512M -p -n --extensions=php --standard=vendor/glpi-project/coding-standard/GlpiStandard/ --ignore=/.git/,/config/,/files/,/lib/,/plugins/,/tests/config/,/vendor/ ./
docker exec ${{ job.services.app.id }} vendor/bin/phpcs -d memory_limit=512M -p -n --extensions=php --standard=vendor/glpi-project/coding-standard/GlpiStandard/ --ignore=/.git/,/config/,/files/,/lib/,/node_modules/,/plugins/,/tests/config/,/vendor/ ./
- name: "ESLint"
run: |
docker exec ${{ job.services.app.id }} node_modules/.bin/eslint ./js && echo "ESLint found no errors"
docker exec ${{ job.services.app.id }} node_modules/.bin/eslint --env=node --parser-options=ecmaVersion:6 --rule 'indent: ["error", 4]' ./webpack.config.js && echo "ESLint found no errors"
- name: "Check CSS compilation"
run: |
docker exec ${{ job.services.app.id }} bin/console build:compile_scss
tests:
name: "Test on PHP ${{ matrix.php-version }} using ${{ matrix.db-image }}"
Expand All @@ -51,40 +60,33 @@ jobs:
#- "mysql:5.7"
- "mysql:8.0"
php-version:
- "5.6"
#- "7.0"
- "7.0"
#- "7.1"
#- "7.2"
- "7.3"
#- "7.4-rc"
- "7.4-rc"
exclude:
# Exclude all DB images except "mariadb:10.4" for all PHP versions except "7.3".
- {db-image: "mariadb:10.1", php-version: "5.6"}
- {db-image: "mariadb:10.1", php-version: "7.0"}
- {db-image: "mariadb:10.1", php-version: "7.1"}
- {db-image: "mariadb:10.1", php-version: "7.2"}
- {db-image: "mariadb:10.1", php-version: "7.4-rc"}
- {db-image: "mariadb:10.2", php-version: "5.6"}
- {db-image: "mariadb:10.2", php-version: "7.0"}
- {db-image: "mariadb:10.2", php-version: "7.1"}
- {db-image: "mariadb:10.2", php-version: "7.2"}
- {db-image: "mariadb:10.2", php-version: "7.4-rc"}
- {db-image: "mariadb:10.3", php-version: "5.6"}
- {db-image: "mariadb:10.3", php-version: "7.1"}
- {db-image: "mariadb:10.3", php-version: "7.0"}
- {db-image: "mariadb:10.3", php-version: "7.2"}
- {db-image: "mariadb:10.3", php-version: "7.4-rc"}
- {db-image: "mysql:5.6", php-version: "5.6"}
- {db-image: "mysql:5.6", php-version: "7.0"}
- {db-image: "mysql:5.6", php-version: "7.1"}
- {db-image: "mysql:5.6", php-version: "7.2"}
- {db-image: "mysql:5.6", php-version: "7.4-rc"}
- {db-image: "mysql:5.7", php-version: "5.6"}
- {db-image: "mysql:5.7", php-version: "7.0"}
- {db-image: "mysql:5.7", php-version: "7.1"}
- {db-image: "mysql:5.7", php-version: "7.2"}
- {db-image: "mysql:5.7", php-version: "7.4-rc"}
- {db-image: "mysql:8.0", php-version: "5.6"}
- {db-image: "mysql:8.0", php-version: "7.0"}
- {db-image: "mysql:8.0", php-version: "7.1"}
- {db-image: "mysql:8.0", php-version: "7.2"}
Expand All @@ -100,6 +102,8 @@ jobs:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
options: >-
--shm-size=1g
dovecot:
image: "glpi/githubactions-dovecot"
steps:
- name: "Checkout"
uses: "actions/checkout@v1"
Expand All @@ -117,14 +121,20 @@ jobs:
docker exec ${{ job.services.app.id }} perl -i -0 -p -e 's/,?\s*"platform"\:\s*\{[^\}]*}//i' composer.json
docker exec ${{ job.services.app.id }} rm composer.lock
docker exec ${{ job.services.app.id }} composer --version
docker exec ${{ job.services.app.id }} composer install --optimize-autoloader --prefer-dist --no-interaction --no-progress --no-suggest
docker exec ${{ job.services.app.id }} echo "node version: $(node --version)"
docker exec ${{ job.services.app.id }} echo "npm version: $(npm --version)"
docker exec ${{ job.services.app.id }} bin/console dependencies install --ci
- name: "Install DB tests"
run: |
docker exec ${{ job.services.app.id }} bin/console glpi:database:install --config-dir=./tests --no-interaction --db-name=glpi --db-host=db --db-user=root
docker exec ${{ job.services.app.id }} bin/console glpi:database:install --config-dir=./tests --no-interaction --reconfigure --db-name=glpi --db-host=db --db-user=root
docker exec ${{ job.services.app.id }} bin/console glpi:database:update --config-dir=./tests --no-interaction | grep -q "No migration needed." || (echo "glpi:database:update command FAILED" && exit 1)
- name: "Unit tests"
run: |
docker exec ${{ job.services.app.id }} vendor/bin/atoum -p 'php -d memory_limit=512M' --debug --force-terminal --use-dot-report --configurations tests/telemetry.php --bootstrap-file tests/bootstrap.php --no-code-coverage -d tests/units
- name: "IMAP tests"
run: |
for f in `ls tests/emails-tests/*.eml`; do cat $f | docker exec --user glpi --interactive ${{ job.services.dovecot.id }} getmail_maildir /home/glpi/Maildir/ ; done
docker exec ${{ job.services.app.id }} php vendor/bin/atoum -p 'php -d memory_limit=512M' --debug --force-terminal --use-dot-report --configurations tests/telemetry.php --bootstrap-file tests/bootstrap.php --no-code-coverage --max-children-number 1 -d tests/imap
- name: "Functionnal tests"
run: |
docker exec ${{ job.services.app.id }} vendor/bin/atoum -p 'php -d memory_limit=512M' --debug --force-terminal --use-dot-report --configurations tests/telemetry.php --bootstrap-file tests/bootstrap.php --no-code-coverage --max-children-number 1 -d tests/functionnal
Expand All @@ -134,13 +144,13 @@ jobs:
docker exec ${{ job.services.app.id }} vendor/bin/atoum -p 'php -d memory_limit=512M' --debug --force-terminal --use-dot-report --configurations tests/telemetry.php --bootstrap-file tests/bootstrap.php --no-code-coverage --max-children-number 1 -d tests/web
- name: "Update DB tests"
run: |
docker exec ${{ job.services.app.id }} cp tests/github_actions.config_db.php tests/config_db.php
docker exec ${{ job.services.app.id }} bin/console glpi:database:configure --config-dir=./tests --no-interaction --reconfigure --db-name=glpitest0723 --db-host=db --db-user=root
docker exec ${{ job.services.app.id }} bin/console glpi:migration:myisam_to_innodb --config-dir=./tests --no-interaction
docker exec ${{ job.services.app.id }} bin/console glpi:database:update --config-dir=./tests --allow-unstable --no-interaction
docker exec ${{ job.services.app.id }} bin/console glpi:database:update --config-dir=./tests --allow-unstable --no-interaction | grep -q "No migration needed." || (echo "glpi:database:update command FAILED" && exit 1)
docker exec ${{ job.services.app.id }} bin/console glpi:migration:myisam_to_innodb --config-dir=./tests --no-interaction
docker exec ${{ job.services.app.id }} rm tests/config_db.php
docker exec ${{ job.services.app.id }} bin/console glpi:migration:timestamps --config-dir=./tests --no-interaction
- name: "Database tests"
run: |
docker exec ${{ job.services.app.id }} cp tests/github_actions.config_db.php tests/config_db.php
docker exec ${{ job.services.app.id }} bin/console glpi:database:configure --config-dir=./tests --no-interaction --reconfigure --db-name=glpitest0723 --db-host=db --db-user=root
docker exec ${{ job.services.app.id }} vendor/bin/atoum -p 'php -d memory_limit=512M' --debug --force-terminal --use-dot-report --configurations tests/telemetry.php --bootstrap-file tests/bootstrap.php --no-code-coverage --max-children-number 1 -d tests/database
docker exec ${{ job.services.app.id }} rm tests/config_db.php
4 changes: 2 additions & 2 deletions tests/imap/MailCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private function doConnect() {
'login' => 'testuser',
'is_active' => true,
'passwd' => 'applesauce',
'mail_server' => '127.0.0.1',
'mail_server' => 'dovecot',
'server_type' => '/imap',
'server_port' => 143,
'server_ssl' => '',
Expand All @@ -212,7 +212,7 @@ private function doConnect() {
$this->integer($this->mailgate_id)->isGreaterThan(0);

$this->boolean($collector->getFromDB($this->mailgate_id))->isTrue();
$this->string($collector->fields['host'])->isIdenticalTo('{127.0.0.1:143/imap/novalidate-cert}');
$this->string($collector->fields['host'])->isIdenticalTo('{dovecot:143/imap/novalidate-cert}');
$collector->connect();
$this->variable($collector->fields['errors'])->isEqualTo(0);
}
Expand Down

0 comments on commit 142e732

Please sign in to comment.