Skip to content

[CI] Make sure composer cache is properly used #15359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: 'docs'

- name: Set-up PHP
uses: shivammathur/setup-php@v2
Expand All @@ -119,37 +121,41 @@ jobs:
coverage: none

- name: Fetch branch from where the PR started
working-directory: docs
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*

- name: Find modified files
id: find-files
working-directory: docs
run: echo "::set-output name=files::$(git diff --name-only origin/${{ github.base_ref }} HEAD | grep ".rst" | tr '\n' ' ')"

- name: Get composer cache directory
id: composercache
working-directory: _build
working-directory: docs/_build
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
if: ${{ steps.find-files.outputs.files }}
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
key: ${{ runner.os }}-composer-codeBlocks-${{ hashFiles('_checker/composer.lock', '_sf_app/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-codeBlocks-

- name: Install dependencies
if: ${{ steps.find-files.outputs.files }}
run: composer create-project symfony-tools/code-block-checker ../_checker
run: composer create-project symfony-tools/code-block-checker _checker

- name: Install test application
if: ${{ steps.find-files.outputs.files }}
run: |
git clone -b ${{ github.base_ref }} --depth 5 --single-branch https://github.com/symfony-tools/symfony-application.git ../_sf_app
cd ../_sf_app
git clone -b ${{ github.base_ref }} --depth 5 --single-branch https://github.com/symfony-tools/symfony-application.git _sf_app
cd _sf_app
composer update

- name: Generate baseline
if: ${{ steps.find-files.outputs.files }}
working-directory: docs
run: |
CURRENT=$(git rev-parse HEAD)
git checkout -m ${{ github.base_ref }}
Expand All @@ -159,5 +165,6 @@ jobs:

- name: Verify examples
if: ${{ steps.find-files.outputs.files }}
working-directory: docs
run: |
../_checker/code-block-checker.php verify:docs `pwd` ${{ steps.find-files.outputs.files }} --baseline=baseline.json --output-format=github --symfony-application=`realpath ../_sf_app`