diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..471eb48 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,81 @@ +unit-config: &unit-config + environment: + COMPOSER_PREFER_LOWEST: 0 + steps: + - checkout + + - run: + name: Install latest composer + command: | + php -r "copy('https://raw.githubusercontent.com/composer/getcomposer.org/master/web/installer', 'composer-setup.php');" + php composer-setup.php + php -r "unlink('composer-setup.php');" + mv composer.phar /usr/local/bin/composer + + - run: + name: Write COMPOSER_PREFER_LOWEST to file + command: echo "$COMPOSER_PREFER_LOWEST" > ~/COMPOSER_PREFER_LOWEST.txt + + # Download and cache dependencies + - restore_cache: + keys: + - v1-composer-cache-{{ checksum "~/COMPOSER_PREFER_LOWEST.txt" }}-{{ checksum "composer.json" }} + # Fall back to using the latest cache if no exact match is found. + - v1-composer-cache-{{ checksum "~/COMPOSER_PREFER_LOWEST.txt" }} + + - run: + name: Validate composer files + command: composer validate --strict + + - run: + name: Install PHP extensions + command: | + printf '\n' | sudo pecl install redis + sudo docker-php-ext-enable redis + + - run: + name: Install composer packages + command: | + if [ $COMPOSER_PREFER_LOWEST -eq "1" ]; then + composer update --no-ansi --no-progress --optimize-autoloader --no-interaction --no-plugins --no-scripts --prefer-dist --prefer-stable --prefer-lowest + else + composer update --no-ansi --no-progress --optimize-autoloader --no-interaction --no-plugins --no-scripts --prefer-dist --prefer-stable + fi + + - save_cache: + key: v1-composer-cache-{{ checksum "~/COMPOSER_PREFER_LOWEST.txt" }}-{{ checksum "composer.json" }} + paths: + - ./vendor + + - run: + name: Wait for backing services to start + command: dockerize -wait tcp://127.0.0.1:6379 -timeout 30s + + - run: + name: Run tests + command: ./vendor/bin/phpunit + +version: 2.1 +jobs: + php73: + <<: *unit-config + docker: + - image: circleci/php:7.3-cli-node + - image: circleci/redis:5-alpine + environment: + COMPOSER_PREFER_LOWEST: 0 + + php73-lowest: + <<: *unit-config + docker: + - image: circleci/php:7.3-cli-node + - image: circleci/redis:5-alpine + environment: + COMPOSER_PREFER_LOWEST: 1 + +workflows: + version: 2 + units: + jobs: + - php73 + - php73-lowest diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1044039 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +* text=auto +/.circleci/ export-ignore +/.github/ export-ignore +/examples/ export-ignore +/nginx/ export-ignore +/php-fpm/ export-ignore +/tests/ export-ignore +.gitattributes export-ignore +.gitignore export-ignore +docker-compose.yml export-ignore +phpcs.xml.dist export-ignore +phpunit.xml.dist export-ignore diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cd51f3b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: php -php: - - 7.3 - - 7.4 - -services: - - redis-server - -before_script: - - echo "apc.enabled = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo "apc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo "extension = apcu.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - composer self-update - - composer install --no-interaction --prefer-source --dev - - phpenv rehash - -script: - - vendor/bin/phpunit --verbose --colors diff --git a/composer.json b/composer.json index fcfb614..c985b44 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,8 @@ { "name": "endclothing/prometheus_client_php", - "version": "1.0.1", + "description": "Prometheus instrumentation library for PHP applications.", + "type": "library", + "license": "Apache-2.0", "authors": [ { "name": "Daniel Noel-Davies", @@ -33,5 +35,13 @@ "Test\\Prometheus\\": "tests/" } }, - "license": "Apache-2.0" + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "config": { + "sort-packages": true + }, + "prefer-stable": true } diff --git a/phpunit.xml b/phpunit.xml.dist similarity index 51% rename from phpunit.xml rename to phpunit.xml.dist index ab027cb..9fc8a72 100644 --- a/phpunit.xml +++ b/phpunit.xml.dist @@ -7,15 +7,18 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" + stopOnError="false" stopOnFailure="false"> - - - ./tests/Test/Prometheus - - - - - ./src/Prometheus - - + + + + ./tests/Test/Prometheus + + + + + + ./src/Prometheus + +