CI doesn't run on PRs into feature branches, so fixes are only tested after they merge

Aperta Adatta ai principianti
#461 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Leggi .github/workflows/ci.yml e controlla le impostazioni esistenti di push, pull_request e della concorrenza. Aggiorna il trigger della pull request in modo che CI venga eseguito per ogni branch di base, mentre i push restano limitati a master; lascia azure-deploy.yml invariato. Il lavoro è terminato quando i controlli di questa PR mostrano i quattro job delle versioni di Python, come descritto nell’issue.

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

Descrizione

bug

Problem

.github/workflows/ci.yml (lint plus pytest on Python 3.11–3.14) triggers only on:

on:
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]

Release work happens on a feature branch (feat/pi-version-1-8-0), and fix PRs target that branch: 41 PRs have merged into it so far. Because those PRs don't target master, CI never runs on them. #456, #458 and #460, for example, show no checks at all, only CodeQL.

CI does check the feature branch indirectly, through the open release PR #433 (feat/pi-version-1-8-0 → master). Each merge into the feature branch updates #433, which starts a pull_request run. So each fix gets tested only after it has merged:

  • A fix PR that breaks lint, breaks a test, or fails on a Python version the developer didn't test locally is merged anyway. The failure first shows up on #433, which is then red for every later fix until someone pushes a fix.
  • Reviewers of a fix PR have no CI result to go on.
  • A change to ci.yml itself, such as #460 adding scripts to the lint step, can't be tested on its own PR.

Local pre-commit (ruff plus pytest on one Python version) is the only check before a merge, and it's opt-in per machine. It doesn't cover the 3.11–3.14 matrix.

Expected

Every PR runs CI before it merges, whatever its base branch.

Suggested fix

Run CI on pull requests to any branch, and keep pushes limited to master:

on:
  push:
    branches: ["master"]
  pull_request:

Leaving out branches: under pull_request covers every base branch. Alternatively, list the patterns: branches: ["master", "feat/**", "fix/**", "release/**"].

Things to check:

  • Concurrency: the group ${{ github.workflow }}-${{ github.ref }} is per PR ref (refs/pull/N/merge), so fix PRs don't cancel each other or #433's runs.
  • Cost: each fix PR adds one 4-version matrix run, about 30 s of tests per job. Pushes to feature branches still don't trigger a run, so this doesn't double up with #433.
  • azure-deploy.yml: it triggers on push to master and workflow_dispatch only, and should stay that way.
  • Verifying: the PR that makes this change targets feat/pi-version-1-8-0 and is the first fix PR to run CI under the new trigger. Its checks list should show the four Python 3.x jobs.

Optional, separate decision

The repository ruleset (default) targets only the default branch and has no required status check. So even on master, a red CI run doesn't block a merge (CodeQL is enforced through the code_scanning rule). Making the Python 3.x jobs required, on master and on release feature branches if the ruleset is extended to them, would make CI a gate rather than a signal. That needs repo admin settings, not a code change.

Out of scope

  • Changing the Python matrix or the test command.
  • Adding ruff format --check to CI. Pre-commit runs it, CI doesn't.
Lingua principale
Python
Stelle
7
Fork
2
Merge medio
3h 41m
PR unite (30g)
59

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 pendingintent/soa-workbench

Tutte le issue di pendingintent/soa-workbench

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.