From 1b04528e5e9c4f2ea61867c2ca0a6a1f5de00f03 Mon Sep 17 00:00:00 2001 From: patrickfalize Date: Sat, 18 Sep 2021 22:19:14 +0200 Subject: [PATCH] Add CircleCI and phpunit.xml --- .circleci/config.yml | 58 +++++++++++++++++++++ .circleci/scripts/install-php-extensions.sh | 6 +++ phpunit.xml | 9 ++++ 3 files changed, 73 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 .circleci/scripts/install-php-extensions.sh create mode 100644 phpunit.xml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..093a8ad --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,58 @@ +version: 2.1 + +orbs: + php: circleci/php@1.1.0 +workflows: + build_and_test: + jobs: + - build_and_test +jobs: + build_and_test: + docker: + - image: circleci/php:7.4.9-cli-buster + steps: + - checkout + - run: | + sudo apt update -y && + sudo apt install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev libgmp-dev re2c libmhash-dev libmcrypt-dev file zlib1g-dev && + sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/local/include/ + - run: mkdir ./php-ext-cache/ + - restore_cache: + keys: + - extensions-v1-{{ checksum ".circleci/scripts/install-php-extensions.sh" }} + - extensions-v1- + - run: + name: Copying restored extensions cache into extensions directory + command: sudo cp -R ./php-ext-cache/. /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ + - run: + name: Install Extensions (if not cached) + command: | + ls -al /usr/local/include/php/ + if [ true || ! -f /usr/local/lib/php/extensions/no-debug-non-zts-20190902/mcrypt.so ]; then + .circleci/scripts/install-php-extensions.sh; + fi + ls -al /usr/local/include/php/ + - run: + name: Copying extensions to temp directory for cache + command: sudo cp -R /usr/local/lib/php/extensions/no-debug-non-zts-20190902/* ./php-ext-cache/ + - save_cache: + key: extensions-v1-{{ checksum ".circleci/scripts/install-php-extensions.sh" }} + paths: + - ./php-ext-cache/ + + - php/install-composer: + install-version: 2.1.0 + - php/install-packages + + - run: + name: View PHP environment + command: | + php -v && + composer --version && + ./vendor/bin/phpunit --version + - run: + name: Phpunit tests + command: | + ./vendor/bin/phpunit --log-junit test-results/phpunit/junit.xml + - store_test_results: + path: test-results \ No newline at end of file diff --git a/.circleci/scripts/install-php-extensions.sh b/.circleci/scripts/install-php-extensions.sh new file mode 100644 index 0000000..acab270 --- /dev/null +++ b/.circleci/scripts/install-php-extensions.sh @@ -0,0 +1,6 @@ +#!/bin/sh +sudo pecl install mcrypt-1.0.4 && \ +sudo docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \ +sudo docker-php-ext-configure gmp && \ +sudo docker-php-ext-install -j$(nproc) gmp gd && \ +sudo docker-php-ext-enable mcrypt \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..c00d06b --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,9 @@ + + + + + + tests/Unit + + + \ No newline at end of file