@@ -128,19 +128,6 @@ jobs:
128
128
run : npm run wp-env run tests-cli -- --env-cwd="wp-content/plugins/$(basename $(pwd))" composer install --no-interaction --no-progress
129
129
- name : Update Composer Dependencies
130
130
run : composer update --with-all-dependencies --no-interaction --no-progress
131
- - name : Download Codecov CLI
132
- if : ${{ matrix.coverage == true }}
133
- run : |
134
- # Create a temporary directory for GPG operations
135
- mkdir -p .gpg
136
-
137
- curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --homedir .gpg --no-default-keyring --keyring trustedkeys.gpg --import
138
- curl -Os https://cli.codecov.io/latest/linux/codecov
139
- curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
140
- curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
141
- gpg --homedir .gpg --no-default-keyring --keyring trustedkeys.gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
142
- shasum -a 256 -c codecov.SHA256SUM
143
- chmod +x codecov
144
131
- name : Install PHPUnit
145
132
run : |
146
133
if [ "${{ matrix.php }}" == "8.2" ]; then
@@ -154,13 +141,6 @@ jobs:
154
141
if [ "${{ matrix.coverage }}" == "true" ]; then
155
142
for PLUGIN in ${{ steps.changed-plugins.outputs.all_changed_plugins }}; do
156
143
npm run test-php:$PLUGIN -- -- -- --coverage-clover=./single-site-reports/coverage-$PLUGIN.xml
157
-
158
- # Upload coverage report to Codecov.
159
- ./codecov --verbose upload-process --disable-search --fail-on-error \
160
- -t ${{ secrets.CODECOV_TOKEN }} \
161
- -n ${{ matrix.php }}-$PLUGIN-single-site-coverage \
162
- -F $PLUGIN \
163
- -f ./single-site-reports/coverage-$PLUGIN.xml
164
144
done
165
145
else
166
146
for PLUGIN in ${{ steps.changed-plugins.outputs.all_changed_plugins }}; do
@@ -172,16 +152,57 @@ jobs:
172
152
if [ "${{ matrix.coverage }}" == "true" ]; then
173
153
for PLUGIN in ${{ steps.changed-plugins.outputs.all_changed_plugins }}; do
174
154
npm run test-php-multisite:$PLUGIN -- -- -- --coverage-clover=./multisite-reports/coverage-multisite-$PLUGIN.xml
175
-
176
- # Upload coverage report to Codecov.
177
- ./codecov --verbose upload-process --disable-search --fail-on-error \
178
- -t ${{ secrets.CODECOV_TOKEN }} \
179
- -n ${{ matrix.php }}-$PLUGIN-multisite-coverage \
180
- -F $PLUGIN \
181
- -f ./multisite-reports/coverage-multisite-$PLUGIN.xml
182
155
done
183
156
else
184
157
for PLUGIN in ${{ steps.changed-plugins.outputs.all_changed_plugins }}; do
185
158
npm run test-php-multisite:$PLUGIN
186
159
done
187
160
fi
161
+ - name : Download Codecov CLI
162
+ if : ${{ matrix.coverage == true }}
163
+ run : |
164
+ # Create a temporary directory for GPG operations
165
+ mkdir -p .gpg
166
+
167
+ curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --homedir .gpg --no-default-keyring --keyring trustedkeys.gpg --import
168
+ curl -Os https://cli.codecov.io/latest/linux/codecov
169
+ curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
170
+ curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
171
+ gpg --homedir .gpg --no-default-keyring --keyring trustedkeys.gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
172
+ shasum -a 256 -c codecov.SHA256SUM
173
+ chmod +x codecov
174
+ - name : Upload coverage reports to Codecov
175
+ if : ${{ matrix.coverage == true }}
176
+ run : |
177
+ # Build common arguments for all uploads
178
+ cc_args=()
179
+ cc_args+=(--fail-on-error)
180
+ cc_args+=(--disable-search)
181
+ cc_args+=(--git-service github)
182
+ cc_args+=(--gcov-executable "gcov")
183
+
184
+ # Add SHA for PRs
185
+ if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
186
+ cc_args+=(--sha "${{ github.event.pull_request.head.sha }}")
187
+ fi
188
+
189
+ # Handle authentication differently for forks vs. internal PRs
190
+ if [ -n "${{ github.event.pull_request.head.repo.full_name }}" ] && \
191
+ [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
192
+ echo "::notice::Processing PR from fork - using tokenless upload with branch override."
193
+ cc_args+=(--branch "${{ github.event.pull_request.head.label }}")
194
+ else
195
+ echo "::notice::Processing internal PR or push - using token."
196
+ cc_args+=(--token "${{ secrets.CODECOV_TOKEN }}")
197
+ fi
198
+
199
+ # Upload reports for each changed plugin
200
+ for PLUGIN in ${{ steps.changed-plugins.outputs.all_changed_plugins }}; do
201
+ echo "::group::Uploading coverage for plugin: $PLUGIN"
202
+ ./codecov upload-coverage "${cc_args[@]}" \
203
+ --file ./single-site-reports/coverage-$PLUGIN.xml \
204
+ --file ./multisite-reports/coverage-multisite-$PLUGIN.xml \
205
+ --flag $PLUGIN \
206
+ --name $PLUGIN-coverage
207
+ echo "::endgroup::"
208
+ done
0 commit comments