Skip to content

Commit

Permalink
Merge pull request #16 from utopia-php/feat-add-new-methods
Browse files Browse the repository at this point in the history
Add New Methods to help with system orchestration
  • Loading branch information
eldadfux authored Sep 23, 2022
2 parents ca4b8b2 + ab62228 commit 698a58a
Show file tree
Hide file tree
Showing 7 changed files with 570 additions and 27 deletions.
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
language: php

dist: xenial

arch:
- amd64
- ppc64le
- arm64

php:
- 7.4
- 8.0
- nightly
- 8.0.23

before_install:
- git clone https://github.com/P-H-C/phc-winner-argon2.git libargon2 && cd libargon2 && make test && sudo make install PREFIX=/usr && cd ..

notifications:
email:
Expand All @@ -20,5 +24,4 @@ script:
- vendor/bin/phpunit --configuration phpunit.xml --testsuite General
- vendor/bin/psalm --show-info=true
- if [ "$TRAVIS_CPU_ARCH" = "amd64" ]; then vendor/bin/phpunit --configuration phpunit.xml --testsuite X86; fi
- if [ "$TRAVIS_CPU_ARCH" = "ppc64le" ]; then vendor/bin/phpunit --configuration phpunit.xml --testsuite PPC; fi
- if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then vendor/bin/phpunit --configuration phpunit.xml --testsuite ARM; fi
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM composer:2.0 as composer

ARG TESTING=false
ENV TESTING=$TESTING

WORKDIR /usr/local/src/

COPY composer.lock /usr/local/src/
COPY composer.json /usr/local/src/

RUN composer update --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist

FROM php:8.0-cli-alpine as compile

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN \
apk update \
&& apk add --no-cache make automake autoconf gcc g++ git brotli-dev \
&& docker-php-ext-install opcache \
&& rm -rf /var/cache/apk/*

FROM compile as final

LABEL maintainer="[email protected]"

WORKDIR /usr/src/code

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

RUN echo "opcache.enable_cli=1" >> $PHP_INI_DIR/php.ini

COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor

# Add Source Code
COPY . /usr/src/code

CMD [ "tail", "-f", "/dev/null" ]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ echo System::isX86(); // bool

Utopia Framework requires PHP 7.4 or later. We recommend using the latest PHP version whenever possible.

## Supported Methods
| | getCPUCores | getCPUUtilisation | getMemoryTotal | getMemoryFree | getDiskTotal | getDiskFree | getIOUsage | getNetworkUsage |
|---------|-------------|-------------------|----------------|---------------|--------------|-------------|------------|-----------------|
| Windows || | | ||| | |
| MacOS || ||||| | |
| Linux |||||||||

## Authors

**Eldad Fux**
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"vimeo/psalm": "4.0.1"
"vimeo/psalm": "4.0.1",
"squizlabs/php_codesniffer": "^3.6"
}
}
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.1'

services:
main-test:
build:
context: .
mem_limit: 512m
mem_reservation: 128M
cpus: 0.5
command: tail -f /dev/null
volumes:
- ./:/usr/src/code
Loading

0 comments on commit 698a58a

Please sign in to comment.