Skip to content

Commit 7ae0d43

Browse files
committed
ci(cron-conda): gate conda-tag and conda-dist on a dev-release version (#2458)
Mirror create-release.yml's #2452 dev-release gate in cron-conda.yml, which has its own independent, schedule/workflow_run-reachable route to publishing with no check against __version__ carrying a PEP 440 .devN suffix. - conda-update's Get Version step computes PCAPKIT_DEV_RELEASE from packaging.version.Version(...).is_devrelease, deliberately not is_prerelease, which is also true for a real alpha/beta/rc this project has shipped and must not block. - conda-tag's `if:` adds the clause as a top-level conjunct; conda-dist's adds it inside its publishing branch only, so a build-only manual run still builds and smoke-tests a dev version without uploading it. - tests/project/test_conda_dev_release_gate_2458.py: text and behavioural checks over both jobs' `if:`, and the step script run directly against a 1.5.0b14 (real beta) vs 1.6.0.dev3 (dev) stub to show PCAPKIT_DEV_RELEASE and is_prerelease actually disagree. actionlint 1.7.12 (shellcheck 0.10.0): zero findings. New test file: 13 passed, 20 subtests passed, and verified to fail without the workflow change. tests/project/test_release_gates.py and every other conda-* test still pass unmodified (127 passed/451 subtests; 386 passed across the conda+release_gate filter).
1 parent 895b591 commit 7ae0d43

2 files changed

Lines changed: 354 additions & 2 deletions

File tree

‎.github/workflows/cron-conda.yml‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ jobs:
322322
esac
323323
324324
# A build-only run builds whether or not anything changed.
325+
#
326+
# #2458: `PCAPKIT_DEV_RELEASE` is `is_devrelease`, not `is_prerelease` --
327+
# the latter is also `true` for a deliberately-tagged alpha/beta/rc this
328+
# project has shipped for real (e.g. 1.5.0b14), and gating on it would
329+
# silently block one. `is_devrelease` is `true` only for a PEP 440
330+
# dev-release suffix (X.Y.Z.devN), the work-in-progress signal `conda-tag`
331+
# and `conda-dist` read below so that a scheduled or `workflow_run`
332+
# trigger never tags or uploads a dev version with no human in the path.
333+
# Independent of create-release.yml's own `PCAPKIT_DEV_RELEASE`
334+
# (`version_check`'s): this workflow has no `version_check` job to share
335+
# it with, so it is computed here too.
325336
- name: Get Version
326337
if: steps.bump.outputs.bump == 'true' || needs.mode.outputs.publishes != 'true'
327338
id: get_version
@@ -330,6 +341,7 @@ jobs:
330341
331342
{
332343
echo "PCAPKIT_VERSION=$(python -c 'import pcapkit; print(pcapkit.__version__)')"
344+
echo "PCAPKIT_DEV_RELEASE=$(python -c 'from packaging.version import Version; import pcapkit; print(str(Version(pcapkit.__version__).is_devrelease).lower())')"
333345
echo "PCAPKIT_CONDA_LABEL=$(python -c 'from packaging.version import Version; import pcapkit; print("dev" if Version(pcapkit.__version__).is_prerelease else "main")')"
334346
echo "PCAPKIT_BUILD=$(cat conda/build)"
335347
} >> "$GITHUB_OUTPUT"
@@ -432,6 +444,9 @@ jobs:
432444
# The commit Push Changes put on `main`, and the one `conda-tag` tags.
433445
CONDA_COMMIT: ${{ steps.push-changes.outputs.commit }}
434446
PCAPKIT_VERSION: ${{ steps.get_version.outputs.PCAPKIT_VERSION }}
447+
# #2458: read by `conda-tag` and `conda-dist` below, to block tagging and
448+
# uploading a dev-release version.
449+
PCAPKIT_DEV_RELEASE: ${{ steps.get_version.outputs.PCAPKIT_DEV_RELEASE }}
435450
PCAPKIT_CONDA_LABEL: ${{ steps.get_version.outputs.PCAPKIT_CONDA_LABEL }}
436451
PCAPKIT_BUILD: ${{ steps.get_version.outputs.PCAPKIT_BUILD }}
437452
PYTHON_CONDA: ${{ steps.python-versions.outputs.conda }}
@@ -462,10 +477,16 @@ jobs:
462477
# outputs, is never tagged. Same shape as create-release.yml's `tag` job.
463478
#
464479
# Never on a build-only run, which pushed nothing to tag.
480+
#
481+
# #2458: nor on a dev-release version (`__version__` carrying a PEP 440
482+
# `.devN` suffix) -- a scheduled run or the `workflow_run` trigger above is
483+
# enough to reach this job with no human in the path, as for
484+
# create-release.yml's publishers.
465485
if: >-
466486
!cancelled() && needs.mode.outputs.publishes == 'true' &&
467487
needs.conda-update.result == 'success' &&
468-
needs.conda-update.outputs.CONDA_CHANGED == 'true'
488+
needs.conda-update.outputs.CONDA_CHANGED == 'true' &&
489+
needs.conda-update.outputs.PCAPKIT_DEV_RELEASE != 'true'
469490
permissions:
470491
contents: write
471492
steps:
@@ -533,11 +554,20 @@ jobs:
533554
# pins the tag, which names the pushed commit only then, and `conda-tag`
534555
# skips only when no bump was pushed. A build-only run, which never tags,
535556
# builds the dispatched commit with `conda-update`'s changes applied.
557+
#
558+
# #2458: the dev-release check is checked again here, inside the
559+
# publishing branch only, so a build-only run still builds and
560+
# smoke-tests a dev version -- it uploads nothing regardless. On the
561+
# publishing path it is also redundant with `conda-tag`'s own gate, which
562+
# already leaves `needs.conda-tag.result` at `'skipped'` rather than
563+
# `'success'`; kept explicit anyway, as create-release.yml's publishers
564+
# each read it rather than relying on one another's cascade.
536565
if: >-
537566
!cancelled() && needs.conda-update.result == 'success' &&
538567
(needs.mode.outputs.publishes != 'true' || (
539568
needs.conda-tag.result == 'success' &&
540-
needs.conda-update.outputs.CONDA_CHANGED == 'true'
569+
needs.conda-update.outputs.CONDA_CHANGED == 'true' &&
570+
needs.conda-update.outputs.PCAPKIT_DEV_RELEASE != 'true'
541571
))
542572
permissions:
543573
contents: write

0 commit comments

Comments
 (0)