Makefile: Add the ability to create a source code release with all deps #104240

Open
Sebastian Parborg wants to merge 4 commits from ZedDB/flamenco:vendor into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 28 additions and 12 deletions

4
.gitignore vendored
View File

@ -20,6 +20,10 @@ flamenco-worker.yaml
flamenco-worker-credentials.yaml flamenco-worker-credentials.yaml
node_modules/ node_modules/
# Directories used to store go and yarn dependencies for offline building
/vendor
/web/app/package-cache
# Directory for custom job compiler scripts: # Directory for custom job compiler scripts:
/scripts/ /scripts/

View File

@ -46,17 +46,14 @@ export CGO_ENABLED=0
all: application all: application
# Install generators and build the software. vendor: webapp-deps
with-deps: go mod vendor
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.9.0
go install github.com/golang/mock/mockgen@v1.6.0
$(MAKE) application
vet: vet:
go vet ./... go vet ./...
go run golang.org/x/vuln/cmd/govulncheck@latest ./... go run golang.org/x/vuln/cmd/govulncheck@latest ./...
application: webapp flamenco-manager flamenco-worker application: flamenco-manager flamenco-worker
flamenco-manager: flamenco-manager:
$(MAKE) webapp-static $(MAKE) webapp-static
@ -93,10 +90,11 @@ flamenco-worker_race:
shaman-checkout-id-setter: shaman-checkout-id-setter:
go build -v ${BUILD_FLAGS} ${PKG}/cmd/shaman-checkout-id-setter go build -v ${BUILD_FLAGS} ${PKG}/cmd/shaman-checkout-id-setter
webapp: webapp-deps:
yarn --cwd web/app install # We have to use --force here to ensure that the offline package cache is up to date with no missing files

This comment should be hidden from the regular output. Right now it's actually shown when running make webapp-deps (and any other target that runs this target).

This comment should be hidden from the regular output. Right now it's actually shown when running `make webapp-deps` (and any other target that runs this target).
yarn --cwd web/app install --force
webapp-static: addon-packer webapp-static: webapp-deps addon-packer
$(MAKE) clean-webapp-static $(MAKE) clean-webapp-static
# When changing the base URL, also update the line # When changing the base URL, also update the line
# e.GET("/app/*", echo.WrapHandler(webAppHandler)) # e.GET("/app/*", echo.WrapHandler(webAppHandler))
@ -331,6 +329,9 @@ RELEASE_PACKAGE_WINDOWS := flamenco-${VERSION}-windows-amd64.zip
RELEASE_PACKAGE_EXTRA_FILES := README.md LICENSE CHANGELOG.md RELEASE_PACKAGE_EXTRA_FILES := README.md LICENSE CHANGELOG.md
RELEASE_PACKAGE_SHAFILE := flamenco-${VERSION}.sha256 RELEASE_PACKAGE_SHAFILE := flamenco-${VERSION}.sha256
RELEASE_SOURCE_ARCHIVE := flamenco-${VERSION}-src.tar
RELEASE_SOURCE_ARCHIVE_GZ := flamenco-${VERSION}-src.tar.gz

I think it's better to define RELEASE_SOURCE_ARCHIVE_GZ as ${RELEASE_SOURCE_ARCHIVE}.gz

I think it's better to define `RELEASE_SOURCE_ARCHIVE_GZ` as `${RELEASE_SOURCE_ARCHIVE}.gz`
.PHONY: release-package .PHONY: release-package
release-package: release-package:
$(MAKE) -s release-package-linux $(MAKE) -s release-package-linux
@ -377,12 +378,21 @@ release-package-windows:
zip -r -9 dist/${RELEASE_PACKAGE_WINDOWS} flamenco-manager.exe flamenco-worker.exe ${RELEASE_PACKAGE_EXTRA_FILES} tools/*-windows* zip -r -9 dist/${RELEASE_PACKAGE_WINDOWS} flamenco-manager.exe flamenco-worker.exe ${RELEASE_PACKAGE_EXTRA_FILES} tools/*-windows*
@echo "Done! Created ${RELEASE_PACKAGE_WINDOWS}" @echo "Done! Created ${RELEASE_PACKAGE_WINDOWS}"
.PHONY: release-package-source
release-package-source: vendor
mkdir -p dist
rm -f dist/${RELEASE_SOURCE_ARCHIVE_GZ}
git archive --prefix=flamenco-${VERSION}/ -o dist/${RELEASE_SOURCE_ARCHIVE} HEAD
tar --transform 's,^,flamenco-${VERSION}/,' -rvf dist/${RELEASE_SOURCE_ARCHIVE} vendor web/app/package-cache

What's the reason to use gzip separately? Why not just use tar z?

What's the reason to use `gzip` separately? Why not just use `tar z`?
gzip dist/${RELEASE_SOURCE_ARCHIVE}
@echo "Done! Created ${RELEASE_SOURCE_ARCHIVE_GZ}"
.PHONY: publish-release-packages .PHONY: publish-release-packages
publish-release-packages: publish-release-packages:
$(MAKE) -s check-environment $(MAKE) -s check-environment
cd dist; sha256sum ${RELEASE_PACKAGE_LINUX} ${RELEASE_PACKAGE_DARWIN} ${RELEASE_PACKAGE_WINDOWS} > ${RELEASE_PACKAGE_SHAFILE} cd dist; sha256sum ${RELEASE_PACKAGE_LINUX} ${RELEASE_PACKAGE_DARWIN} ${RELEASE_PACKAGE_WINDOWS} ${RELEASE_SOURCE_ARCHIVE_GZ} > ${RELEASE_PACKAGE_SHAFILE}
cd dist; rsync -va \ cd dist; rsync -va \
${RELEASE_PACKAGE_LINUX} ${RELEASE_PACKAGE_DARWIN} ${RELEASE_PACKAGE_WINDOWS} ${RELEASE_PACKAGE_SHAFILE} \ ${RELEASE_PACKAGE_LINUX} ${RELEASE_PACKAGE_DARWIN} ${RELEASE_PACKAGE_WINDOWS} ${RELEASE_SOURCE_ARCHIVE_GZ} ${RELEASE_PACKAGE_SHAFILE} \
${WEBSERVER_SSH}:${WEBSERVER_ROOT}/downloads/ ${WEBSERVER_SSH}:${WEBSERVER_ROOT}/downloads/
.PHONY: application version flamenco-manager flamenco-worker flamenco-manager_race flamenco-worker_race webapp webapp-static generate generate-go generate-py with-deps swagger-ui list-embedded test clean clean-webapp-static .PHONY: application version flamenco-manager flamenco-worker flamenco-manager_race flamenco-worker_race webapp-deps webapp-static generate generate-go generate-py vendor swagger-ui list-embedded test clean clean-webapp-static

2
web/app/.yarnrc Normal file
View File

@ -0,0 +1,2 @@
yarn-offline-mirror "./package-cache"
yarn-offline-mirror-pruning true

Instead of always caching the packages, put this into a special file .yarnrc-source-pkg or something, and specify that when running yarn install for grabbing the sources. That way the regular builds don't have to bother with this package cache.

Instead of always caching the packages, put this into a special file `.yarnrc-source-pkg` or something, and specify that when running `yarn install` for grabbing the sources. That way the regular builds don't have to bother with this package cache.