chore(mix): use flag instead of elixirpkg to denote package type
Also, add Makefile target to build zip files with Elixir.
This commit is contained in:
parent
5a7943f583
commit
59f0d5f537
|
@ -4,16 +4,16 @@ set -euo pipefail
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
if [ -z "${1:-}" ]; then
|
if [ -z "${1:-}" ]; then
|
||||||
echo "Usage $0 <PACKAGE_NAME> tgz|pkg|elixirpkg"
|
echo "Usage $0 <PACKAGE_NAME> tgz|pkg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "${2:-}" in
|
case "${2:-}" in
|
||||||
tgz|pkg|elixirpkg)
|
tgz|pkg)
|
||||||
true
|
true
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage $0 <PACKAGE_NAME> zip|pkg|elixirpkg"
|
echo "Usage $0 <PACKAGE_NAME> zip|pkg"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -62,14 +62,14 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
_build/default/lib/rocksdb/
|
_build/default/lib/rocksdb/
|
||||||
deps/rocksdb/priv/
|
deps/rocksdb/
|
||||||
key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
|
key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
|
||||||
- name: load quicer cache
|
- name: load quicer cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
_build/default/lib/quicer/
|
_build/default/lib/quicer/
|
||||||
deps/quicer/priv/
|
deps/quicer/
|
||||||
key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
|
key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
|
||||||
- name: build and test tgz package
|
- name: build and test tgz package
|
||||||
run: |
|
run: |
|
||||||
|
@ -83,10 +83,14 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
make ${EMQX_NAME}-pkg
|
make ${EMQX_NAME}-pkg
|
||||||
.ci/build_packages/tests.sh "$EMQX_PKG_NAME" pkg amd64
|
.ci/build_packages/tests.sh "$EMQX_PKG_NAME" pkg amd64
|
||||||
|
- name: build and test zip package (Elixir)
|
||||||
|
run: |
|
||||||
|
make ${EMQX_NAME}-elixir-zip
|
||||||
|
.ci/build_packages/tests.sh "$EMQX_PKG_NAME" zip amd64
|
||||||
- name: build and test deb/rpm packages (Elixir)
|
- name: build and test deb/rpm packages (Elixir)
|
||||||
run: |
|
run: |
|
||||||
make ${EMQX_NAME}-elixirpkg
|
make ${EMQX_NAME}-elixirpkg
|
||||||
.ci/build_packages/tests.sh "$EMQX_ELIXIRPKG_NAME" elixirpkg amd64
|
.ci/build_packages/tests.sh "$EMQX_ELIXIRPKG_NAME" pkg amd64
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
|
name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -235,3 +235,11 @@ $1-elixirpkg: $1-pkg-elixir
|
||||||
$(BUILD) $1 pkg
|
$(BUILD) $1 pkg
|
||||||
endef
|
endef
|
||||||
$(foreach pt,$(REL_PROFILES),$(eval $(call gen-elixirpkg-target,$(pt))))
|
$(foreach pt,$(REL_PROFILES),$(eval $(call gen-elixirpkg-target,$(pt))))
|
||||||
|
|
||||||
|
.PHONY: $(REL_PROFILES:%=%-elixir-zip)
|
||||||
|
define gen-elixir-zip-target
|
||||||
|
$1-elixir-zip: $(ELIXIR_COMMON_DEPS) mix-deps-get
|
||||||
|
@env IS_ELIXIR=yes $(BUILD) $1 zip
|
||||||
|
endef
|
||||||
|
ALL_ELIXIR_ZIPS = $(REL_PROFILES)
|
||||||
|
$(foreach zt,$(ALL_ELIXIR_ZIPS),$(eval $(call gen-elixir-zip-target,$(zt))))
|
||||||
|
|
49
build
49
build
|
@ -84,6 +84,11 @@ make_rel() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
make_elixir_rel() {
|
||||||
|
export_release_vars "$PROFILE"
|
||||||
|
env MIX_ENV=prod mix release --overwrite
|
||||||
|
}
|
||||||
|
|
||||||
## extract previous version .tar.gz files to _build/$PROFILE/rel/emqx before making relup
|
## extract previous version .tar.gz files to _build/$PROFILE/rel/emqx before making relup
|
||||||
make_relup() {
|
make_relup() {
|
||||||
local rel_dir="_build/$PROFILE/rel/emqx"
|
local rel_dir="_build/$PROFILE/rel/emqx"
|
||||||
|
@ -124,21 +129,36 @@ cp_dyn_libs() {
|
||||||
## Re-pack the relx assembled .tar.gz to EMQ X's package naming scheme
|
## Re-pack the relx assembled .tar.gz to EMQ X's package naming scheme
|
||||||
## It assumes the .tar.gz has been built -- relies on Makefile dependency
|
## It assumes the .tar.gz has been built -- relies on Makefile dependency
|
||||||
make_tgz() {
|
make_tgz() {
|
||||||
# build the tarball again to ensure relup is included
|
local pkgpath="_packages/${PROFILE}"
|
||||||
make_rel
|
local tarball
|
||||||
|
local target
|
||||||
|
|
||||||
|
if [ "${IS_ELIXIR:-no}" = "yes" ]
|
||||||
|
then
|
||||||
|
# ensure tarball exists
|
||||||
|
ELIXIR_MAKE_TAR=yes make_elixir_rel
|
||||||
|
|
||||||
|
local relpath="_build/prod"
|
||||||
|
tarball="${relpath}/${PROFILE}-${PKG_VSN}-elixir${ELIXIR_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}.tar.gz"
|
||||||
|
target="${pkgpath}/${PROFILE}-${PKG_VSN}-elixir${ELIXIR_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}.tar.gz"
|
||||||
|
else
|
||||||
|
# build the tarball again to ensure relup is included
|
||||||
|
# elixir does not have relup yet.
|
||||||
|
make_rel
|
||||||
|
|
||||||
|
local relpath="_build/${PROFILE}/rel/emqx"
|
||||||
|
tarball="${relpath}/${PROFILE}-${PKG_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}.tar.gz"
|
||||||
|
target="${pkgpath}/${PROFILE}-${PKG_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
tard="/tmp/emqx_untar_${PKG_VSN}"
|
tard="/tmp/emqx_untar_${PKG_VSN}"
|
||||||
rm -rf "${tard}"
|
rm -rf "${tard}"
|
||||||
mkdir -p "${tard}/emqx"
|
mkdir -p "${tard}/emqx"
|
||||||
local relpath="_build/${PROFILE}/rel/emqx"
|
|
||||||
local pkgpath="_packages/${PROFILE}"
|
|
||||||
mkdir -p "${pkgpath}"
|
mkdir -p "${pkgpath}"
|
||||||
local tarball="${relpath}/emqx-${PKG_VSN}.tar.gz"
|
|
||||||
if [ ! -f "$tarball" ]; then
|
if [ ! -f "$tarball" ]; then
|
||||||
log "ERROR: $tarball is not found"
|
log "ERROR: $tarball is not found"
|
||||||
fi
|
fi
|
||||||
local target
|
|
||||||
target="${pkgpath}/${PROFILE}-${PKG_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}.tar.gz"
|
|
||||||
tar zxf "${tarball}" -C "${tard}/emqx"
|
tar zxf "${tarball}" -C "${tard}/emqx"
|
||||||
## try to be portable for tar.gz packages.
|
## try to be portable for tar.gz packages.
|
||||||
## for DEB and RPM packages the dependencies are resoved by yum and apt
|
## for DEB and RPM packages the dependencies are resoved by yum and apt
|
||||||
|
@ -212,37 +232,37 @@ export_release_vars() {
|
||||||
export EMQX_RLEASE_TYPE=cloud \
|
export EMQX_RLEASE_TYPE=cloud \
|
||||||
EMQX_PACKAGE_TYPE=bin \
|
EMQX_PACKAGE_TYPE=bin \
|
||||||
EMQX_EDITION_TYPE=community \
|
EMQX_EDITION_TYPE=community \
|
||||||
ELIXIR_MAKE_TAR=no
|
ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-no}
|
||||||
;;
|
;;
|
||||||
emqx-edge)
|
emqx-edge)
|
||||||
export EMQX_RLEASE_TYPE=edge \
|
export EMQX_RLEASE_TYPE=edge \
|
||||||
EMQX_PACKAGE_TYPE=bin \
|
EMQX_PACKAGE_TYPE=bin \
|
||||||
EMQX_EDITION_TYPE=community \
|
EMQX_EDITION_TYPE=community \
|
||||||
ELIXIR_MAKE_TAR=no
|
ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-no}
|
||||||
;;
|
;;
|
||||||
emqx-enterprise)
|
emqx-enterprise)
|
||||||
export EMQX_RLEASE_TYPE=cloud \
|
export EMQX_RLEASE_TYPE=cloud \
|
||||||
EMQX_PACKAGE_TYPE=bin \
|
EMQX_PACKAGE_TYPE=bin \
|
||||||
EMQX_EDITION_TYPE=enterprise \
|
EMQX_EDITION_TYPE=enterprise \
|
||||||
ELIXIR_MAKE_TAR=no
|
ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-no}
|
||||||
;;
|
;;
|
||||||
emqx-pkg)
|
emqx-pkg)
|
||||||
export EMQX_RLEASE_TYPE=cloud \
|
export EMQX_RLEASE_TYPE=cloud \
|
||||||
EMQX_PACKAGE_TYPE=pkg \
|
EMQX_PACKAGE_TYPE=pkg \
|
||||||
EMQX_EDITION_TYPE=community \
|
EMQX_EDITION_TYPE=community \
|
||||||
ELIXIR_MAKE_TAR=yes
|
ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-yes}
|
||||||
;;
|
;;
|
||||||
emqx-edge-pkg)
|
emqx-edge-pkg)
|
||||||
export EMQX_RLEASE_TYPE=edge \
|
export EMQX_RLEASE_TYPE=edge \
|
||||||
EMQX_PACKAGE_TYPE=pkg \
|
EMQX_PACKAGE_TYPE=pkg \
|
||||||
EMQX_EDITION_TYPE=community \
|
EMQX_EDITION_TYPE=community \
|
||||||
ELIXIR_MAKE_TAR=yes
|
ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-yes}
|
||||||
;;
|
;;
|
||||||
emqx-enterprise-pkg)
|
emqx-enterprise-pkg)
|
||||||
export EMQX_RLEASE_TYPE=cloud \
|
export EMQX_RLEASE_TYPE=cloud \
|
||||||
EMQX_PACKAGE_TYPE=pkg \
|
EMQX_PACKAGE_TYPE=pkg \
|
||||||
EMQX_EDITION_TYPE=enterprise \
|
EMQX_EDITION_TYPE=enterprise \
|
||||||
ELIXIR_MAKE_TAR=yes
|
ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-yes}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo Invalid profile "$profile"
|
echo Invalid profile "$profile"
|
||||||
|
@ -283,8 +303,7 @@ case "$ARTIFACT" in
|
||||||
make_docker_testing
|
make_docker_testing
|
||||||
;;
|
;;
|
||||||
elixir)
|
elixir)
|
||||||
export_release_vars "$PROFILE"
|
make_elixir_rel
|
||||||
env MIX_ENV=prod mix release --overwrite
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "Unknown artifact $ARTIFACT"
|
log "Unknown artifact $ARTIFACT"
|
||||||
|
|
|
@ -17,8 +17,10 @@ help() {
|
||||||
echo
|
echo
|
||||||
echo "-h|--help: To display this usage information"
|
echo "-h|--help: To display this usage information"
|
||||||
echo "--profile <PROFILE>: EMQ X profile to build, e.g. emqx, emqx-edge"
|
echo "--profile <PROFILE>: EMQ X profile to build, e.g. emqx, emqx-edge"
|
||||||
echo "--pkgtype tgz|pkg|elixirpkg: Specify which package to build, tgz for .tar.gz,"
|
echo "--pkgtype tgz|pkg: Specify which package to build, tgz for .tar.gz,"
|
||||||
echo " pkg and elixirpkg for .rpm or .deb"
|
echo " pkg for .rpm or .deb"
|
||||||
|
echo "--with-elixir: Specify if the release should be built with Elixir, "
|
||||||
|
echo " defaults to false."
|
||||||
echo "--arch amd64|arm64: Target arch to build the EMQ X package for"
|
echo "--arch amd64|arm64: Target arch to build the EMQ X package for"
|
||||||
echo "--src_dir <SRC_DIR>: EMQ X source ode in this dir, default to PWD"
|
echo "--src_dir <SRC_DIR>: EMQ X source ode in this dir, default to PWD"
|
||||||
echo "--builder <BUILDER>: Builder image to pull"
|
echo "--builder <BUILDER>: Builder image to pull"
|
||||||
|
@ -62,6 +64,10 @@ while [ "$#" -gt 0 ]; do
|
||||||
ELIXIR_VSN="$2"
|
ELIXIR_VSN="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
--with-elixir)
|
||||||
|
WITH_ELIXIR=yes
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
--system)
|
--system)
|
||||||
SYSTEM="$2"
|
SYSTEM="$2"
|
||||||
shift 2
|
shift 2
|
||||||
|
@ -85,8 +91,12 @@ if [ -z "${PROFILE:-}" ] ||
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "${WITH_ELIXIR:-}" ]; then
|
||||||
|
WITH_ELIXIR=no
|
||||||
|
fi
|
||||||
|
|
||||||
case "$PKGTYPE" in
|
case "$PKGTYPE" in
|
||||||
tgz|pkg|elixirpkg)
|
tgz|pkg)
|
||||||
true
|
true
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -99,7 +109,7 @@ cd "${SRC_DIR:-.}"
|
||||||
|
|
||||||
PKG_VSN="${PKG_VSN:-$(./pkg-vsn.sh "$PROFILE")}"
|
PKG_VSN="${PKG_VSN:-$(./pkg-vsn.sh "$PROFILE")}"
|
||||||
|
|
||||||
if [ "$PKGTYPE" = "elixirpkg" ]
|
if [ "$WITH_ELIXIR" = "yes" ]
|
||||||
then
|
then
|
||||||
PKG_NAME="${PROFILE}-${PKG_VSN}-elixir${ELIXIR_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}"
|
PKG_NAME="${PROFILE}-${PKG_VSN}-elixir${ELIXIR_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue