diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..9d466af9 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,61 @@ +version: 2 +jobs: + build: + # uncomment later + # docker_layer_caching: true + working_directory: ~/gush + docker: + - image: circleci/php:7.2-cli + steps: + - setup_remote_docker + - checkout + - run: + name: "Build Docker container" + command: | + docker build --rm=false -t gush . + - restore_cache: + keys: + - composer-v2.0.0-{{ checksum "composer.json" }} + - composer-v2.0.0- + - run: + name: "Install dependencies from Composer" + command: | + cd ~/gush + composer install --prefer-dist --optimize-autoloader --no-interaction + - save_cache: + key: composer-v2.0.0-{{ checksum "composer.json" }} + paths: + - /tmp/.composer/cache/files + - restore_cache: + key: phpunit-v2.0.0-{{ checksum "composer.json" }} + paths: + - /tmp/phpunit + - run: + name: "Running 'phpunit'" + command: | + cd ~/gush + mkdir -p ~/gush/var/circle-test-reports/phpunit + vendor/bin/phpunit --verbose --log-junit var/circle-test-reports/phpunit/junit.xml + - save_cache: + key: phpunit-v2.0.0-{{ checksum "composer.json" }} + paths: + - /tmp/phpunit + - store_test_results: + path: ~/gush/var/circle-test-reports + - store_artifacts: + path: ~/gush/var/circle-test-reports + - run: + name: "Running Docker container" + environment: + GUSH_CONFIG: /root/.gush + GUSH_LOCAL_CONFIG: /root/project + GUSH_USE_FS: true + command: docker run --tty gush -vvv --help + - deploy: + filters: + branches: + only: master + command: | + docker login -u coder20078 -p $DOCKER_HUB_PASSWORD -e coder20078@gmail.com + docker tag -f gush coder20078/gush + docker push coder20078/gush diff --git a/Dockerfile b/Dockerfile index d7c4d402..0e21a7a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,11 @@ -FROM php:7.0.8-alpine +FROM php:7.2.8-cli-alpine RUN set -xe \ && apk add --no-cache \ git \ openssh-client -RUN curl -s https://getcomposer.org/installer | php \ - && chmod +x composer.phar \ - && mv composer.phar /usr/bin/composer - +COPY --from=composer:1.6 /usr/bin/composer /usr/bin/composer COPY ./src /usr/src/gush/src COPY ./gush /usr/src/gush/gush COPY ./composer.json /usr/src/gush/composer.json diff --git a/circle.yml b/circle.yml deleted file mode 100644 index a0a8ba68..00000000 --- a/circle.yml +++ /dev/null @@ -1,37 +0,0 @@ -# -# This file is part of Gush. -# -# (c) Luis Cordova -# -# This source file is subject to the MIT license that is bundled -# with this source code in the file LICENSE. -# - -machine: - php: - version: 7.0.7 - pre: - - mkdir -p ~/docker - - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0 - services: - - docker - environment: - GUSH_USE_FS: true -dependencies: - cache_directories: - - ~/docker - override: - - docker build --rm=false -t gush . -test: - override: - - composer install --prefer-dist --optimize-autoloader --no-interaction - - mkdir -p $CIRCLE_TEST_REPORTS/phpunit - - vendor/bin/phpunit --verbose --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit.xml - - docker run --tty -e GUSH_CONFIG=/root/.gush -e GUSH_LOCAL_CONFIG=/root/project gush -vvvv --help -deployment: - master: - branch: master - commands: - - docker login -u coder20078 -p $DOCKER_HUB_PASSWORD -e coder20078@gmail.com - - docker tag -f gush coder20078/gush - - docker push coder20078/gush