Skip to content

Commit 4eccb2b

Browse files
authored
README and releaser (#2)
1 parent 9609ffa commit 4eccb2b

5 files changed

Lines changed: 439 additions & 102 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -137,32 +137,15 @@ jobs:
137137
done
138138
find internal/native/lib -type f -print | sort
139139
140-
- name: Generate checksums
141-
run: make checksums
140+
- name: Stage release assets
141+
run: make stage.release.assets
142142

143-
- name: Verify checksums
144-
run: make verify.checksums
143+
- name: Verify release assets
144+
run: make verify.release.assets
145145

146146
- name: Verify downloaded release artifacts
147147
run: make verify.release.downloaded
148148

149-
- name: Stage release assets
150-
run: |
151-
set -euo pipefail
152-
tag="${{ steps.version.outputs.release_tag }}"
153-
rm -rf dist
154-
mkdir -p dist
155-
while IFS= read -r file; do
156-
platform="$(basename "$(dirname "${file}")")"
157-
base="$(basename "${file}")"
158-
cp "${file}" "dist/datafusion-go-${tag}-${platform}-${base}"
159-
done < <(find internal/native/lib -mindepth 2 -maxdepth 2 -type f \( -name 'libdatafusion_go.a' -o -name 'libdatafusion_go.so' -o -name 'libdatafusion_go.dylib' -o -name 'datafusion_go.dll' \) -print | sort)
160-
cd dist
161-
shasum -a 256 datafusion-go-* > SHA256SUMS
162-
shasum -a 256 -c SHA256SUMS
163-
cd ..
164-
cp dist/SHA256SUMS internal/native/lib/SHA256SUMS
165-
166149
- name: Prepare release notes
167150
id: notes
168151
run: |

CONTRIBUTING.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ make test.static
2626
Run the release verification path for already-bundled/downloaded artifacts:
2727

2828
```sh
29+
make stage.release.assets
2930
make verify.release.downloaded
3031
```
3132

@@ -76,10 +77,14 @@ Use `make bundle` only when you intend to copy the current host build into `inte
7677
Before publishing, update `versions.toml`, run `make generate`, update
7778
`CHANGELOG.md`, and run the `Release` GitHub Actions workflow with
7879
`publish=false`. The workflow derives the tag from `versions.toml`, builds the
79-
native matrix, downloads all archives into one checkout, verifies checksums, runs
80-
Go/Rust/no-cgo tests, and runs a clean consumer-module smoke test without
81-
tagging or creating a GitHub release.
80+
native matrix, downloads all archives into one checkout, stages release assets
81+
using the exact filenames the runtime downloader requests, embeds the
82+
release-asset checksum manifest, and runs Go/Rust/no-cgo tests without tagging
83+
or creating a GitHub release.
8284

8385
When the dry run succeeds, rerun the same workflow with `publish=true`. It tags
8486
commits the release-asset checksum manifest, tags that commit with the derived
85-
release tag, and uploads the generated native libraries plus checksums.
87+
release tag, and uploads the generated native libraries plus checksums. The tag
88+
must point at the commit containing release asset names in
89+
`internal/native/lib/SHA256SUMS`; otherwise `go get` consumers cannot verify or
90+
download native libraries automatically.

Makefile

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
GOOS ?= $(shell go env GOOS)
22
GOARCH ?= $(shell go env GOARCH)
33
MACOSX_DEPLOYMENT_TARGET ?= 13.0
4+
DIST_DIR ?= dist
45
NATIVE_PLATFORM := $(GOOS)-$(GOARCH)
56
NATIVE_LIB_DIR := internal/native/lib/$(NATIVE_PLATFORM)
67
NATIVE_LIB := $(NATIVE_LIB_DIR)/libdatafusion_go.a
@@ -39,7 +40,7 @@ else ifeq ($(GOOS),windows)
3940
STRIP_SHARED := strip --strip-unneeded
4041
endif
4142

42-
.PHONY: generate generate.check rust bundle checksums verify.checksums test test.dynamic test.bundled test.source test.static consumer.smoke lint verify.release verify.release.downloaded clean
43+
.PHONY: generate generate.check rust bundle checksums verify.checksums stage.release.assets verify.release.assets test test.dynamic test.bundled test.source test.static consumer.smoke lint verify.release verify.release.downloaded clean
4344

4445
generate:
4546
go run ./internal/tools/genversions
@@ -66,6 +67,39 @@ verify.checksums:
6667
test -s internal/native/lib/SHA256SUMS
6768
cd internal/native/lib && shasum -a 256 -c SHA256SUMS
6869

70+
stage.release.assets:
71+
@metadata=$$(mktemp); \
72+
go run ./internal/tools/genversions -github-output "$$metadata"; \
73+
. "$$metadata"; \
74+
rm -f "$$metadata"; \
75+
rm -rf "$(DIST_DIR)"; \
76+
mkdir -p "$(DIST_DIR)"; \
77+
find internal/native/lib -mindepth 2 -maxdepth 2 -type f \( -name 'libdatafusion_go.a' -o -name 'libdatafusion_go.so' -o -name 'libdatafusion_go.dylib' -o -name 'datafusion_go.dll' \) -print | sort | while IFS= read -r file; do \
78+
platform="$$(basename "$$(dirname "$$file")")"; \
79+
base="$$(basename "$$file")"; \
80+
cp "$$file" "$(DIST_DIR)/datafusion-go-$${release_tag}-$${platform}-$${base}"; \
81+
done
82+
cd "$(DIST_DIR)" && shasum -a 256 datafusion-go-* > SHA256SUMS
83+
cd "$(DIST_DIR)" && shasum -a 256 -c SHA256SUMS
84+
cp "$(DIST_DIR)/SHA256SUMS" internal/native/lib/SHA256SUMS
85+
86+
verify.release.assets:
87+
@metadata=$$(mktemp); \
88+
go run ./internal/tools/genversions -github-output "$$metadata"; \
89+
. "$$metadata"; \
90+
rm -f "$$metadata"; \
91+
cmp "$(DIST_DIR)/SHA256SUMS" internal/native/lib/SHA256SUMS; \
92+
(cd "$(DIST_DIR)" && shasum -a 256 -c SHA256SUMS); \
93+
for asset in \
94+
"datafusion-go-$${release_tag}-darwin-arm64-libdatafusion_go.dylib" \
95+
"datafusion-go-$${release_tag}-darwin-amd64-libdatafusion_go.dylib" \
96+
"datafusion-go-$${release_tag}-linux-amd64-libdatafusion_go.so" \
97+
"datafusion-go-$${release_tag}-linux-arm64-libdatafusion_go.so" \
98+
"datafusion-go-$${release_tag}-windows-amd64-datafusion_go.dll"; do \
99+
test -f "$(DIST_DIR)/$$asset"; \
100+
grep -F " $$asset" "$(DIST_DIR)/SHA256SUMS" >/dev/null; \
101+
done
102+
69103
test: bundle
70104
$(MAKE) test.dynamic
71105
$(MAKE) test.bundled
@@ -120,12 +154,12 @@ verify.release: test test.source test.static
120154
$(MAKE) checksums
121155
$(MAKE) verify.checksums
122156

123-
verify.release.downloaded: verify.checksums test.bundled consumer.smoke test.source test.static
157+
verify.release.downloaded: verify.release.assets test.bundled test.source test.static
124158
DATAFUSION_GO_LIBRARY=$(CURDIR)/$(NATIVE_SHARED) go test -race ./...
125159
go vet ./...
126160
cargo test --manifest-path rust/Cargo.toml --release
127161
CGO_ENABLED=0 go test ./...
128-
$(MAKE) verify.checksums
162+
$(MAKE) verify.release.assets
129163

130164
clean:
131165
cargo clean --manifest-path rust/Cargo.toml

0 commit comments

Comments
 (0)