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 25 additions and 10 deletions
Showing only changes of commit a93d113210 - Show all commits

4
.gitignore vendored
View File

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

View File

@ -46,17 +46,14 @@ export CGO_ENABLED=0
all: application
# Install generators and build the software.
with-deps:
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
vendor: webapp-deps
go mod vendor
vet:
go vet ./...
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
application: webapp flamenco-manager flamenco-worker
application: webapp-deps flamenco-manager flamenco-worker
flamenco-manager:
$(MAKE) webapp-static
@ -93,7 +90,7 @@ flamenco-worker_race:
shaman-checkout-id-setter:
go build -v ${BUILD_FLAGS} ${PKG}/cmd/shaman-checkout-id-setter
webapp:
webapp-deps:
yarn --cwd web/app install

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).
webapp-static: addon-packer
@ -331,6 +328,9 @@ RELEASE_PACKAGE_WINDOWS := flamenco-${VERSION}-windows-amd64.zip
RELEASE_PACKAGE_EXTRA_FILES := README.md LICENSE CHANGELOG.md
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
release-package:
$(MAKE) -s release-package-linux
@ -377,12 +377,21 @@ release-package-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}"
.PHONY: release-package-source
release-package-source: vendor
mkdir -p dist
rm -f dist/${RELEASE_SOURCE_ARCHIVE_GZ}
git archive -o dist/${RELEASE_SOURCE_ARCHIVE} HEAD
tar -rvf dist/${RELEASE_SOURCE_ARCHIVE} vendor web/app/package-cache
gzip dist/${RELEASE_SOURCE_ARCHIVE}

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`?
@echo "Done! Created ${RELEASE_SOURCE_ARCHIVE_GZ}"
.PHONY: publish-release-packages
publish-release-packages:
$(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 \
${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/
.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.