Enable branch coverage, upload test results and use Codecov OIDC

Aperta
#1,611 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@yamilmaud ci sta già lavorando.

Dal 27/11/2026.

  • #1612 di @yamilmaud — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
github-actions, python
Ambito
ci-cd, testing-qa

Direzione di ricerca

The change touches pyproject.toml ([tool.coverage.run]), tox.ini ([testenv] pytest call), .github/workflows/main.yml (the codecov-action steps and job permissions), and a new .codecov.yml. Start by reading the workflow and the tox config, then check the reference pattern in scrapinghub/andi. Done means the four checks pass, but open PR #1612 already covers this work, so review it rather than starting a new change.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

dateparser is currently missing four checks tracked by the Zyte OSS maintenance report:

  • codecov-test-results: no codecov/codecov-action step with report_type: test_results
  • codecov-auth: expected OIDC, found a token in .github/workflows/main.yml
  • codecov-status: no Codecov config file
  • branch-coverage: no branch = true in coverage config, and no --cov-branch

Proposed changes

  1. pyproject.toml: add branch = true under [tool.coverage.run].
  2. tox.ini: add --junitxml=testenv.junit.xml -o junit_family=legacy to the pytest invocation in [testenv], so a JUnit XML report is produced to upload.
  3. New .codecov.yml: disable the patch status and set the project status target to the current coverage (not 100%, since dateparser's coverage isn't there yet), e.g.:
    coverage:
      status:
        project:
          default:
            target: <current coverage>%
        patch: false
    
  4. .github/workflows/main.yml:
    • add id-token: write to the job's permissions (needed for OIDC)
    • replace the token-based codecov/codecov-action step with one using use_oidc: true instead of token: ${{ secrets.CODECOV_TOKEN }}
    • add a second codecov/codecov-action step with report_type: test_results (and use_oidc: true) to upload the JUnit XML, gated on if: ${{ !cancelled() }}

scrapinghub/andi's .github/workflows/test.yml already implements this OIDC + test-results pattern for a sibling scrapinghub project and can be used as a reference. scrapy/cssselect#225 did the equivalent test-results + config-file work for a scrapy-org project (tokenless there, since OIDC is only required for the scrapinghub org).

Heads up

Open PR #1567 ("Support Python 3.11-3.15: drop 3.10, add 3.15") also modifies .github/workflows/main.yml, so expect a minor merge conflict between the two.

Lingua principale
Python
Stelle
2.9k
Fork
545
Merge medio
2g 4h
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di scrapinghub/dateparser

Tutte le issue di scrapinghub/dateparser

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.