Skip to content

Commit 6963153

Browse files
committed
Make sure composer cache is properly used
1 parent 9732d6c commit 6963153

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ jobs:
111111
steps:
112112
- name: Checkout code
113113
uses: actions/checkout@v2
114+
with:
115+
path: 'docs'
114116

115117
- name: Set-up PHP
116118
uses: shivammathur/setup-php@v2
@@ -119,35 +121,41 @@ jobs:
119121
coverage: none
120122

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

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

128132
- name: Get composer cache directory
129133
id: composercache
130-
working-directory: _build
134+
working-directory: docs/_build
131135
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
132136

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

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

143149
- name: Install test application
150+
if: ${{ steps.find-files.outputs.files }}
144151
run: |
145-
git clone -b ${{ github.base_ref }} --depth 5 --single-branch https://github.com/symfony-tools/symfony-application.git ../_sf_app
146-
cd ../_sf_app
152+
git clone -b ${{ github.base_ref }} --depth 5 --single-branch https://github.com/symfony-tools/symfony-application.git _sf_app
153+
cd _sf_app
147154
composer update
148155
149156
- name: Generate baseline
150157
if: ${{ steps.find-files.outputs.files }}
158+
working-directory: docs
151159
run: |
152160
CURRENT=$(git rev-parse HEAD)
153161
git checkout -m ${{ github.base_ref }}
@@ -157,5 +165,6 @@ jobs:
157165
158166
- name: Verify examples
159167
if: ${{ steps.find-files.outputs.files }}
168+
working-directory: docs
160169
run: |
161170
../_checker/code-block-checker.php verify:docs `pwd` ${{ steps.find-files.outputs.files }} --baseline=baseline.json --output-format=github --symfony-application=`realpath ../_sf_app`

0 commit comments

Comments
 (0)