1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00
Files
sops/Makefile

116 lines
4.3 KiB
Makefile
Raw Permalink Normal View History

2016-08-24 12:37:18 -07:00
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PROJECT := go.mozilla.org/sops/v3
2022-02-24 14:12:58 -08:00
GO := GOPROXY=https://proxy.golang.org go
2016-08-24 12:37:18 -07:00
GOLINT := golint
2016-11-13 22:20:13 +01:00
all: test vet generate install functional-tests
origin-build: test vet generate install functional-tests-all
2016-08-24 12:37:18 -07:00
install:
2019-11-18 10:06:58 -08:00
$(GO) install go.mozilla.org/sops/v3/cmd/sops
2016-08-24 12:37:18 -07:00
tag: all
git tag -s $(TAGVER) -a -m "$(TAGMSG)"
lint:
$(GOLINT) $(PROJECT)
vendor:
2019-07-30 10:55:08 +02:00
$(GO) mod tidy
$(GO) mod vendor
2016-08-24 12:37:18 -07:00
vet:
$(GO) vet $(PROJECT)
test: vendor
2016-08-25 12:21:10 -07:00
gpg --import pgp/sops_functional_tests_key.asc 2>&1 1>/dev/null || exit 0
2017-10-03 15:14:00 -07:00
./test.sh
2016-08-24 12:37:18 -07:00
showcoverage: test
$(GO) tool cover -html=coverage.out
2018-06-17 22:50:30 +02:00
generate: keyservice/keyservice.pb.go
2016-08-24 12:37:18 -07:00
$(GO) generate
2018-06-17 22:50:30 +02:00
%.pb.go: %.proto
protoc --go_out=plugins=grpc:. $<
2016-11-13 22:20:13 +01:00
functional-tests:
2019-11-18 10:06:58 -08:00
$(GO) build -o functional-tests/sops go.mozilla.org/sops/v3/cmd/sops
2016-11-13 22:20:13 +01:00
cd functional-tests && cargo test
# Ignored tests are ones that require external services (e.g. AWS KMS)
# TODO: Once `--include-ignored` lands in rust stable, switch to that.
functional-tests-all:
2019-11-18 10:06:58 -08:00
$(GO) build -o functional-tests/sops go.mozilla.org/sops/v3/cmd/sops
cd functional-tests && cargo test && cargo test -- --ignored
2021-06-22 13:51:59 +03:00
# Creates variables during target re-definition. Basically this block allows the particular variables to be used in the final target
build-deb-%: OS = $(word 1,$(subst -, ,$*))
build-deb-%: ARCH = $(word 2,$(subst -, ,$*))
build-deb-%: FPM_ARCH = $(word 3,$(subst -, ,$*))
# Poor-mans function with parameters being split out from the variable part of it's name
build-deb-%:
rm -rf tmppkg
mkdir -p tmppkg/usr/local/bin
2021-06-22 13:51:59 +03:00
GOOS=$(OS) GOARCH="$(ARCH)" CGO_ENABLED=0 go build -mod vendor -o tmppkg/usr/local/bin/sops go.mozilla.org/sops/v3/cmd/sops
fpm -C tmppkg -n sops --license MPL2.0 --vendor mozilla \
--description "Sops is an editor of encrypted files that supports YAML, JSON and BINARY formats and encrypts with AWS KMS and PGP." \
2021-03-25 09:35:41 -07:00
-m "AJ Bahnken <ajvb+sops@mozilla.com>" \
--url https://go.mozilla.org/sops \
2021-06-22 13:51:59 +03:00
--architecture $(FPM_ARCH) \
-v "$$(grep '^const Version' version/version.go |cut -d \" -f 2)" \
-s dir -t deb .
2021-06-22 13:51:59 +03:00
# Create .deb packages for multiple architectures
deb-pkg: vendor build-deb-linux-amd64-x86_64 build-deb-linux-arm64-arm64
# Creates variables during target re-definition. Basically this block allows the particular variables to be used in the final target
build-rpm-%: OS = $(word 1,$(subst -, ,$*))
build-rpm-%: ARCH = $(word 2,$(subst -, ,$*))
build-rpm-%: FPM_ARCH = $(word 3,$(subst -, ,$*))
# Poor-mans function with parameters being split out from the variable part of it's name
build-rpm-%:
rm -rf tmppkg
mkdir -p tmppkg/usr/local/bin
2021-06-22 13:51:59 +03:00
GOOS=$(OS) GOARCH="$(ARCH)" CGO_ENABLED=0 go build -mod vendor -o tmppkg/usr/local/bin/sops go.mozilla.org/sops/v3/cmd/sops
fpm -C tmppkg -n sops --license MPL2.0 --vendor mozilla \
--description "Sops is an editor of encrypted files that supports YAML, JSON and BINARY formats and encrypts with AWS KMS and PGP." \
2021-03-25 09:35:41 -07:00
-m "AJ Bahnken <ajvb+sops@mozilla.com>" \
--url https://go.mozilla.org/sops \
2021-06-22 13:51:59 +03:00
--architecture $(FPM_ARCH) \
--rpm-os $(OS) \
-v "$$(grep '^const Version' version/version.go |cut -d \" -f 2)" \
-s dir -t rpm .
2021-06-22 13:51:59 +03:00
# Create .rpm packages for multiple architectures
rpm-pkg: vendor build-rpm-linux-amd64-x86_64 build-rpm-linux-arm64-arm64
dmg-pkg: install
ifneq ($(OS),darwin)
echo 'you must be on MacOS and set OS=darwin on the make command line to build an OSX package'
else
rm -rf tmppkg
mkdir -p tmppkg/usr/local/bin
cp $$GOPATH/bin/sops tmppkg/usr/local/bin/
fpm -C tmppkg -n sops --license MPL2.0 --vendor mozilla \
--description "Sops is an editor of encrypted files that supports YAML, JSON and BINARY formats and encrypts with AWS KMS and PGP." \
-m "Mozilla Security <security@mozilla.org>" \
--url https://go.mozilla.org/sops \
--architecture x86_64 \
-v "$$(grep '^const Version' version/version.go |cut -d \" -f 2)" \
-s dir -t osxpkg \
--osxpkg-identifier-prefix org.mozilla.sops \
-p tmppkg/sops-$$(git describe --abbrev=0 --tags).pkg .
hdiutil makehybrid -hfs -hfs-volume-name "Mozilla Sops" \
-o tmppkg/sops-$$(git describe --abbrev=0 --tags).dmg tmpdmg
endif
2016-11-30 11:40:38 -05:00
download-index:
bash make_download_page.sh
.PHONY: all test generate clean vendor functional-tests