yii2-netdisk/.github/workflows/build.yml

85 lines
2.4 KiB
YAML
Raw Normal View History

2020-09-14 18:14:26 +08:00
on:
- pull_request
- push
2020-11-01 00:25:13 +08:00
name: build
2020-09-14 18:14:26 +08:00
jobs:
tests:
name: PHP ${{ matrix.php }} - ${{ matrix.os }}
2020-09-14 18:14:26 +08:00
env:
extensions: dom, json, gd, imagick
2020-09-14 18:14:26 +08:00
key: cache-v1
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
2020-11-01 00:25:13 +08:00
- windows-latest
2020-09-14 18:14:26 +08:00
2020-11-01 00:25:13 +08:00
php:
2020-09-14 18:14:26 +08:00
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
2021-05-19 20:01:06 +08:00
- "8.0"
2020-09-14 18:14:26 +08:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
2020-11-01 00:25:13 +08:00
php-version: ${{ matrix.php }}
2020-09-14 18:14:26 +08:00
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:
2020-11-01 00:25:13 +08:00
php-version: ${{ matrix.php }}
2020-09-14 18:14:26 +08:00
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
2020-09-14 18:14:26 +08:00
- name: Determine composer cache directory on Linux
if: matrix.os == 'ubuntu-latest'
2021-03-17 04:16:19 +08:00
run: |
echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
2020-09-14 18:14:26 +08:00
- name: Determine composer cache directory on Windows
if: matrix.os == 'windows-latest'
2021-03-17 04:16:19 +08:00
run: |
echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" >> $GITHUB_ENV
2020-09-14 18:14:26 +08:00
- name: Cache dependencies installed with composer
uses: actions/cache@v1
with:
2021-03-17 04:16:19 +08:00
path: ${{ steps.cache-env.outputs.dir }}
2020-11-01 00:25:13 +08:00
key: php${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
2020-09-14 18:14:26 +08:00
restore-keys: |
2020-11-01 00:25:13 +08:00
php${{ matrix.php }}-composer-${{ matrix.dependencies }}-
2020-09-14 18:14:26 +08:00
2021-05-19 20:01:06 +08:00
- name: Install dependencies with composer php PHP [5.6 - 8.0]
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
2020-09-14 18:14:26 +08:00
2020-11-01 00:25:13 +08:00
- name: Run tests with codeception
2020-09-14 18:14:26 +08:00
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
2021-03-17 04:16:19 +08:00
shell: bash