Skip to content

reuse lint complains about files declared in .gitignore in GitHub CI #1149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
danit-niwattananan-personal opened this issue Mar 13, 2025 · 0 comments

Comments

@danit-niwattananan-personal

I am writing a github-actions.yml file to deploy a CI pipeline to test and build my code. One of the tests I run is uv run python -m reuse lint to check the code licenses in my repo. On my local repo, this commands runs fine and only inspect the files not declared in the .gitignore file. But when it is deployed on GitHub Actions, it inspects artifacts, cache files, and files in Python .venv even though I have declared them in the .gitignore file.

The weird thing is that when I tried my pipeline using Gitlab instead, it didn't have any problem at all. I tried solving this by overriding all files in those folders inside the REUSE.toml file, but that didn't work.

Does anyone know why this happens, even though the doc said that the files declared in .gitignore wouldn't be checked?

Here are some of the errors:

 '0BSD' found in:
* /__w/sensorium_ssc/sensorium_ssc/.uv_cache/archive-v0/NJ5KClVwQ7p2VFiCK_K4g/mypyc/lib-rt/pythoncapi_compat.h
* /__w/sensorium_ssc/sensorium_ssc/.venv/lib/python3.10/site-packages/mypyc/lib-rt/pythoncapi_compat.h
'BSD-2-Clause' found in:
* /__w/sensorium_ssc/sensorium_ssc/.uv_cache/archive-v0/YkhwO4bnZE5GchuE62ERD/boolean/__init__.py
* /__w/sensorium_ssc/sensorium_ssc/.uv_cache/archive-v0/YkhwO4bnZE5GchuE62ERD/boolean/boolean.py
* /__w/sensorium_ssc/sensorium_ssc/.uv_cache/archive-v0/YkhwO4bnZE5GchuE62ERD/boolean/test_boolean.py
* ...
* # MISSING COPYRIGHT AND LICENSING INFORMATION

The following files have no copyright and licensing information:
* /__w/sensorium_ssc/sensorium_ssc/src/sensorium.egg-info/PKG-INFO
* /__w/sensorium_ssc/sensorium_ssc/src/sensorium.egg-info/SOURCES.txt

Here is my github-actions.yml file:

name: CI

on:
  push:
  pull_request:

env:
  IMAGE: "ghcr.io/astral-sh/uv:python3.12-bookworm"

jobs:
  test:
    runs-on: ubuntu-latest
    container: "ghcr.io/astral-sh/uv:python3.12-bookworm"
    
    env:
      QT_QPA_PLATFORM: "offscreen"
      MYPY_CACHE_DIR: ${{ github.workspace }}/.mypy_cache
      UV_CACHE_DIR: ${{ github.workspace }}/.uv_cache

    steps:
      - uses: actions/checkout@v4

      - name: Check REUSE License compliance
        run: uv run python -m reuse lint

      - name: Cache dependencies
        uses: actions/cache@v4
        with:
          path: |
            .mypy_cache
            .uv_cache
          key: ${{ runner.os }}-checks-${{ hashFiles('**/pyproject.toml') }}
          restore-keys: |
            ${{ runner.os }}-checks-

      - name: Install system dependencies
        run: |
          apt-get update && apt-get install -y libdbus-1-3 libegl1 libgl1 libxkbcommon0

      - name: Install Python dependencies
        run: uv sync

      - name: Run tests
        run: uv run python -m pytest --cov --cov-report=term --cov-report=xml --junit-xml=report.xml

      - name: Run type checking
        run: uv run python -m mypy --no-error-summary docs src tests

      - name: Run Ruff checks
        run: |
          uv run python -m ruff check docs src tests
          uv run python -m ruff format --diff docs src tests

      - name: Build documentation
        run: uv run sphinx-build docs public

      - name: Upload documentation
        uses: actions/upload-artifact@v4
        with:
          name: documentation
          path: public

      - name: Upload test results
        uses: actions/upload-artifact@v4
        with:
          name: test-results
          path: report.xml

      - name: Upload coverage reports
        uses: codecov/codecov-action@v4
        with:
          file: ./coverage.xml
          fail_ci_if_error: true

  build:
    needs: test
    runs-on: ubuntu-latest
    container: "ghcr.io/astral-sh/uv:python3.12-bookworm"

    steps:
      - uses: actions/checkout@v4

      - name: Cache dependencies
        uses: actions/cache@v4
        with:
          path: |
            .mypy_cache
            .uv_cache
          key: ${{ runner.os }}-checks-${{ hashFiles('**/pyproject.toml') }}
          restore-keys: |
            ${{ runner.os }}-checks-

      - name: Install dependencies
        run: uv sync

      - name: Build package
        run: uv build

      - name: Upload build artifacts
        uses: actions/upload-artifact@v4
        with:
          name: dist
          path: dist

And here is my .gitignore:

*.py[co]
*.egg-info/
__pycache__/

/public/

/.coverage
/coverage.xml
/report.xml

.DS_Store
*.sw[op]
/.vscode

.reuse/
.uv_cache/
.mypy_cache/
.venv/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant