Skip to content

Commit

Permalink
ci: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianciutea committed Sep 8, 2021
1 parent c0e1918 commit 6308f35
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 59 deletions.
62 changes: 5 additions & 57 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,62 +1,10 @@
PROJECT_WORKSPACE ?= $(CURDIR)
INCLUDE_BUILD_DIR ?= $(PROJECT_WORKSPACE)/build

DOCKER_BIN ?= docker
MAVEN_BIN ?= mvn

DOCKER_CMD ?= $(DOCKER_BIN) run --rm -t \
-v $(HOME)/.docker/:/root/.docker/ \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(CURDIR):/src/nrjmx \
-w /src/nrjmx \
-e GITHUB_TOKEN \
-e TAG \
-e GPG_MAIL \
-e GPG_PASSPHRASE \
-e GPG_PRIVATE_KEY_BASE64 \
nrjmx_builder
TAG ?= v0.0.0

.PHONY : deps
deps:
@docker build -t nrjmx_builder .

.PHONY : build
build:
@($(MAVEN_BIN) clean package -DskipTests -P \!deb,\!rpm,\!tarball,\!test)

.PHONY : package
package:
@($(MAVEN_BIN) versions:set -DnewVersion=\$(subst v,,$(TAG)))
@($(MAVEN_BIN) clean -DskipTests package)

.PHONY : test
test:
@($(MAVEN_BIN) clean test -P test)

.PHONY : ci/build
ci/build: deps
@($(DOCKER_CMD) make build)

.PHONY : ci/package
ci/package: deps
@($(DOCKER_CMD) make package)

.PHONY : ci/test
ci/test: deps
@($(DOCKER_CMD) make test)

.PHONY : release/sign
release/sign:
@echo "=== [release/sign] signing packages"
@bash $(CURDIR)/sign.sh

.PHONY : release/publish
release/publish:
@echo "=== [release/publish] publishing artifacts"
@bash $(CURDIR)/upload_artifacts_gh.sh

.PHONY : release-linux
release-linux: package release/sign release/publish
@echo "=== [release-linux] full pre-release cycle complete for nix"

.PHONY : ci/release
ci/release: deps
@($(DOCKER_CMD) make release-linux)
include $(INCLUDE_BUILD_DIR)/build.mk
include $(INCLUDE_BUILD_DIR)/ci.mk
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions build/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.PHONY : build
build:
@($(MAVEN_BIN) clean package -DskipTests -P \!deb,\!rpm,\!tarball,\!test)

.PHONY : package
package:
@($(MAVEN_BIN) versions:set -DnewVersion=\$(subst v,,$(TAG)))
@($(MAVEN_BIN) clean -DskipTests package)

.PHONY : test
test:
@($(MAVEN_BIN) clean test -P test)

.PHONY : sign
release/sign:
@echo "=== [sign] signing packages"
@bash $(CURDIR)/build/sign.sh
40 changes: 40 additions & 0 deletions build/ci.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
DOCKER_CMD ?= $(DOCKER_BIN) run --rm -t \
-v $(HOME)/.docker/:/root/.docker/ \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(CURDIR):/src/nrjmx \
-w /src/nrjmx \
-e GITHUB_TOKEN \
-e TAG \
-e GPG_MAIL \
-e GPG_PASSPHRASE \
-e GPG_PRIVATE_KEY_BASE64 \
nrjmx_builder

.PHONY : deps
deps:
@docker build -t nrjmx_builder ./build/.

.PHONY : ci/build
ci/build: deps
@($(DOCKER_CMD) make build)

.PHONY : ci/package
ci/package: deps
@($(DOCKER_CMD) make package)

.PHONY : ci/test
ci/test: deps
@($(DOCKER_CMD) make test)

publish:
@echo "=== [release/publish] publishing artifacts"
@bash $(CURDIR)/build/upload_artifacts_gh.sh

release: package sign publish
@echo "=== [release] full pre-release cycle complete for nix"

.PHONY : ci/release
ci/release: deps
@($(DOCKER_CMD) make release)


File renamed without changes.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<configuration>
<finalName>${project.artifactId}_linux_${project.version}_noarch</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptor>assembly.xml</descriptor>
<descriptor>build/assembly/targz.xml</descriptor>
</configuration>
<phase>package</phase>
<goals>
Expand All @@ -169,7 +169,7 @@
<configuration>
<finalName>${project.artifactId}_windows_${project.version}_noarch</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptor>assembly-zip.xml</descriptor>
<descriptor>build/assembly/zip.xml</descriptor>
</configuration>
<phase>package</phase>
<goals>
Expand Down

0 comments on commit 6308f35

Please sign in to comment.