Skip to content

[bug] Not finding and uploading codecov files #620

@jrzaurin

Description

@jrzaurin

What happened?

It might not be a bug and maybe more an issue with myself, but at this point I do not know what else to try

This is the look of the test and finish steps in my build.yaml file

  test:
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
    strategy:
      fail-fast: true
      matrix:
        python-version: ["3.9", "3.10", "3.11"]
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install pytest-cov codecov faker
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    - name: Test with pytest
      run: |
        pytest --doctest-modules pytorch_widedeep --cov-report xml --cov-report term --disable-pytest-warnings --cov=pytorch_widedeep tests/
    - name: Upload coverage
      uses: actions/upload-artifact@v4
      with:
        name: coverage${{ matrix.python-version }}
        path: .coverage

  finish:
    needs: test
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python 3.10
      uses: actions/setup-python@v5
      with:
        python-version: "3.10"
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install coverage
    - name: Download all artifacts
      # Downloads coverage1, coverage2, etc.
      uses: actions/download-artifact@v4
    - name: Convert coverage
      run: |
        coverage combine coverage*/.coverage*
        coverage report --fail-under=90
        coverage xml
    - name: upload coverage to Codecov
      uses: codecov/codecov-action@v4
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        fail_ci_if_error: true

This has worked for me until now, that when I run I get the error shown in the screen capture, no files are found in the provided path. Here are the two screen captures that are relevant

Screenshot 2024-09-24 at 12 37 57 Screenshot 2024-09-24 at 12 39 13

What did you expect to happen?

Files are uploaded and downloaded and coverage reported for the library

How can we reproduce it?

I guess the only way would be to fork the library, open a branch and a corresponding PR. If anyone does that I would suggest testing only one python version and one test folder

Anything else we need to know?

I have tried a number of things

  1. downgrading to v3 (actions/upload-artifact@v3 and actions/download-artifact@v4
  2. I placed a debug step and found that no files were found in the specified path. So nothing was uploaded (and therefore downloaded). I then specified the data_file field in the .coveragerc file, but obtained the same result
  3. Finally I have tried this:
name: pytorch-widedeep

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  codestyle:
    # ..

  test:
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
    strategy:
      fail-fast: true
      matrix:
        python-version: ["3.9", "3.10", "3.11"]
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install pytest-cov codecov faker
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    - name: Set coverage directory
      run: echo "COVERAGE_DIR=./coverage_data" >> $GITHUB_ENV
    - name: Test with pytest
      run: |
        mkdir -p $COVERAGE_DIR
        pytest --doctest-modules pytorch_widedeep --cov-report xml:$COVERAGE_DIR/coverage.xml --cov-report term --disable-pytest-warnings --cov=pytorch_widedeep tests/ --cov-config=.coveragerc
    - name: Debug - List files
      run: |
        echo "Contents of the current directory:"
        ls -la
        echo "Contents of the coverage directory:"
        ls -la $COVERAGE_DIR
    - name: Upload coverage
      uses: actions/upload-artifact@v4
      with:
        name: coverage-${{ matrix.python-version }}
        path: ${{ env.COVERAGE_DIR }}
        if-no-files-found: error

  finish: 
    needs: test
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python 3.10
      uses: actions/setup-python@v5
      with:
        python-version: "3.10"
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install coverage
    - name: Download all artifacts
      uses: actions/download-artifact@v4
      with:
        path: coverage-files
    - name: Debug - List downloaded files
      run: |
        echo "Contents of the coverage-files directory:"
        ls -R coverage-files
    - name: Convert coverage
      run: |
        coverage combine coverage-files/*/.coverage
        coverage xml
        coverage report --fail-under=90
    - name: upload coverage to Codecov
      uses: codecov/codecov-action@v4
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        fail_ci_if_error: true

which did not work either and exited in the line

if-no-files-found: error

again saying no files have been found.

At this point, any help is appreciated

What version of the action are you using?

v4

What are your runner environments?

linux

Are you on GitHub Enterprise Server? If so, what version?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions