mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
ci: fix codecov upload for forks (#5240)
* ci: fix codecov upload for forks * Remove 'fail-on-error' flag from CC_FLAGS
This commit is contained in:
@@ -108,14 +108,38 @@ jobs:
|
||||
shasum -a 256 -c codecov.SHA256SUM
|
||||
sudo chmod +x codecov
|
||||
- name: Upload coverage report to codecov
|
||||
shell: bash
|
||||
run: |
|
||||
CC_FLAGS="--disable-search --git-service github"
|
||||
|
||||
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
|
||||
CC_FLAGS+=" --sha ${{ github.event.pull_request.head.sha }}"
|
||||
fi
|
||||
|
||||
if [ -n "${{ github.event.pull_request.head.repo.full_name }}" ] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ];
|
||||
then
|
||||
echo "Fork detected"
|
||||
CC_FLAGS+=" --branch ${{ github.event.pull_request.head.label }} --pr ${{ github.event.number }}"
|
||||
fi
|
||||
|
||||
CC_TOKEN=""
|
||||
CC_LOG_TOKEN=""
|
||||
if [ -n "${{ secrets.CODECOV_TOKEN }}" ]; then
|
||||
echo "CODECOV_TOKEN is set, adding to codecov upload-process command"
|
||||
CC_TOKEN+=" --token ${{ secrets.CODECOV_TOKEN }}"
|
||||
CC_LOG_TOKEN+=" --token ***"
|
||||
fi
|
||||
|
||||
find packages/ -name "lcov.info" -type f | awk -F'/' '{ print $2 }' | while read -r package; do
|
||||
sed -i "s|SF:src|SF:packages/${package}/src|g" "packages/$package/coverage/lcov.info"
|
||||
|
||||
CC_FLAGS+=" --file packages/$package/coverage/lcov.info --flag $package-unit --flag $package"
|
||||
|
||||
|
||||
echo "Uploading $package converage/lcov.info file"
|
||||
./codecov upload-process --disable-search --token ${{ secrets.CODECOV_TOKEN }} \
|
||||
--fail-on-error --git-service github --sha $(git rev-parse HEAD) \
|
||||
--file packages/$package/coverage/lcov.info --flag $package-unit --flag $package
|
||||
echo "Running \"./codecov upload-process $CC_LOG_TOKEN $CC_FLAGS\""
|
||||
|
||||
./codecov upload-process $CC_TOKEN $CC_FLAGS
|
||||
done
|
||||
|
||||
unit-tests-deno:
|
||||
@@ -186,14 +210,38 @@ jobs:
|
||||
shasum -a 256 -c codecov.SHA256SUM
|
||||
sudo chmod +x codecov
|
||||
- name: Upload coverage report to codecov
|
||||
shell: bash
|
||||
run: |
|
||||
CC_FLAGS="--disable-search --git-service github"
|
||||
|
||||
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
|
||||
CC_FLAGS+=" --sha ${{ github.event.pull_request.head.sha }}"
|
||||
fi
|
||||
|
||||
if [ -n "${{ github.event.pull_request.head.repo.full_name }}" ] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ];
|
||||
then
|
||||
echo "Fork detected"
|
||||
CC_FLAGS+=" --branch ${{ github.event.pull_request.head.label }} --pr ${{ github.event.number }}"
|
||||
fi
|
||||
|
||||
CC_TOKEN=""
|
||||
CC_LOG_TOKEN=""
|
||||
if [ -n "${{ secrets.CODECOV_TOKEN }}" ]; then
|
||||
echo "CODECOV_TOKEN is set, adding to codecov upload-process command"
|
||||
CC_TOKEN+=" --token ${{ secrets.CODECOV_TOKEN }}"
|
||||
CC_LOG_TOKEN+=" --token ***"
|
||||
fi
|
||||
|
||||
find packages/ -name "lcov.info" -type f | awk -F'/' '{ print $2 }' | while read -r package; do
|
||||
sed -i "s|SF:src|SF:packages/${package}/src|g" "packages/$package/coverage/lcov.info"
|
||||
|
||||
CC_FLAGS+=" --file packages/$package/coverage/lcov.info --flag $package-integration --flag $package"
|
||||
|
||||
|
||||
echo "Uploading $package converage/lcov.info file"
|
||||
./codecov upload-process --disable-search --token ${{ secrets.CODECOV_TOKEN }} \
|
||||
--fail-on-error --git-service github --sha $(git rev-parse HEAD) \
|
||||
--file packages/$package/coverage/lcov.info --flag $package-integration --flag $package
|
||||
echo "Running \"./codecov upload-process $CC_LOG_TOKEN $CC_FLAGS\""
|
||||
|
||||
./codecov upload-process $CC_TOKEN $CC_FLAGS
|
||||
done
|
||||
|
||||
e2e-tests:
|
||||
@@ -231,12 +279,36 @@ jobs:
|
||||
shasum -a 256 -c codecov.SHA256SUM
|
||||
sudo chmod +x codecov
|
||||
- name: Upload coverage report to codecov
|
||||
shell: bash
|
||||
run: |
|
||||
CC_FLAGS="--disable-search --git-service github"
|
||||
|
||||
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
|
||||
CC_FLAGS+=" --sha ${{ github.event.pull_request.head.sha }}"
|
||||
fi
|
||||
|
||||
if [ -n "${{ github.event.pull_request.head.repo.full_name }}" ] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ];
|
||||
then
|
||||
echo "Fork detected"
|
||||
CC_FLAGS+=" --branch ${{ github.event.pull_request.head.label }} --pr ${{ github.event.number }}"
|
||||
fi
|
||||
|
||||
CC_TOKEN=""
|
||||
CC_LOG_TOKEN=""
|
||||
if [ -n "${{ secrets.CODECOV_TOKEN }}" ]; then
|
||||
echo "CODECOV_TOKEN is set, adding to codecov upload-process command"
|
||||
CC_TOKEN+=" --token ${{ secrets.CODECOV_TOKEN }}"
|
||||
CC_LOG_TOKEN+=" --token ***"
|
||||
fi
|
||||
|
||||
find packages/ -name "lcov.info" -type f | awk -F'/' '{ print $2 }' | while read -r package; do
|
||||
sed -i "s|SF:src|SF:packages/${package}/src|g" "packages/$package/coverage/lcov.info"
|
||||
|
||||
CC_FLAGS+=" --file packages/$package/coverage/lcov.info --flag $package-e2e --flag $package"
|
||||
|
||||
|
||||
echo "Uploading $package converage/lcov.info file"
|
||||
./codecov upload-process --disable-search --token ${{ secrets.CODECOV_TOKEN }} \
|
||||
--fail-on-error --git-service github --sha $(git rev-parse HEAD) \
|
||||
--file packages/$package/coverage/lcov.info --flag $package-e2e --flag $package
|
||||
echo "Running \"./codecov upload-process $CC_LOG_TOKEN $CC_FLAGS\""
|
||||
|
||||
./codecov upload-process $CC_TOKEN $CC_FLAGS
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user