diff --git a/.github/.codecov.yml b/.github/.codecov.yml new file mode 100644 index 0000000000..58eb17c48b --- /dev/null +++ b/.github/.codecov.yml @@ -0,0 +1,30 @@ +#=============================================================================== +# Copyright contributors to the oneDAL project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#=============================================================================== +coverage: + status: + project: + default: + target: 0 + # Set targets to zero so that it will always stay green. Also leave + # information on thresholds so that future coverage percentage + # enforcement can be easily implemented by only adjusting the threshold + # and setting target: auto. + # threshold: 50 + patch: + default: + target: 0 + # Allow for diffs to have no code coverage. + # threshold: 50 diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index d50d4955a2..7840bcc524 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -23,10 +23,6 @@ on: permissions: read-all -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref_name }}-${{ github.event.number || github.sha }} - cancel-in-progress: true - jobs: upload_coverage: name: Codecov @@ -50,9 +46,18 @@ jobs: chmod +x codecov - name: Upload to codecov run: | - export PR=${{ github.event.workflow_run.pull_requests[0].number }} - export SHA=${{ github.event.workflow_run.head_sha }} - export VARARGS="-n github" - # if a PR, pass proper information to codecov about SHA and PR, otherwise use main branch info - if [ -n "${PR}" ]; then export VARARGS="${VARARGS}-${PR}-${SHA} -P ${PR} -C ${SHA}"; fi + # github's webhooks for workflow_run are unreliable, this guarantees to pull the PR number if a PR + OWNER="${FULL_NAME%/$NAME}" + if [ "${{ github.repository_owner }}" != "${OWNER}" ]; then BRANCH="${OWNER}:${BRANCH}"; fi + if [ $(git branch --show-current) != $BRANCH ]; then PR=$(gh pr view $BRANCH --json number -q .number); fi + echo uploading $BRANCH + SHA=${{ github.event.workflow_run.head_sha }} + VARARGS="-C ${SHA} -n github-${SHA}" + # if a PR, pass proper information to codecov-cli about the PR number + if [ -n "${PR}" ]; then VARARGS="${VARARGS}-${PR} -P ${PR}"; fi ./codecov -v upload-process -Z -t ${{ secrets.CODECOV_TOKEN }} $VARARGS -F github -s ./coverage + env: + GH_TOKEN: ${{ github.token }} + BRANCH: ${{ github.event.workflow_run.head_branch }} + NAME: ${{ github.event.workflow_run.head_repository.name }} + FULL_NAME: ${{ github.event.workflow_run.head_repository.full_name }}