From 36ab5818d5112b5e6cf90fa76661a7cf7ae4b5b2 Mon Sep 17 00:00:00 2001 From: Perreal Guillaume <guillaume.perreal@irstea.fr> Date: Tue, 19 Mar 2019 14:59:37 +0100 Subject: [PATCH] CI setup. --- .gitlab-ci.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ .packagist.sh | 5 +++++ composer.json | 5 ++++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100755 .packagist.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..93605c0 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,43 @@ +stages: + - test + - deploy + +.test: &test + stage: test + tags: [docker] + image: php:${CI_JOB_NAME}-cli-alpine + variables: + COMPOSER_ALLOW_SUPERUSER: "1" + before_script: + - curl -sSL https://github.com/composer/composer/releases/download/1.8.4/composer.phar --output /usr/local/bin/composer + - chmod +x /usr/local/bin/composer + - apk update && apk add unzip git + - php -v + - composer -V + - composer global require hirak/prestissimo + script: + - composer install + - php -l src/*.php + - vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no + cache: + key: composer-cache + paths: + - /root/.composer/cache + +"7.0": + <<: *test + +"7.1": + <<: *test + +"7.2": + <<: *test + +"7.3": + <<: *test + +deploy: + stage: deploy + tags: [docker] + image: appropriate/curl + script: ./.packagist.sh diff --git a/.packagist.sh b/.packagist.sh new file mode 100755 index 0000000..a4d7718 --- /dev/null +++ b/.packagist.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +curl -fsSL \ + -H"Content-Type: application/json" \ + -d'{"repository":{"url":"'$CI_PROJECT_URL'.git"}}' \ + "https://packagist.org/api/update-package?username=$PACKAGIST_USERNAME&apiToken=$PACKAGIST_TOKEN" diff --git a/composer.json b/composer.json index 3719c91..728440a 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "^5.6 | ^7.0", + "php": "^7.0", "ext-json": "*", "friendsofphp/php-cs-fixer": "^2.13" }, @@ -19,5 +19,8 @@ }, "config": { "sort-packages": true + }, + "archive": { + "exclude": [".?*"] } } -- GitLab