Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
run: |
test -n "$PACKAGES_SHA256"
printf '%s\n' "$PACKAGES_SHA256" | sha256sum --check --strict
- name: Validate and create the GitHub prerelease
- name: Validate and create the GitHub release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ The manual release workflow publishes the branded packages to nuget.org, as
and [RunicArtifex.DynamicData.Reactive](https://www.nuget.org/packages/RunicArtifex.DynamicData.Reactive),
and records release notes in a [GitHub release](https://github.com/Runic-Artifex/DynamicData/releases);
it does not publish under upstream package names. Consume the fork from nuget.org,
for example `dotnet add package RunicArtifex.DynamicData --prerelease`. Earlier
for example `dotnet add package RunicArtifex.DynamicData` (add `--prerelease` for
a `-runic.N` build of `main`). Earlier
previews were only GitHub release assets, under the IDs `Runic.DynamicData` and
`Runic.DynamicData.Reactive`. This fork will not be proposed upstream.
2 changes: 1 addition & 1 deletion docs/fork-differences.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ entry `retired`. Upstream status is as last reviewed; open gaps are tracked as
| DD-033 | List observable filtering excludes initially false items and tracks occurrences. | #1039, #1044. | Open issues. |
| DD-034 | `Sort` emits one move for a single outlier. | Move amplification (#1066). | Open issue. |
| DD-036 | Monthly [upstream review](maintenance.md#monthly-upstream-review) as workflow artifact plus tracking issue. | Fork maintenance. | Fork only. |
| DD-037 | [Release guard](../eng/release/README.md) for immutable branded releases: a GitHub prerelease with the release notes, then a nuget.org push with trusted publishing from the `nuget` environment, guarded by keyless checks of the package glob, ID ownership and published contents. Authors `Roland Pheasant, Runic Artifex`, no `Owners`, and a title/description naming the fork are checked. | Fork distribution. | Fork only. |
| DD-037 | [Release guard](../eng/release/README.md) for immutable branded releases: a GitHub release (a prerelease for prerelease versions) with the release notes, then a nuget.org push with trusted publishing from the `nuget` environment, guarded by keyless checks of the package glob, ID ownership and published contents. Authors `Roland Pheasant, Runic Artifex`, no `Owners`, and a title/description naming the fork are checked. | Fork distribution. | Fork only. |
| DD-038 | [Packaged acceptance](../eng/acceptance/README.md) of the released package pair, managed and NativeAOT. | Fork distribution. | Fork only. |
| DD-039 | Lock-free cache `Watch`/`WatchValue`, `CountChanged` and `Preview` end with the source (and `Watch` on disposal); experimental `AsWatcher` ends watches with the source through its scheduler and subscribes to the source once. Ported ahead of a sync with `git cherry-pick -x`. | Lost completion and errors rethrown on the producer (#1142, fork issue [#5](https://github.com/Runic-Artifex/DynamicData/issues/5)). | Open PRs [#1205](https://github.com/reactivemarbles/DynamicData/pull/1205), [#1207](https://github.com/reactivemarbles/DynamicData/pull/1207). |
| DD-040 | `ObservableChangeSet.Create` overloads whose task returns nothing (cache and list) complete when the task completes, fail when it fails, cancel it on unsubscribe and deliver its outcome on the completing thread; the list cancellable overload connects before the task runs, so changes arrive as they happen. Observable `EditDiff` builds on them and forwards source errors raised after subscription. The Primitives flavour uses the internal `TaskBridge` for `FromAsync`/`ForEachAsync`. | Behaviour change: such streams used to stay open after the task and complete only on dispose ([#6](https://github.com/Runic-Artifex/DynamicData/issues/6), #1142). Ported ahead of a sync per the maintenance guide. | Open PR [#1206](https://github.com/reactivemarbles/DynamicData/pull/1206); at the next sync compare and drop the port if merged equivalently. |
Expand Down
10 changes: 7 additions & 3 deletions docs/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ free disk space before large local matrices.
The manual [release workflow](../.github/workflows/release.yml) builds, tests and
packs `main`, then the [release guard](../eng/release/README.md) requires a green
Build run at the same SHA and validates the `RunicArtifex.DynamicData` and
`RunicArtifex.DynamicData.Reactive` pair. It creates a prerelease GitHub release
with those assets and the release notes, then pushes the pair to nuget.org with
`RunicArtifex.DynamicData.Reactive` pair. It creates a GitHub release (a
prerelease for prerelease versions) with those assets and the release notes, then pushes the pair to nuget.org with
trusted publishing from the protected `nuget` environment, and finally waits up
to an hour until nuget.org lists both versions. Versions come from NBGV
(`version.json`): `10.0.0-runic.N` from `main`. Earlier previews were GitHub
(`version.json`) on `main`: a prerelease line such as `10.0-runic.{height}`
gives `10.0.0-runic.N`, and a stable release sets an exact version such as
`10.0.0` for the one release commit; the next commit moves `main` to the next
prerelease line (`10.1-runic.{height}` after `10.0.0`), so later pushes never
produce the released version again. `10.0.0` was the first stable release. Earlier previews were GitHub
release assets only, under the IDs `Runic.DynamicData` and
`Runic.DynamicData.Reactive`.

Expand Down
4 changes: 4 additions & 0 deletions eng/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ DynamicData for .NET 10.

## GitHub release

A prerelease version (one with a `-` label, such as `10.0.0-runic.118`) becomes
a GitHub prerelease; a stable version (such as `10.0.0`) becomes a regular
release. The draft's prerelease flag is checked before and after the upload.

The publish command refuses every existing tag or release,
creates a draft targeted at that SHA, uploads the exact two assets, downloads
them for byte comparison, creates and resolves a new non-force tag at that SHA,
Expand Down
33 changes: 21 additions & 12 deletions eng/release/release-assets.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# Validates the two branded packages and, only when requested by the manual
# GitHub workflow, creates an immutable prerelease from those exact bytes and
# GitHub workflow, creates an immutable GitHub release (a prerelease for
# prerelease versions) from those exact bytes and
# pushes them to nuget.org (eng/release/README.md).
set -euo pipefail

Expand Down Expand Up @@ -37,7 +38,8 @@ Usage: eng/release/release-assets.sh <command> <package-directory>
validate verifies the exact branded pair and its package metadata.
check also runs the read-only GitHub checks of publish (source, Build
run, absent tag and release) without creating anything.
publish additionally creates a draft GitHub prerelease, uploads and
publish additionally creates a draft GitHub release (a prerelease for
prerelease versions), uploads and
downloads the assets byte-for-byte, then publishes that draft.
nuget-check validates, then checks nuget.org with keyless lookups: package
globs, ID ownership and already published versions. Pushes nothing.
Expand Down Expand Up @@ -176,6 +178,8 @@ PY
}

PACKAGE_VERSION=''
# 'true' for a SemVer prerelease (a '-' before any build metadata), else 'false'.
RELEASE_PRERELEASE=''
PACKAGE_FILES=()

validate_packages() {
Expand Down Expand Up @@ -207,6 +211,11 @@ validate_packages() {
PACKAGE_VERSION="${PACKAGE_VERSION%.nupkg}"
[[ "$PACKAGE_VERSION" =~ $VERSION_PATTERN ]] ||
die "invalid package version in $base_package."
if [[ "${PACKAGE_VERSION%%+*}" == *-* ]]; then
RELEASE_PRERELEASE='true'
else
RELEASE_PRERELEASE='false'
fi

local expected_base="$PACKAGE_ID.$PACKAGE_VERSION.nupkg"
local expected_reactive="$REACTIVE_PACKAGE_ID.$PACKAGE_VERSION.nupkg"
Expand Down Expand Up @@ -430,19 +439,19 @@ read_release_assets() {
local package_two="$3"
local expected_sha="$4"

python3 - "$release_json" "$package_one" "$package_two" "$expected_sha" <<'PY'
python3 - "$release_json" "$package_one" "$package_two" "$expected_sha" "$RELEASE_PRERELEASE" <<'PY'
import json
import os
import sys

path, package_one, package_two, expected_sha = sys.argv[1:]
path, package_one, package_two, expected_sha, prerelease = sys.argv[1:]
with open(path, encoding='utf-8') as source:
release = json.load(source)

if release.get('draft') is not True:
raise SystemExit('release is not still a draft during asset verification')
if release.get('prerelease') is not True:
raise SystemExit('release is not marked prerelease')
if release.get('prerelease') is not (prerelease == 'true'):
raise SystemExit(f'release prerelease flag is not {prerelease}')
if release.get('target_commitish') != expected_sha:
raise SystemExit('draft release target does not match GITHUB_SHA')

Expand Down Expand Up @@ -477,20 +486,20 @@ create_draft() {
-f "target_commitish=$GITHUB_SHA" \
-f "name=$PACKAGE_VERSION" \
-F draft=true \
-F prerelease=true \
-F "prerelease=$RELEASE_PRERELEASE" \
-F generate_release_notes=true >"$draft_json"

python3 - "$draft_json" "$GITHUB_SHA" <<'PY'
python3 - "$draft_json" "$GITHUB_SHA" "$RELEASE_PRERELEASE" <<'PY'
import json
import sys

path, expected_sha = sys.argv[1:]
path, expected_sha, prerelease = sys.argv[1:]
with open(path, encoding='utf-8') as source:
draft = json.load(source)
if not isinstance(draft.get('id'), int):
raise SystemExit('GitHub did not return a draft release id')
if draft.get('draft') is not True or draft.get('prerelease') is not True:
raise SystemExit('GitHub did not create the expected prerelease draft')
if draft.get('draft') is not True or draft.get('prerelease') is not (prerelease == 'true'):
raise SystemExit(f'GitHub did not create the expected draft (prerelease {prerelease})')
if draft.get('target_commitish') != expected_sha:
raise SystemExit('draft release target does not match GITHUB_SHA')
print(draft['id'])
Expand Down Expand Up @@ -524,7 +533,7 @@ check_release() {
validate_packages "$1"
require_actions check
github_preflight
printf 'release-assets: GitHub prerelease v%s can be created.\n' "$PACKAGE_VERSION"
printf 'release-assets: GitHub release v%s (prerelease %s) can be created.\n' "$PACKAGE_VERSION" "$RELEASE_PRERELEASE"
}

publish_packages() {
Expand Down
24 changes: 20 additions & 4 deletions eng/release/test-release-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ fail() {
write_nuspec() {
local fixture="$1"
local output="$2"
local nuspec_version="${3:-$version}"
sed \
-e "s/@VERSION@/$version/g" \
-e "s/@VERSION@/$nuspec_version/g" \
-e "s|@REPOSITORY@|$repository|g" \
-e "s/@SHA@/$sha/g" \
"$fixture" >"$output"
Expand All @@ -41,7 +42,7 @@ make_package() {
local fixture="$4"
local stage="$scratch/stage-$RANDOM-$RANDOM"
mkdir -p "$stage"
write_nuspec "$fixture" "$stage/$package_id.nuspec"
write_nuspec "$fixture" "$stage/$package_id.nuspec" "${NUSPEC_VERSION:-$version}"
PACKAGE_ID="$package_id" PACKAGE_VERSION="$package_version" STAGE="$stage" DESTINATION="$destination" REPOSITORY_ROOT="$root" \
python3 - <<'PY'
import os
Expand Down Expand Up @@ -206,8 +207,23 @@ run_publish "$published" bash "$helper" publish "$valid"
[[ "$(cat "$published/tag")" == "$sha" ]] || fail 'publish did not create the tag at GITHUB_SHA'
[[ "$(find "$published/assets" -maxdepth 1 -type f -name '*.nupkg' | wc -l)" == '2' ]] ||
fail 'publish did not upload the exact package pair'

for malformed_draft in wrong-target missing-assets; do
[[ "$(cat "$published/prerelease")" == 'true' ]] || fail 'prerelease version was not published as a GitHub prerelease'

# A stable version (no prerelease label) becomes a regular GitHub release.
stable_valid="$scratch/stable-valid"
mkdir -p "$stable_valid"
NUSPEC_VERSION='10.0.0' make_package "$stable_valid" 'RunicArtifex.DynamicData' '10.0.0' "$fixtures/RunicArtifex.DynamicData.nuspec"
NUSPEC_VERSION='10.0.0' make_package "$stable_valid" 'RunicArtifex.DynamicData.Reactive' '10.0.0' "$fixtures/RunicArtifex.DynamicData.Reactive.nuspec"
stable_published="$scratch/stable-published"
mkdir -p "$stable_published"
run_publish "$stable_published" bash "$helper" publish "$stable_valid"
[[ -f "$stable_published/published" ]] || fail 'stable draft was not published'
[[ "$(cat "$stable_published/prerelease")" == 'false' ]] || fail 'stable version was published as a GitHub prerelease'
run_publish "$scratch/stable-check" bash "$helper" check "$stable_valid" >"$scratch/output" 2>&1 ||
{ cat "$scratch/output" >&2; fail 'stable GitHub dry-run check failed'; }
grep -qF 'v10.0.0 (prerelease false)' "$scratch/output" || fail 'stable dry-run check did not report a regular release'

for malformed_draft in wrong-target missing-assets flipped-prerelease; do
draft_failure="$scratch/draft-$malformed_draft"
mkdir -p "$draft_failure"
expect_failure "draft $malformed_draft" run_publish "$draft_failure" env MOCK_GH_DRAFT_STATE="$malformed_draft" bash "$helper" publish "$valid"
Expand Down
14 changes: 12 additions & 2 deletions eng/release/tests/mock-gh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ for index, name in enumerate(sorted(os.listdir(os.path.join(state, 'assets'))),
continue
path = os.path.join(state, 'assets', name)
assets.append({'id': index, 'name': name, 'size': os.path.getsize(path)})
print(json.dumps({'draft': True, 'prerelease': True, 'target_commitish': target, 'assets': assets}))
with open(os.path.join(state, 'prerelease'), encoding='utf-8') as source:
prerelease = source.read().strip() == 'true'
if os.environ.get('MOCK_GH_DRAFT_STATE') == 'flipped-prerelease':
prerelease = not prerelease
print(json.dumps({'draft': True, 'prerelease': prerelease, 'target_commitish': target, 'assets': assets}))
PY
exit 0
fi
Expand All @@ -124,14 +128,20 @@ PY
fi
if [[ "$endpoint" == *'/releases' && " $* " == *' --method POST '* ]]; then
target=''
prerelease=''
for argument in "$@"; do
if [[ "$argument" == target_commitish=* ]]; then
target="${argument#target_commitish=}"
fi
if [[ "$argument" == prerelease=* ]]; then
prerelease="${argument#prerelease=}"
fi
done
[[ -n "$target" ]] || exit 1
[[ "$prerelease" == 'true' || "$prerelease" == 'false' ]] || exit 1
printf '%s\n' "$target" >"$state_dir/release"
printf '{"id":1,"draft":true,"prerelease":true,"target_commitish":"%s"}\n' "$target"
printf '%s\n' "$prerelease" >"$state_dir/prerelease"
printf '{"id":1,"draft":true,"prerelease":%s,"target_commitish":"%s"}\n' "$prerelease" "$target"
exit 0
fi
if [[ "$endpoint" == *'/releases/1/assets?name='* ]]; then
Expand Down
4 changes: 2 additions & 2 deletions version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "10.0-runic.{height}",
"version": "10.0.0",
"publicReleaseRefSpec": [
"^refs/heads/main$", // main publishes pre-release packages
"^refs/heads/main$", // main publishes the version above: a -runic.{height} line or a stable release
"^refs/heads/release/\\d+\\.x$" // release/<major>.x branches publish stable packages
],
"nugetPackageVersion": {
Expand Down
Loading