specifying the codecov dir in the build file #235
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pytorch-widedeep | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
codestyle: | ||
# ... (keep the codestyle job as is) | ||
test: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: [3.10"] | ||
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/models --cov-report xml:$COVERAGE_DIR/coverage.xml --cov-report term --disable-pytest-warnings --cov=pytorch_widedeep/models tests/test_model_functioning --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 |