Skip to content

Commit 02f5a5a

Browse files
committed
Fix codacy install
1 parent c81fe5e commit 02f5a5a

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

.github/workflows/CI.yml

+25-24
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ concurrency:
1616

1717
env:
1818
# Cache params
19-
CACHE_VERSION: 2022061901 # To be able to create a new cache (YYYYMMDDXX)
19+
CACHE_VERSION: 2022061902 # To be able to create a new cache (YYYYMMDDXX)
2020
COVERAGE_OUTPUT_STYLE: clover
2121
TEST_OUTPUT_STYLE: pretty
2222
COMPOSER_OPTIONS: --optimize-autoloader
23-
CODACY_REPORTER_TMP_FOLDER: ~/.codacy
23+
CODACY_CACHE_PATH: $HOME/.cache/codacy
24+
CODACY_BIN: $(echo $CODACY_CACHE_PATH/codacy.sh)
2425

2526
jobs:
2627
static-tests:
@@ -93,11 +94,22 @@ jobs:
9394
path: |
9495
~/.composer
9596
./vendor
96-
${{ env.CODACY_REPORTER_TMP_FOLDER }}
97+
$CODACY_CACHE_PATH
9798
build/behat-code-coverage-cache
9899
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
99100
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
100101

102+
- name: Download codacy binary
103+
if: steps.cache.outputs.cache-hit != 'true'
104+
run: |
105+
mkdir -p $CODACY_CACHE_PATH \
106+
&& echo $CODACY_BIN \
107+
&& touch $( echo $CODACY_BIN ) \
108+
&& (ls -ail $CODACY_CACHE_PATH $CODACY_BIN || true) \
109+
&& curl -LN https://coverage.codacy.com/get.sh -o $( echo $CODACY_BIN ) \
110+
&& chmod +x $CODACY_BIN \
111+
&& $CODACY_BIN download
112+
101113
- name: Build
102114
run: |
103115
composer require \
@@ -128,19 +140,8 @@ jobs:
128140
flags: "functional-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
129141
fail_ci_if_error: true
130142

131-
- name: Download codacy binary
132-
if: steps.cache.outputs.cache-hit != 'true'
133-
run: |
134-
mkdir -p ${{ env.CODACY_REPORTER_TMP_FOLDER }} \
135-
&& curl -Ls https://coverage.codacy.com/get.sh -o ${{ env.CODACY_REPORTER_TMP_FOLDER }}/codacy.sh \
136-
&& chmod +x ${{ env.CODACY_REPORTER_TMP_FOLDER }}/codacy.sh \
137-
&& ${{ env.CODACY_REPORTER_TMP_FOLDER }}/codacy.sh download
138-
139-
- name: DEBUG
140-
run: ls -ail ${{ env.CODACY_REPORTER_TMP_FOLDER }} ${{ env.CODACY_REPORTER_TMP_FOLDER }}/*
141-
142-
# - name: Upload coverages to Codacy
143-
# run: ${{ env.CODACY_REPORTER_TMP_FOLDER }}/codacy.sh report -r build/coverage-phpunit/unit.clover -r build/coverage-behat/clover.xml -r build/coverage-phpunit/functional.clover -t ${{ secrets.CODACY_PROJECT_TOKEN }} --partial
143+
- name: Upload coverages to Codacy
144+
run: $CODACY_BIN report -r build/coverage-phpunit/unit.clover -r build/coverage-behat/clover.xml -r build/coverage-phpunit/functional.clover -t ${{ secrets.CODACY_PROJECT_TOKEN }} --partial
144145

145146
finalize-codacy-coverage-report:
146147
runs-on: ubuntu-latest
@@ -152,19 +153,19 @@ jobs:
152153
uses: actions/cache@v2
153154
with:
154155
path: |
155-
${{ env.CODACY_REPORTER_TMP_FOLDER }}
156+
$CODACY_CACHE_PATH
156157
key: ${{ env.CACHE_VERSION }}-codacy
157158

158159
- name: Download codacy binary
159160
if: steps.cache.outputs.cache-hit != 'true'
160161
run: |
161-
mkdir -p ${{ env.CODACY_REPORTER_TMP_FOLDER }} \
162-
&& curl -Ls https://coverage.codacy.com/get.sh -o ${{ env.CODACY_REPORTER_TMP_FOLDER }}/codacy.sh \
163-
&& chmod +x ${{ env.CODACY_REPORTER_TMP_FOLDER }}/codacy.sh \
164-
&& ${{ env.CODACY_REPORTER_TMP_FOLDER }}/codacy.sh download
162+
mkdir -p $CODACY_CACHE_PATH \
163+
&& curl -LN https://coverage.codacy.com/get.sh -o $( echo $CODACY_BIN ) \
164+
&& chmod +x $CODACY_BIN \
165+
&& $CODACY_BIN download
165166
166-
# - name: Finalize reporting
167-
# run: ${{ env.CODACY_REPORTER_TMP_FOLDER }}/codacy.sh final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
167+
- name: Finalize reporting
168+
run: $CODACY_BIN final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
168169

169170
nightly-tests:
170171
name: Nightly - PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }}
@@ -202,7 +203,7 @@ jobs:
202203
path: |
203204
~/.composer
204205
./vendor
205-
${{ env.CODACY_REPORTER_TMP_FOLDER }}
206+
$CODACY_CACHE_PATH
206207
build/behat-code-coverage-cache
207208
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
208209
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}

0 commit comments

Comments
 (0)