Skip to content

Commit

Permalink
Update GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
devanych committed Dec 12, 2020
1 parent 1182337 commit a89e9bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 26 deletions.
34 changes: 11 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ name: build
jobs:
tests:
name: PHP ${{ matrix.php-version }}-${{ matrix.os }}

runs-on: ${{ matrix.os }}

env:
extensions: curl, mbstring, dom
key: cache-v1
Expand All @@ -26,45 +24,35 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

- 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@v2
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}

- name: Setup PHP
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
ini-values: date.timezone='UTC'
tools: composer:v2
coverage: pcov

- name: Determine composer cache directory on Linux
if: matrix.os == 'ubuntu-latest'
run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)"
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Determine composer cache directory on Windows
if: matrix.os == 'windows-latest'
run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer"
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Cache dependencies installed with composer
uses: actions/cache@v1
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php-version }}-composer-
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer php 7.4
if: matrix.php-version == '7.4'
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -30,14 +30,18 @@ jobs:
tools: composer:v2

- name: Determine composer cache directory
run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)"
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php-version }}-composer-
restore-keys: |
php${{ matrix.php-version }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader
Expand Down

0 comments on commit a89e9bf

Please sign in to comment.