From 09ae6c64f4d246a917cbaaa84d3b301f7dd5cfad Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Wed, 6 Nov 2019 09:19:42 +0900 Subject: [PATCH 1/2] Use caching - see https://github.com/actions/cache --- .github/workflows/main.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0672ed40bc..56ec9b8e9c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,18 @@ jobs: steps: - name: Checkout uses: actions/checkout@master + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Setup PHP uses: nanasess/setup-php@master with: @@ -105,6 +117,17 @@ jobs: with: php-version: ${{ matrix.php }} + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Install to Composer run: composer install --no-interaction -o @@ -145,6 +168,19 @@ jobs: if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'prereleased' ) uses: actions/checkout@master + - name: Get Composer Cache Directory + if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'prereleased' ) + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'prereleased' ) + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Install to Composer if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'prereleased' ) run: composer install --no-scripts --no-dev --no-interaction --optimize-autoloader From a493431c55b097d665fc016d28e1aa79be7eda96 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Wed, 6 Nov 2019 09:39:49 +0900 Subject: [PATCH 2/2] Fix search pattern on Windows - https://github.com/actions/cache/issues/39#issuecomment-549068850 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 56ec9b8e9c..0ae9b751ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -124,7 +124,7 @@ jobs: - uses: actions/cache@v1 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**\composer.lock') }} restore-keys: | ${{ runner.os }}-composer-