diff --git a/.env.github b/.env.github new file mode 100644 index 00000000..6ebe09fb --- /dev/null +++ b/.env.github @@ -0,0 +1,66 @@ +APP_NAME=Laravel +APP_ENV=testing +APP_KEY=SomeRandomString # Leave this +APP_DEBUG=false +APP_LOG_LEVEL=warning + +DB_CONNECTION=pgsql +DB_HOST=127.0.0.1 +DB_PORT=5432 +DB_DATABASE=jbuktest +DB_USERNAME=postgres +DB_PASSWORD=postgres + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=smtp +MAIL_HOST=smtp.mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= + +AWS_S3_KEY=your-key +AWS_S3_SECRET=your-secret +AWS_S3_REGION=region +AWS_S3_BUCKET=your-bucket +AWS_S3_URL=https://xxxxxxx.s3-region.amazonaws.com + +APP_URL=https://example.com # This one is necessary +APP_LONGURL=example.com +APP_SHORTURL=examp.le + +ADMIN_USER=admin # pick something better, this is used for `/admin` +ADMIN_PASS=password +DISPLAY_NAME="Joe Bloggs" # This is used for example in the header and titles + +TWITTER_CONSUMER_KEY= +TWITTER_CONSUMER_SECRET= +TWITTER_ACCESS_TOKEN= +TWITTER_ACCESS_TOKEN_SECRET= + +SCOUT_DRIVER=pgsql + +PIWIK=false + +FATHOM_ID= + +APP_TIMEZONE=UTC +APP_LANG=en +APP_LOG=daily +SECURE_SESSION_COOKIE=true + +LOG_SLACK_WEBHOOK_URL= + +FONT_LINK= diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..8bb94848 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,56 @@ +name: Run Tests + +on: + pull_request: + +jobs: + phpunit: + runs-on: ubuntu-20.04 + + name: PHPUnit test suite + + services: + postgres: + image: postgres:12 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: jbuktest + ports: + - 5432:5432 + + steps: + - uses: actions/checkout@v2 + - name: Cache node modules + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-${{ hashFiles('**/package.json') }} + - name: Install npm dependencies + run: npm install + - name: Install ImageMagick + run: sudo apt install imagemagick + - name: Setup PHP with pecl extension + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + tools: pecl, phpcs + extensions: imagick + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.github', '.env');" + - name: Install dependencies + run: composer install -q --no-ansi --no-interaction --no-progress + - name: Generate key + run: php artisan key:generate + - name: Setup directory permissions + run: chmod -R 777 storage bootstrap/cache + - name: Setup test database + run: | + php artisan migrate + php artisan db:seed + - name: Execute tests (Unit and Feature tests) via PHPUnit + run: vendor/bin/phpunit + - name: Run phpcs + run: phpcs + - name: Check for security vulnerabilities + run: php vendor/bin/security-checker security:check diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a32ed22b..00000000 --- a/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -language: php - -os: linux -dist: bionic - -addons: - hosts: - - jmb.localhost - - jonnybarnes.localhost - postgresql: "9.6" - apt: - packages: - - nginx-full - - postgresql-9.6-postgis-2.4 - - imagemagick - #- google-chrome-stable - artifacts: - region: "eu-west-1" - paths: - - $(ls tests/Browser/screenshots/*.png | tr "\n" ":") - - $(ls tests/Browser/console/*.log | tr "\n" ":") - - $(ls storage/logs/*.log | tr "\n" ":") - - $(ls /tmp/*.log | tr "\n" ":") - -services: - - postgresql - -env: - global: - - setup=basic - -php: - - 7.4.7 - -before_install: - - printf "\n" | pecl install imagick - - cp .env.travis .env - - echo 'error_log = "/tmp/php.error.log"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - psql -U travis -c 'create database travis_ci_test' - - psql -U travis -d travis_ci_test -c 'create extension postgis' - - travis_retry composer self-update --snapshot - - curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar - -install: - - if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-dist; fi - - if [[ $setup = 'stable' ]]; then travis_retry composer update --no-interaction --prefer-dist --prefer-stable; fi - - if [[ $setup = 'lowest' ]]; then travis_retry composer update --no-interaction --prefer-dist --prefer-lowest --prefer-stable; fi - - travis/install-nginx.sh - - . $HOME/.nvm/nvm.sh - - nvm install stable - - nvm use stable - - npm i puppeteer - -before_script: - - php artisan key:generate - - php artisan migrate - - php artisan db:seed - #- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9515 http://localhost:8000 & - #- sleep 5 - -script: - - php vendor/bin/phpunit --stop-on-failure - - php phpcs.phar - #- php artisan dusk - - php vendor/bin/security-checker security:check