Switch to GitHub actions (#234)

This commit is contained in:
Wilmer Arambula 2020-09-14 07:14:26 -03:00 committed by GitHub
parent 216df5f4d1
commit 60f6fa0f70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 159 additions and 47 deletions

81
.github/workflows/ci-linux.yml vendored Normal file
View File

@ -0,0 +1,81 @@
on:
- pull_request
- push
name: ci-linux
jobs:
tests:
name: PHP ${{ matrix.php-version }}
env:
extensions: curl, dom, gd, imagick, intl, json, mbstring, libxml, xml, xmlwriter
key: cache-v1
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
php-version:
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v1
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
coverage: xdebug
tools: composer:v2, pecl
- name: Determine composer cache directory on Linux
run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)"
- name: Cache dependencies installed with composer
uses: actions/cache@v1
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: Install dependencies with composer php PHP [5.6 - 7.4]
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader
- name: Run tests with codeception with coverage on Linux PHP [5.6 - 7.4]
run: |
sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php
php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 &
vendor/bin/codecept run --coverage --coverage-xml
- name: Upload code coverage scrutinizer on Linux PHP 7.4
if: matrix.php-version == '7.4'
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml

76
.github/workflows/ci-windows.yml vendored Normal file
View File

@ -0,0 +1,76 @@
on:
- pull_request
- push
name: ci-windows
jobs:
tests:
name: PHP ${{ matrix.php-version }}
env:
extensions: curl, dom, gd, intl, json, mbstring, libxml, xml, xmlwriter
key: cache-v1
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
php-version:
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v1
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
coverage: xdebug
tools: composer:v2, pecl
- name: Determine composer cache directory on Windows
run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer"
- name: Cache dependencies installed with composer
uses: actions/cache@v1
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: Install dependencies with composer php PHP [5.6 - 7.4]
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader
- name: Run tests with codeception on Windows PHP [5.6 - 7.4]
run: |
sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php
php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 &
vendor/bin/codecept run
shell: bash

View File

@ -1,46 +0,0 @@
language: php
matrix:
fast_finish: true
include:
- php: "7.3"
- php: "7.2"
- php: "7.1"
- php: "7.0"
- php: "5.6"
# faster builds on new travis setup not using sudo
sudo: false
# cache vendor dirs
cache:
directories:
- $HOME/.composer/cache
services:
- mysql
before_install:
- mysql -e 'CREATE DATABASE IF NOT EXISTS yii2basic_test;'
install:
- travis_retry composer self-update && composer --version
- travis_retry composer update --dev --prefer-dist --no-interaction
# install php extensions
- |
if (php --version | grep -i HipHop > /dev/null); then
echo "Skipping imagick and gmagick tests on HHVM"
else
pear config-set preferred_state beta
printf "\n" | pecl install imagick
# gmagick is not installed on travis currently
#printf "\n" | pecl install gmagick
fi
# setup application:
- |
sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php
script:
- |
php -S localhost:8080 -t web > /dev/null 2>&1 &
vendor/bin/codecept run

View File

@ -15,7 +15,8 @@ features to your application.
[![Latest Stable Version](https://img.shields.io/packagist/v/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic)
[![Total Downloads](https://img.shields.io/packagist/dt/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic)
[![Build Status](https://travis-ci.com/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.com/yiisoft/yii2-app-basic)
[![ci-linux](https://github.com/yiisoft/yii2-app-basic/workflows/ci-linux/badge.svg)](https://github.com/yiisoft/yii2-app-basic/actions?query=workflow%3Aci-linux)
[![ci-windows](https://github.com/yiisoft/yii2-app-basic/workflows/ci-windows/badge.svg)](https://github.com/yiisoft/yii2-app-basic/actions?query=workflow%3Aci-windows)
DIRECTORY STRUCTURE
-------------------