Skip to content

Instantly share code, notes, and snippets.

@luceos
Forked from iWader/composer.sh
Created September 24, 2018 12:38
Show Gist options
  • Save luceos/acb5f7fc054475b29ef451205e9f3a1c to your computer and use it in GitHub Desktop.
Save luceos/acb5f7fc054475b29ef451205e9f3a1c to your computer and use it in GitHub Desktop.

Revisions

  1. @iWader iWader revised this gist Jul 27, 2017. No changes.
  2. @iWader iWader created this gist Jul 27, 2017.
    19 changes: 19 additions & 0 deletions composer.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/bin/sh

    EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")

    if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
    then
    >&2 echo 'ERROR: Invalid installer signature'
    rm composer-setup.php
    exit 1
    fi

    php composer-setup.php --quiet
    RESULT=$?
    rm composer-setup.php
    mv composer.phar /usr/bin/composer
    chmod +x /usr/bin/composer
    exit $RESULT
    100 changes: 100 additions & 0 deletions config.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,100 @@
    version: 2

    jobs:
    build:
    working_directory: /var/www

    environment:
    BASH_ENV: ~/.bashrc

    docker:
    - image: php:7.1-cli
    environment:
    APP_ENV=testing

    - image: circleci/mysql:5.7
    environment:
    MYSQL_ALLOW_EMPTY_PASSWORD=true
    MYSQL_ROOT_HOST="%"
    MYSQL_USER=root

    steps:

    - run:
    name: Install System Dependencies
    command: |
    apt-get update
    apt-get install -y libmcrypt-dev git unzip wget libpng-dev
    # These are required for e2e tests
    apt-get install -y libsqlite3-dev libnss3 libgconf-2-4 libfontconfig1 chromium xvfb
    - run:
    name: Install PHP Extensions
    command: docker-php-ext-install -j$(nproc) mcrypt pdo_mysql pdo_sqlite gd zip

    - checkout

    - run:
    name: Install NVM
    command: bash .circleci/nvm.sh

    - run:
    name: Install Composer
    command: bash .circleci/composer.sh

    - run:
    name: Install Composer Dependencies
    command: composer install --no-progress --no-suggest

    - run:
    name: PHPCS
    command: ./vendor/bin/phpcs --standard=PSR2 -p app config

    - run:
    name: Setup Environment
    command: |
    cp .env.dusk.testing .env
    php artisan key:generate
    php artisan passport:keys
    - run:
    name: Unit Tests
    command: APP_ENV=testing DB_DATABASE=circle_test ./vendor/bin/phpunit

    - run:
    name: Install Node Dependencies
    command: |
    node --version
    npm --version
    npm install
    - run:
    name: Webpack
    command: npm run prod

    - run:
    name: Start xvfb
    background: true
    command: /usr/bin/Xvfb :0 -screen 0 1280x720x24

    - run:
    name: Open Browsers
    background: true
    command: DISPLAY=:0 ./vendor/laravel/dusk/bin/chromedriver-linux

    - run:
    name: Serve Application
    background: true
    command: APP_ENV=testing DB_DATABASE=circle_test php artisan serve

    - run:
    name: e2e Tests
    command: php artisan dusk

    - store_artifacts:
    path: ./tests/Browser/console
    destination: console

    - store_artifacts:
    path: ./tests/Browser/screenshots
    destination: screenshots
    10 changes: 10 additions & 0 deletions nvm.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/usr/bin/env bash

    export NVM_DIR="$HOME/.nvm"

    mv .nvmrc .nvmrc.bak \
    && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash \
    && source $NVM_DIR/nvm.sh \
    && mv .nvmrc.bak .nvmrc \
    && nvm install \
    && npm install -g npm