Skip to content

Commit

Permalink
[CI, Enhancement] Add Codecov support (#2222)
Browse files Browse the repository at this point in the history
* Update ci.yml

* Update ci.yml

* Create codecov.yml

* Update codecov.yml

* Update codecov.yml

* Update codecov.yml

* Update codecov.yml

* Update ci.yml

* Update codecov.yml

* Update codecov.yml

* Update codecov.yml

* Update codecov.yml

* Update codecov.yml
  • Loading branch information
icfaust authored Dec 12, 2024
1 parent 01acae2 commit 7743060
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,16 @@ jobs:
export COVERAGE_FILE=$(pwd)/.coverage.sklearn
if [ "${{ steps.set-env.outputs.DPCFLAG }}" == "" ]; then export CPU=cpu; fi
bash .ci/scripts/run_sklearn_tests.sh $CPU
- name: Archive coverage data
- name: Create coverage report
run: |
source venv/bin/activate
coverage combine .coverage.sklearnex .coverage.sklearn
coverage json -o coverage.lnx${{ matrix.PYTHON_VERSION }}_${{ matrix.SKLEARN_VERSION }}.json
- name: Archive coverage report
uses: actions/upload-artifact@v4
with:
name: coverage_lnx_Py${{ matrix.PYTHON_VERSION }}_${{ matrix.SKLEARN_VERSION }}
path: |
.coverage.sklearn
.coverage.sklearnex
include-hidden-files: true
path: coverage.lnx${{ matrix.PYTHON_VERSION }}_${{ matrix.SKLEARN_VERSION }}.json
- name: Sklearn testing [preview]
run: |
source venv/bin/activate
Expand Down Expand Up @@ -282,14 +284,17 @@ jobs:
set COVERAGE_FILE=%cd%\.coverage.sklearn
if "${{ steps.set-env.outputs.DPCFLAG }}"=="" set CPU=cpu
bash .ci/scripts/run_sklearn_tests.sh %CPU%
- name: Archive coverage data
- name: Create coverage report
shell: cmd
run: |
call .\venv\Scripts\activate.bat
coverage combine .coverage.sklearnex .coverage.sklearn
coverage json -o coverage.win${{ matrix.PYTHON_VERSION }}_${{ matrix.SKLEARN_VERSION }}.json
- name: Archive coverage report
uses: actions/upload-artifact@v4
with:
name: coverage_win_Py${{ matrix.PYTHON_VERSION }}_${{ matrix.SKLEARN_VERSION }}
path: |
.coverage.sklearn
.coverage.sklearnex
include-hidden-files: true
path: coverage.win${{ matrix.PYTHON_VERSION }}_${{ matrix.SKLEARN_VERSION }}.json
- name: Sklearn testing [preview]
shell: cmd
run: |
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#===============================================================================
# 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.
#===============================================================================

name: codecov
on:
workflow_run:
workflows: [CI]
types:
- completed

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
runs-on: ubuntu-24.04
if: ${{ github.repository == 'uxlfoundation/scikit-learn-intelex' && github.event.workflow_run.conclusion == 'success' }}
timeout-minutes: 5

steps:
- name: Checkout Scikit-learn-intelex
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: coverage
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
merge-multiple: true
- name: Install codecov cli
run: |
curl -Os https://cli.codecov.io/latest/linux/codecov
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
./codecov -v upload-process -Z -t ${{ secrets.CODECOV_TOKEN }} $VARARGS -F github -s ./coverage

0 comments on commit 7743060

Please sign in to comment.