Skip to content

Commit

Permalink
refactor(build): Switch dist checksumming to more modular approach
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Apr 3, 2024
1 parent 768ca1e commit ae2bd30
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
- name: Build source package
run: |
make dist
- name: Generate checksums of release artifacts
run: |
make decasify-${{ env.VERSION }}.sha256.txt
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
Expand Down
8 changes: 1 addition & 7 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CLEANFILES =

CARGO_FEATURE_ARGS = --features full

include $(top_srcdir)/build-aux/dist_checksums.mk
include $(top_srcdir)/build-aux/rust_boilerplate.mk

SEMVER = $(shell $(AWK) -F\" '/^version/ { print $$2 }' Cargo.toml)
Expand All @@ -37,13 +38,6 @@ REL_ROCK = $(PACKAGE_NAME)-$(SEMVER)-$(ROCKREV).src.rock

EXTRA_decasify_SOURCES += $(REL_SPEC) $(DEV_SPEC)

DIST_ARTIFACTS := $(wildcard $(distdir).tar.zst $(distdir).zip $(REL_ROCK))

# Output both a file to attach to releases and stdout so CI build logs can be
# audited as matching what is actually posted.
$(PACKAGE_NAME)-%.sha256.txt: $(DIST_ARTIFACTS)
sha256sum $^ | tee $@

.PHONY: rockspecs
rockspecs: $(DEV_SPEC) $(REL_SPEC)

Expand Down
6 changes: 6 additions & 0 deletions build-aux/ax_dist_checksums.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AC_DEFUN([AX_DIST_CHECKSUMS], [
AX_PROGVAR([sha256sum])
AX_PROGVAR([tee])
])
11 changes: 11 additions & 0 deletions build-aux/dist_checksums.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Prepend to function that runs after compressing dist archives
am__post_remove_distdir = $(checksum_dist); $(am__post_remove_distdir )

# Output both a file that can be attatched to releases and also write STDOUT
# for the sake of CI build logs so they can be audited as matching what is
# eventually posted. The list of files checksummed is a glob (even though we
# know an exact pattern) to avoid errors for formats not generated.
checksum_dist = \
shopt -s nullglob ; \
$(SHA256SUM) $(distdir)*.{tar.{gz,bz2,lz,xz,zst},zip} | $(TEE) $(distdir).sha256.txt

1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ AM_INIT_AUTOMAKE([foreign tar-pax dist-zstd dist-zip no-dist-gzip color-tests])
AM_SILENT_RULES([yes])

AX_GIT_VERSION
AX_DIST_CHECKSUMS
AX_TRANSFORM_PACKAGE_NAME

AC_PROG_AWK
Expand Down

0 comments on commit ae2bd30

Please sign in to comment.