Skip to content

Commit

Permalink
Add CircleCI and phpunit.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
defser committed Sep 18, 2021
1 parent 03ad14c commit 1b04528
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: 2.1

orbs:
php: circleci/[email protected]
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
6 changes: 6 additions & 0 deletions .circleci/scripts/install-php-extensions.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="TestZilliqaLaravel">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 1b04528

Please sign in to comment.