Skip to content

Commit 27f36f9

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. - discussion's "Post the report to Discussions" step now tells "nothing pushed" apart from "a dev-release build was pushed but Tag/Upload were withheld on purpose", instead of silently dropping both lines; the stale "Both skip unless a build was pushed" comment is corrected. - Comments describing #2452's create-release.yml gate as already merged are reworded to "proposed ... (not yet merged)". - test_conda_dev_release_gate_2458.py gains two inputs (1.6.0rc1.dev2, 1.6.0.post1.dev0) that close two narrowed-predicate mutations a cross-review found surviving; test_cron_reports_2030.py gains coverage for the new report line. actionlint 1.7.12 (shellcheck 0.10.0): zero findings. Both test files: 55 passed, 118 subtests passed, including the new report and mutation-closing cases; pylint/mypy clean on the touched files (`pcapkit` itself is untouched, so neither applies per lint.yml's own invocation).
1 parent 895b591 commit 27f36f9

3 files changed

Lines changed: 401 additions & 3 deletions

File tree

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

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,18 @@ 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 the equivalent `PCAPKIT_DEV_RELEASE` gate proposed for
334+
# create-release.yml's `version_check` job in #2452 (not yet merged):
335+
# this workflow has no `version_check` job to share that output with,
336+
# so it is computed here too.
325337
- name: Get Version
326338
if: steps.bump.outputs.bump == 'true' || needs.mode.outputs.publishes != 'true'
327339
id: get_version
@@ -330,6 +342,7 @@ jobs:
330342
331343
{
332344
echo "PCAPKIT_VERSION=$(python -c 'import pcapkit; print(pcapkit.__version__)')"
345+
echo "PCAPKIT_DEV_RELEASE=$(python -c 'from packaging.version import Version; import pcapkit; print(str(Version(pcapkit.__version__).is_devrelease).lower())')"
333346
echo "PCAPKIT_CONDA_LABEL=$(python -c 'from packaging.version import Version; import pcapkit; print("dev" if Version(pcapkit.__version__).is_prerelease else "main")')"
334347
echo "PCAPKIT_BUILD=$(cat conda/build)"
335348
} >> "$GITHUB_OUTPUT"
@@ -432,6 +445,9 @@ jobs:
432445
# The commit Push Changes put on `main`, and the one `conda-tag` tags.
433446
CONDA_COMMIT: ${{ steps.push-changes.outputs.commit }}
434447
PCAPKIT_VERSION: ${{ steps.get_version.outputs.PCAPKIT_VERSION }}
448+
# #2458: read by `conda-tag` and `conda-dist` below, to block tagging and
449+
# uploading a dev-release version.
450+
PCAPKIT_DEV_RELEASE: ${{ steps.get_version.outputs.PCAPKIT_DEV_RELEASE }}
435451
PCAPKIT_CONDA_LABEL: ${{ steps.get_version.outputs.PCAPKIT_CONDA_LABEL }}
436452
PCAPKIT_BUILD: ${{ steps.get_version.outputs.PCAPKIT_BUILD }}
437453
PYTHON_CONDA: ${{ steps.python-versions.outputs.conda }}
@@ -462,10 +478,17 @@ jobs:
462478
# outputs, is never tagged. Same shape as create-release.yml's `tag` job.
463479
#
464480
# Never on a build-only run, which pushed nothing to tag.
481+
#
482+
# #2458: nor on a dev-release version (`__version__` carrying a PEP 440
483+
# `.devN` suffix) -- a scheduled run or the `workflow_run` trigger above is
484+
# enough to reach this job with no human in the path, which mirrors the
485+
# equivalent gate proposed for create-release.yml's publishers in #2452
486+
# (not yet merged).
465487
if: >-
466488
!cancelled() && needs.mode.outputs.publishes == 'true' &&
467489
needs.conda-update.result == 'success' &&
468-
needs.conda-update.outputs.CONDA_CHANGED == 'true'
490+
needs.conda-update.outputs.CONDA_CHANGED == 'true' &&
491+
needs.conda-update.outputs.PCAPKIT_DEV_RELEASE != 'true'
469492
permissions:
470493
contents: write
471494
steps:
@@ -533,11 +556,21 @@ jobs:
533556
# pins the tag, which names the pushed commit only then, and `conda-tag`
534557
# skips only when no bump was pushed. A build-only run, which never tags,
535558
# builds the dispatched commit with `conda-update`'s changes applied.
559+
#
560+
# #2458: the dev-release check is checked again here, inside the
561+
# publishing branch only, so a build-only run still builds and
562+
# smoke-tests a dev version -- it uploads nothing regardless. On the
563+
# publishing path it is also redundant with `conda-tag`'s own gate, which
564+
# already leaves `needs.conda-tag.result` at `'skipped'` rather than
565+
# `'success'`; kept explicit anyway, mirroring how the equivalent gate
566+
# proposed for create-release.yml's publishers in #2452 (not yet merged)
567+
# has each read it rather than relying on one another's cascade.
536568
if: >-
537569
!cancelled() && needs.conda-update.result == 'success' &&
538570
(needs.mode.outputs.publishes != 'true' || (
539571
needs.conda-tag.result == 'success' &&
540-
needs.conda-update.outputs.CONDA_CHANGED == 'true'
572+
needs.conda-update.outputs.CONDA_CHANGED == 'true' &&
573+
needs.conda-update.outputs.PCAPKIT_DEV_RELEASE != 'true'
541574
))
542575
permissions:
543576
contents: write
@@ -844,6 +877,11 @@ jobs:
844877
UPDATE_STATUS: ${{ needs.conda-update.outputs.status }}
845878
TAG_RESULT: ${{ needs.conda-tag.result }}
846879
DIST_RESULT: ${{ needs.conda-dist.result }}
880+
# #2458: needed to tell "skipped, nothing was pushed" apart from
881+
# "skipped, a build was pushed but it is a dev release" below.
882+
CONDA_CHANGED: ${{ needs.conda-update.outputs.CONDA_CHANGED }}
883+
DEV_RELEASE: ${{ needs.conda-update.outputs.PCAPKIT_DEV_RELEASE }}
884+
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }}
847885
run: |
848886
if [ "$UPDATE_RESULT" = skipped ]; then
849887
status="$HEAD_RESULT"
@@ -863,12 +901,19 @@ jobs:
863901
else
864902
status="${UPDATE_STATUS:-success}"
865903
fi
866-
# Both skip unless a build was pushed.
904+
# #2458: both used to skip only when nothing was pushed, so a
905+
# pushed build always carried Tag/Upload lines too. Now a pushed
906+
# dev-release build (`DEV_RELEASE` = 'true') also leaves both
907+
# skipped, on purpose, so that case gets its own explanatory line
908+
# below rather than silently dropping Tag/Upload with no reason
909+
# given.
867910
if [ "$TAG_RESULT" != skipped ] && [ -f report/conda-report.md ]; then
868911
{
869912
echo "- Tag: $TAG_RESULT"
870913
echo "- Upload: $DIST_RESULT"
871914
} >> report/conda-report.md
915+
elif [ "$CONDA_CHANGED" = true ] && [ "$DEV_RELEASE" = true ] && [ -f report/conda-report.md ]; then
916+
echo "- Tag: skipped, and Upload: skipped -- ${PCAPKIT_VERSION} carries a PEP 440 dev-release suffix (.devN), so PCAPKIT_DEV_RELEASE withheld both deliberately" >> report/conda-report.md
872917
fi
873918
fi
874919
python3 util/discussion_report.py --category "$REPORT_CATEGORY" \

0 commit comments

Comments
 (0)