chore(CI): build workflow support enterprise repo (#4363)
This commit is contained in:
parent
1ee0432301
commit
862e484944
|
@ -11,50 +11,120 @@ on:
|
||||||
- published
|
- published
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
container: emqx/build-env:erl23.2.7-ubuntu20.04
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
profiles: ${{ steps.set_profile.outputs.profiles}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: source
|
||||||
|
- name: set profile
|
||||||
|
id: set_profile
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if make -C source emqx-ee --dry-run > /dev/null 2>&1; then
|
||||||
|
echo "::set-output name=profiles::[\"emqx-ee\"]"
|
||||||
|
else
|
||||||
|
echo "::set-output name=profiles::[\"emqx\", \"emqx-edge\"]"
|
||||||
|
fi
|
||||||
|
- name: get_all_deps
|
||||||
|
if: endsWith(github.repository, 'emqx')
|
||||||
|
run: |
|
||||||
|
make -C source deps-all
|
||||||
|
zip -ryq source.zip source
|
||||||
|
- name: get_all_deps
|
||||||
|
if: endsWith(github.repository, 'enterprise')
|
||||||
|
run: |
|
||||||
|
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
|
||||||
|
git config --global credential.helper store
|
||||||
|
echo "${{ secrets.CI_GIT_TOKEN }}" >> source/scripts/git-token
|
||||||
|
make -C source deps-all
|
||||||
|
zip -ryq source.zip source
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: source
|
||||||
|
path: source.zip
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
|
|
||||||
|
needs: prepare
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
|
||||||
|
exclude:
|
||||||
|
- profile: emqx-edge
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: source
|
||||||
|
path: .
|
||||||
|
- name: unzip source code
|
||||||
|
run: Expand-Archive -Path source.zip -DestinationPath ./
|
||||||
- uses: ilammy/msvc-dev-cmd@v1
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
- uses: gleam-lang/setup-erlang@v1.1.0
|
- uses: gleam-lang/setup-erlang@v1.1.0
|
||||||
id: install_erlang
|
id: install_erlang
|
||||||
with:
|
with:
|
||||||
otp-version: 23.2
|
otp-version: 23.2
|
||||||
- name: build
|
- name: build
|
||||||
|
env:
|
||||||
|
PYTHON: python
|
||||||
|
DIAGNOSTIC: 1
|
||||||
run: |
|
run: |
|
||||||
$env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH"
|
$env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH"
|
||||||
|
|
||||||
$version = $( "${{ github.ref }}" -replace "^(.*)/(.*)/" )
|
$version = $( "${{ github.ref }}" -replace "^(.*)/(.*)/" )
|
||||||
if ($version -match "^v[0-9]+\.[0-9]+(\.[0-9]+)?") {
|
if ($version -match "^v[0-9]+\.[0-9]+(\.[0-9]+)?") {
|
||||||
$regex = "[0-9]+\.[0-9]+(-alpha|-beta|-rc)?\.[0-9]"
|
$regex = "[0-9]+\.[0-9]+(-alpha|-beta|-rc)?\.[0-9]"
|
||||||
$pkg_name = "emqx-windows-$([regex]::matches($version, $regex).value).zip"
|
$pkg_name = "${{ matrix.profile }}-windows-$([regex]::matches($version, $regex).value).zip"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$pkg_name = "emqx-windows-$($version -replace '/').zip"
|
$pkg_name = "${{ matrix.profile }}-windows-$($version -replace '/').zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
make emqx
|
cd source
|
||||||
mkdir -p _packages/emqx
|
make ${{ matrix.profile }}
|
||||||
Compress-Archive -Path _build/emqx/rel/emqx -DestinationPath _build/emqx/rel/$pkg_name
|
mkdir -p _packages/${{ matrix.profile }}
|
||||||
mv _build/emqx/rel/$pkg_name _packages/emqx
|
Compress-Archive -Path _build/${{ matrix.profile }}/rel/emqx -DestinationPath _build/${{ matrix.profile }}/rel/$pkg_name
|
||||||
Get-FileHash -Path "_packages/emqx/$pkg_name" | Format-List | grep 'Hash' | awk '{print $3}' > _packages/emqx/$pkg_name.sha256
|
mv _build/${{ matrix.profile }}/rel/$pkg_name _packages/${{ matrix.profile }}
|
||||||
|
Get-FileHash -Path "_packages/${{ matrix.profile }}/$pkg_name" | Format-List | grep 'Hash' | awk '{print $3}' > _packages/${{ matrix.profile }}/$pkg_name.sha256
|
||||||
- name: run emqx
|
- name: run emqx
|
||||||
run: |
|
run: |
|
||||||
./_build/emqx/rel/emqx/bin/emqx start
|
cd source
|
||||||
./_build/emqx/rel/emqx/bin/emqx stop
|
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
|
||||||
./_build/emqx/rel/emqx/bin/emqx install
|
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
|
||||||
./_build/emqx/rel/emqx/bin/emqx uninstall
|
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
|
||||||
|
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
|
||||||
- uses: actions/upload-artifact@v1
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
name: emqx
|
name: ${{ matrix.profile }}
|
||||||
path: ./_packages/emqx/.
|
path: source/_packages/${{ matrix.profile }}/.
|
||||||
|
|
||||||
mac:
|
mac:
|
||||||
runs-on: macos-10.15
|
runs-on: macos-10.15
|
||||||
|
|
||||||
|
needs: prepare
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
|
||||||
|
exclude:
|
||||||
|
- profile: emqx-edge
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: source
|
||||||
|
path: .
|
||||||
|
- name: unzip source code
|
||||||
|
run: unzip -q source.zip
|
||||||
- name: prepare
|
- name: prepare
|
||||||
run: |
|
run: |
|
||||||
brew install curl zip unzip gnu-sed kerl unixodbc freetds
|
brew install curl zip unzip gnu-sed kerl unixodbc freetds
|
||||||
|
@ -68,11 +138,12 @@ jobs:
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
. $HOME/.kerl/23.2.7/activate
|
. $HOME/.kerl/23.2.7/activate
|
||||||
make emqx-pkg
|
make -C source ${{ matrix.profile }}-pkg
|
||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
pkg_name=$(basename _packages/emqx/emqx-macos-*.zip)
|
cd source
|
||||||
unzip _packages/emqx/$pkg_name
|
pkg_name=$(basename _packages/${{ matrix.profile }}/${{ matrix.profile }}-*.zip)
|
||||||
|
unzip _packages/${{ matrix.profile }}/$pkg_name
|
||||||
gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
|
gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
|
||||||
./emqx/bin/emqx start || cat emqx/log/erlang.log.1
|
./emqx/bin/emqx start || cat emqx/log/erlang.log.1
|
||||||
ready='no'
|
ready='no'
|
||||||
|
@ -91,46 +162,51 @@ jobs:
|
||||||
./emqx/bin/emqx_ctl status
|
./emqx/bin/emqx_ctl status
|
||||||
./emqx/bin/emqx stop
|
./emqx/bin/emqx stop
|
||||||
rm -rf emqx
|
rm -rf emqx
|
||||||
openssl dgst -sha256 ./_packages/emqx/$pkg_name | awk '{print $2}' > ./_packages/emqx/$pkg_name.sha256
|
openssl dgst -sha256 ./_packages/${{ matrix.profile }}/$pkg_name | awk '{print $2}' > ./_packages/${{ matrix.profile }}/$pkg_name.sha256
|
||||||
- uses: actions/upload-artifact@v1
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
name: emqx
|
name: ${{ matrix.profile }}
|
||||||
path: ./_packages/emqx/.
|
path: source/_packages/${{ matrix.profile }}/.
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
needs: prepare
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
|
||||||
arch:
|
arch:
|
||||||
- amd64
|
- amd64
|
||||||
- arm64
|
- arm64
|
||||||
emqx:
|
|
||||||
- emqx
|
|
||||||
- emqx-edge
|
|
||||||
os:
|
os:
|
||||||
- ubuntu20.04
|
- ubuntu20.04
|
||||||
- ubuntu18.04
|
- ubuntu18.04
|
||||||
- ubuntu16.04
|
- ubuntu16.04
|
||||||
- debian10
|
- debian10
|
||||||
- debian9
|
- debian9
|
||||||
- opensuse
|
# - opensuse
|
||||||
- centos8
|
- centos8
|
||||||
- centos7
|
- centos7
|
||||||
- centos6
|
- centos6
|
||||||
- raspbian10
|
- raspbian10
|
||||||
- raspbian9
|
- raspbian9
|
||||||
exclude:
|
exclude:
|
||||||
- os: raspbian9
|
|
||||||
arch: amd64
|
|
||||||
- os: raspbian9
|
|
||||||
emqx: emqx
|
|
||||||
- os: raspbian10
|
|
||||||
arch: amd64
|
|
||||||
- os: raspbian10
|
|
||||||
emqx: emqx
|
|
||||||
- os: centos6
|
- os: centos6
|
||||||
arch: arm64
|
arch: arm64
|
||||||
|
- os: raspbian9
|
||||||
|
arch: amd64
|
||||||
|
- os: raspbian10
|
||||||
|
arch: amd64
|
||||||
|
- os: raspbian9
|
||||||
|
profile: emqx
|
||||||
|
- os: raspbian10
|
||||||
|
profile: emqx
|
||||||
|
- os: raspbian9
|
||||||
|
profile: emqx-ee
|
||||||
|
- os: raspbian10
|
||||||
|
profile: emqx-ee
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
|
@ -146,71 +222,72 @@ jobs:
|
||||||
docker info
|
docker info
|
||||||
docker buildx create --use --name mybuild
|
docker buildx create --use --name mybuild
|
||||||
docker run --rm --privileged tonistiigi/binfmt --install all
|
docker run --rm --privileged tonistiigi/binfmt --install all
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/download-artifact@v2
|
||||||
- name: get deps
|
with:
|
||||||
env:
|
name: source
|
||||||
ERL_OTP: erl23.2.7
|
path: .
|
||||||
run: |
|
- name: unzip source code
|
||||||
docker run -i --rm \
|
run: unzip -q source.zip
|
||||||
-e GITHUB_RUN_ID=$GITHUB_RUN_ID \
|
|
||||||
-e GITHUB_REF=$GITHUB_REF \
|
|
||||||
-v $(pwd):/emqx \
|
|
||||||
-w /emqx \
|
|
||||||
emqx/build-env:${ERL_OTP}-debian10 \
|
|
||||||
bash -c "make deps-all"
|
|
||||||
- name: downloads emqx zip packages
|
- name: downloads emqx zip packages
|
||||||
env:
|
env:
|
||||||
EMQX: ${{ matrix.emqx }}
|
PROFILE: ${{ matrix.profile }}
|
||||||
ARCH: ${{ matrix.arch }}
|
ARCH: ${{ matrix.arch }}
|
||||||
SYSTEM: ${{ matrix.os }}
|
SYSTEM: ${{ matrix.os }}
|
||||||
run: |
|
run: |
|
||||||
set -e -u -x
|
set -e -u -x
|
||||||
if [ $EMQX = "emqx-edge" ];then broker="emqx-edge"; else broker="emqx-ce"; fi
|
cd source
|
||||||
if [ $ARCH = "arm64" ];then arch="aarch64"; else arch="x86_64"; fi
|
if [ $ARCH = "arm64" ];then arch="aarch64"; else arch="x86_64"; fi
|
||||||
|
if [ $PROFILE = "emqx" ];then broker="emqx-ce"; else broker="$PROFILE"; fi
|
||||||
|
if [ $PROFILE = "emqx-ee" ];then edition='enterprise'; else edition='opensource'; fi
|
||||||
|
|
||||||
vsn="$(grep -oE '\{vsn, (.*)\}' src/emqx.app.src | sed -r 's/\{vsn, (.*)\}/\1/g' | sed 's/\"//g')"
|
vsn="$(grep -E "define.+EMQX_RELEASE.+${edition}" include/emqx_release.hrl | cut -d '"' -f2)"
|
||||||
pre_vsn="$(echo $vsn | grep -oE '^[0-9]+.[0-9]')"
|
pre_vsn="$(echo $vsn | grep -oE '^[0-9]+.[0-9]')"
|
||||||
old_vsns=($(git tag -l "$pre_vsn.[0-9]" | sed "s/$vsn//"))
|
if [ $PROFILE = "emqx-ee" ]; then
|
||||||
|
old_vsns=($(git tag -l "e$pre_vsn.[0-9]" | sed "s/e$vsn//"))
|
||||||
|
else
|
||||||
|
old_vsns=($(git tag -l "v$pre_vsn.[0-9]" | sed "s/v$vsn//"))
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p tmp/relup_packages/$EMQX
|
mkdir -p tmp/relup_packages/$PROFILE
|
||||||
cd tmp/relup_packages/$EMQX
|
cd tmp/relup_packages/$PROFILE
|
||||||
for tag in ${old_vsns[@]};do
|
for tag in ${old_vsns[@]};do
|
||||||
if [ ! -z "$(echo $(curl -I -m 10 -o /dev/null -s -w %{http_code} https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/v${tag#[e|v]}/$EMQX-$SYSTEM-${tag#[e|v]}-$arch.zip) | grep -oE "^[23]+")" ];then
|
if [ ! -z "$(echo $(curl -I -m 10 -o /dev/null -s -w %{http_code} https://s3-${{ secrets.AWS_DEFAULT_REGION }}.amazonaws.com/${{ secrets.AWS_S3_BUCKET }}/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$arch.zip) | grep -oE "^[23]+")" ];then
|
||||||
wget https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/v${tag#[e|v]}/$EMQX-$SYSTEM-${tag#[e|v]}-$arch.zip
|
wget https://s3-${{ secrets.AWS_DEFAULT_REGION }}.amazonaws.com/${{ secrets.AWS_S3_BUCKET }}/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$arch.zip
|
||||||
wget https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/v${tag#[e|v]}/$EMQX-$SYSTEM-${tag#[e|v]}-$arch.zip.sha256
|
wget https://s3-${{ secrets.AWS_DEFAULT_REGION }}.amazonaws.com/${{ secrets.AWS_S3_BUCKET }}/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$arch.zip.sha256
|
||||||
echo "$(cat $EMQX-$SYSTEM-${tag#[e|v]}-$arch.zip.sha256) $EMQX-$SYSTEM-${tag#[e|v]}-$arch.zip" | sha256sum -c || exit 1
|
echo "$(cat $PROFILE-$SYSTEM-${tag#[e|v]}-$arch.zip.sha256) $PROFILE-$SYSTEM-${tag#[e|v]}-$arch.zip" | sha256sum -c || exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
cd -
|
cd -
|
||||||
- name: build emqx packages
|
- name: build emqx packages
|
||||||
env:
|
env:
|
||||||
ERL_OTP: erl23.2.7
|
ERL_OTP: erl23.2.7
|
||||||
EMQX: ${{ matrix.emqx }}
|
PROFILE: ${{ matrix.profile }}
|
||||||
ARCH: ${{ matrix.arch }}
|
ARCH: ${{ matrix.arch }}
|
||||||
SYSTEM: ${{ matrix.os }}
|
SYSTEM: ${{ matrix.os }}
|
||||||
run: |
|
run: |
|
||||||
set -e -u -x
|
set -e -u
|
||||||
|
cd source
|
||||||
docker buildx build --no-cache \
|
docker buildx build --no-cache \
|
||||||
--platform=linux/$ARCH \
|
--platform=linux/$ARCH \
|
||||||
-t cross_build_emqx_for_$SYSTEM \
|
-t cross_build_emqx_for_$SYSTEM \
|
||||||
-f .ci/build_packages/Dockerfile \
|
-f .ci/build_packages/Dockerfile \
|
||||||
--build-arg BUILD_FROM=emqx/build-env:$ERL_OTP-$SYSTEM \
|
--build-arg BUILD_FROM=emqx/build-env:$ERL_OTP-$SYSTEM \
|
||||||
--build-arg EMQX_NAME=$EMQX \
|
--build-arg EMQX_NAME=$PROFILE \
|
||||||
--output type=tar,dest=/tmp/cross-build-$EMQX-for-$SYSTEM.tar .
|
--output type=tar,dest=/tmp/cross-build-$PROFILE-for-$SYSTEM.tar .
|
||||||
|
|
||||||
mkdir -p /tmp/packages/$EMQX
|
mkdir -p /tmp/packages/$PROFILE
|
||||||
tar -xvf /tmp/cross-build-$EMQX-for-$SYSTEM.tar --wildcards emqx/_packages/$EMQX/*
|
tar -xvf /tmp/cross-build-$PROFILE-for-$SYSTEM.tar --wildcards emqx/_packages/$PROFILE/*
|
||||||
mv emqx/_packages/$EMQX/* /tmp/packages/$EMQX/
|
mv emqx/_packages/$PROFILE/* /tmp/packages/$PROFILE/
|
||||||
rm -rf /tmp/cross-build-$EMQX-for-$SYSTEM.tar
|
rm -rf /tmp/cross-build-$PROFILE-for-$SYSTEM.tar
|
||||||
|
|
||||||
docker rm -f $(docker ps -a -q)
|
docker rm -f $(docker ps -a -q)
|
||||||
docker volume prune -f
|
docker volume prune -f
|
||||||
- name: create sha256
|
- name: create sha256
|
||||||
env:
|
env:
|
||||||
EMQX: ${{ matrix.emqx }}
|
PROFILE: ${{ matrix.profile}}
|
||||||
run: |
|
run: |
|
||||||
if [ -d /tmp/packages/$EMQX ]; then
|
if [ -d /tmp/packages/$PROFILE ]; then
|
||||||
cd /tmp/packages/$EMQX
|
cd /tmp/packages/$PROFILE
|
||||||
for var in $(ls emqx-* ); do
|
for var in $(ls emqx-* ); do
|
||||||
bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"
|
bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"
|
||||||
done
|
done
|
||||||
|
@ -219,52 +296,74 @@ jobs:
|
||||||
- uses: actions/upload-artifact@v1
|
- uses: actions/upload-artifact@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.emqx }}
|
name: ${{ matrix.profile }}
|
||||||
path: /tmp/packages/${{ matrix.emqx }}/.
|
path: /tmp/packages/${{ matrix.profile }}/.
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
needs: prepare
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
|
||||||
arch:
|
arch:
|
||||||
- [amd64, x86_64]
|
- [amd64, x86_64]
|
||||||
- [arm64v8, aarch64]
|
- [arm64v8, aarch64]
|
||||||
- [arm32v7, arm]
|
- [arm32v7, arm]
|
||||||
- [i386, i386]
|
- [i386, i386]
|
||||||
- [s390x, s390x]
|
- [s390x, s390x]
|
||||||
|
exclude:
|
||||||
|
- profile: emqx-ee
|
||||||
|
arch: [i386, i386]
|
||||||
|
- profile: emqx-ee
|
||||||
|
arch: [s390x, s390x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: source
|
||||||
|
path: .
|
||||||
|
- name: unzip source code
|
||||||
|
run: unzip -q source.zip
|
||||||
- name: build emqx docker image
|
- name: build emqx docker image
|
||||||
env:
|
env:
|
||||||
|
PROFILE: ${{ matrix.profile }}
|
||||||
ARCH: ${{ matrix.arch[0] }}
|
ARCH: ${{ matrix.arch[0] }}
|
||||||
QEMU_ARCH: ${{ matrix.arch[1] }}
|
QEMU_ARCH: ${{ matrix.arch[1] }}
|
||||||
run: |
|
run: |
|
||||||
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||||
|
|
||||||
sudo TARGET=emqx/emqx ARCH=$ARCH QEMU_ARCH=$QEMU_ARCH make docker
|
cd source
|
||||||
cd _packages/emqx && for var in $(ls emqx-docker-* ); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
|
sudo TARGET=emqx/$PROFILE ARCH=$ARCH QEMU_ARCH=$QEMU_ARCH make docker
|
||||||
|
cd _packages/$PROFILE && for var in $(ls ${PROFILE}-docker-* ); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.profile }}
|
||||||
|
path: source/_packages/${{ matrix.profile }}/.
|
||||||
|
|
||||||
sudo TARGET=emqx/emqx-edge ARCH=$ARCH QEMU_ARCH=$QEMU_ARCH make docker
|
delete-artifact:
|
||||||
cd _packages/emqx-edge && for var in $(ls emqx-edge-docker-* ); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
|
runs-on: ubuntu-20.04
|
||||||
- uses: actions/upload-artifact@v1
|
needs: [prepare, windows, mac, linux, docker]
|
||||||
|
steps:
|
||||||
|
- uses: geekyeggo/delete-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: emqx
|
name: source
|
||||||
path: ./_packages/emqx/.
|
|
||||||
- uses: actions/upload-artifact@v1
|
|
||||||
with:
|
|
||||||
name: emqx-edge
|
|
||||||
path: ./_packages/emqx-edge/.
|
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
needs: [windows, mac, linux, docker]
|
|
||||||
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
|
||||||
|
needs: [prepare, windows, mac, linux, docker]
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
- name: get_version
|
- name: get_version
|
||||||
run: |
|
run: |
|
||||||
echo 'version<<EOF' >> $GITHUB_ENV
|
echo 'version<<EOF' >> $GITHUB_ENV
|
||||||
|
@ -272,47 +371,38 @@ jobs:
|
||||||
echo 'EOF' >> $GITHUB_ENV
|
echo 'EOF' >> $GITHUB_ENV
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: emqx
|
name: ${{ matrix.profile }}
|
||||||
path: ./_packages/emqx
|
path: ./_packages/${{ matrix.profile }}
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: emqx-edge
|
|
||||||
path: ./_packages/emqx-edge
|
|
||||||
- name: install dos2unix
|
- name: install dos2unix
|
||||||
run: sudo apt-get update && sudo apt install -y dos2unix
|
run: sudo apt-get update && sudo apt install -y dos2unix
|
||||||
- name: get packages
|
- name: get packages
|
||||||
run: |
|
run: |
|
||||||
set -e -x -u
|
set -e -u
|
||||||
for EMQX in emqx emqx-edge; do
|
cd _packages/${{ matrix.profile }}
|
||||||
cd _packages/$EMQX
|
|
||||||
for var in $( ls |grep emqx |grep -v sha256); do
|
for var in $( ls |grep emqx |grep -v sha256); do
|
||||||
dos2unix $var.sha256
|
dos2unix $var.sha256
|
||||||
echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
|
echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
|
||||||
done
|
done
|
||||||
cd -
|
cd -
|
||||||
done
|
|
||||||
- name: upload aws s3
|
- name: upload aws s3
|
||||||
run: |
|
run: |
|
||||||
set -e -x -u
|
set -e -u
|
||||||
|
if [ "${{ matrix.profile }}" == "emqx" ];then
|
||||||
|
broker="emqx-ce"
|
||||||
|
else
|
||||||
|
broker=${{ matrix.profile }}
|
||||||
|
fi
|
||||||
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
|
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
aws configure set default.region us-west-2
|
aws configure set default.region ${{ secrets.AWS_DEFAULT_REGION }}
|
||||||
|
|
||||||
aws s3 cp --recursive _packages/emqx s3://packages.emqx/emqx-ce/${{ env.version }}
|
aws s3 cp --recursive _packages/${{ matrix.profile }} s3://${{ secrets.AWS_S3_BUCKET }}/$broker/${{ env.version }}
|
||||||
aws s3 cp --recursive _packages/emqx-edge s3://packages.emqx/emqx-edge/${{ env.version }}
|
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$broker/${{ env.version }}/*"
|
||||||
aws cloudfront create-invalidation --distribution-id E170YEULGLT8XB --paths "/emqx-ce/${{ env.version }}/*,/emqx-edge/${{ env.version }}/*"
|
|
||||||
|
|
||||||
mkdir packages
|
|
||||||
mv _packages/emqx/* packages
|
|
||||||
mv _packages/emqx-edge/* packages
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
path: emqx
|
|
||||||
- uses: Rory-Z/upload-release-asset@v1
|
- uses: Rory-Z/upload-release-asset@v1
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
with:
|
with:
|
||||||
repo: emqx
|
repo: emqx
|
||||||
path: "packages/emqx-*"
|
path: "_packages/${{ matrix.profile }}/emqx-*"
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
- name: update to emqx.io
|
- name: update to emqx.io
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
|
@ -329,15 +419,22 @@ jobs:
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
run: |
|
run: |
|
||||||
set -e -x -u
|
set -e -x -u
|
||||||
sudo make -C emqx docker-prepare
|
sudo make docker-prepare
|
||||||
cd packages && for var in $(ls |grep docker |grep -v sha256); do unzip $var; sudo docker load < ${var%.*}; rm -f ${var%.*}; done && cd -
|
cd _packages/${{ matrix.profile }} && for var in $(ls |grep docker |grep -v sha256); do unzip $var; sudo docker load < ${var%.*}; rm -f ${var%.*}; done && cd -
|
||||||
echo ${{ secrets.DOCKER_HUB_TOKEN }} |sudo docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
|
echo ${{ secrets.DOCKER_HUB_TOKEN }} |sudo docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
|
||||||
sudo TARGET=emqx/emqx make -C emqx docker-push
|
sudo TARGET=emqx/${{ matrix.profile }} make docker-push
|
||||||
sudo TARGET=emqx/emqx make -C emqx docker-manifest-list
|
sudo TARGET=emqx/${{ matrix.profile }} make docker-manifest-list
|
||||||
sudo TARGET=emqx/emqx-edge make -C emqx docker-push
|
|
||||||
sudo TARGET=emqx/emqx-edge make -C emqx docker-manifest-list
|
|
||||||
- name: update repo.emqx.io
|
- name: update repo.emqx.io
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release' && endsWith(github.repository, 'enterprise') && matrix.profile == 'emqx-ee'
|
||||||
|
run: |
|
||||||
|
curl --silent --show-error \
|
||||||
|
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
|
||||||
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ee\": \"true\"}}" \
|
||||||
|
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
|
||||||
|
- name: update repo.emqx.io
|
||||||
|
if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx'
|
||||||
run: |
|
run: |
|
||||||
curl --silent --show-error \
|
curl --silent --show-error \
|
||||||
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
|
||||||
|
@ -346,7 +443,7 @@ jobs:
|
||||||
-d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ce\": \"true\"}}" \
|
-d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ce\": \"true\"}}" \
|
||||||
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
|
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
|
||||||
- name: update homebrew packages
|
- name: update homebrew packages
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx'
|
||||||
run: |
|
run: |
|
||||||
if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
|
if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
|
||||||
curl --silent --show-error \
|
curl --silent --show-error \
|
||||||
|
@ -358,7 +455,4 @@ jobs:
|
||||||
fi
|
fi
|
||||||
- uses: geekyeggo/delete-artifact@v1
|
- uses: geekyeggo/delete-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: emqx
|
name: ${{ matrix.profile }}
|
||||||
- uses: geekyeggo/delete-artifact@v1
|
|
||||||
with:
|
|
||||||
name: emqx-edge
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
name: Build slim packages
|
name: Build slim packages
|
||||||
|
|
||||||
on: [pull_request]
|
on:
|
||||||
|
- pull_request
|
||||||
|
- workflow_dispatch
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -12,15 +14,27 @@ jobs:
|
||||||
- erl23.2.7
|
- erl23.2.7
|
||||||
os:
|
os:
|
||||||
- ubuntu20.04
|
- ubuntu20.04
|
||||||
- centos8
|
- centos7
|
||||||
|
|
||||||
container: emqx/build-env:${{ matrix.erl_otp }}-${{ matrix.os }}
|
container: emqx/build-env:${{ matrix.erl_otp }}-${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: build packages
|
- name: build packages
|
||||||
run: make emqx-pkg
|
run: |
|
||||||
|
if make -C source emqx-ee --dry-run > /dev/null 2>&1; then
|
||||||
|
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
|
||||||
|
git config --global credential.helper store
|
||||||
|
echo "${{ secrets.CI_GIT_TOKEN }}" >> source/scripts/git-token
|
||||||
|
make emqx-ee-pkg
|
||||||
|
else
|
||||||
|
make emqx-pkg
|
||||||
|
fi
|
||||||
- name: pakcages test
|
- name: pakcages test
|
||||||
run: |
|
run: |
|
||||||
export CODE_PATH=$GITHUB_WORKSPACE
|
export CODE_PATH=$GITHUB_WORKSPACE
|
||||||
.ci/build_packages/tests.sh
|
.ci/build_packages/tests.sh
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.os }}
|
||||||
|
path: _packages/**/*.zip
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -100,7 +100,7 @@ ifneq ($(OS),Windows_NT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: $(REL_PROFILES:%=%-tar) $(PKG_PROFILES:%=%-tar)
|
.PHONY: $(REL_PROFILES:%=%-tar) $(PKG_PROFILES:%=%-tar)
|
||||||
$(REL_PROFILES:%=%-tar) $(PKG_PROFILES:%=%-tar): $(REBAR) get-dashboard
|
$(REL_PROFILES:%=%-tar) $(PKG_PROFILES:%=%-tar): $(REBAR) get-dashboard $(CONF_SEGS)
|
||||||
@$(BUILD) $(subst -tar,,$(@)) tar
|
@$(BUILD) $(subst -tar,,$(@)) tar
|
||||||
|
|
||||||
## zip targets depend on the corresponding relup and tar artifacts
|
## zip targets depend on the corresponding relup and tar artifacts
|
||||||
|
|
|
@ -14,11 +14,9 @@ all: | $(BUILT)
|
||||||
cp -r debian $(SRCDIR)/
|
cp -r debian $(SRCDIR)/
|
||||||
sed -i "s#<DATETIME>#$(shell date -u '+%a, %d %b %Y %T %z')#g" $(SRCDIR)/debian/changelog
|
sed -i "s#<DATETIME>#$(shell date -u '+%a, %d %b %Y %T %z')#g" $(SRCDIR)/debian/changelog
|
||||||
sed -i "s#<VERSION>#$(PKG_VSN)#g" $(SRCDIR)/debian/changelog
|
sed -i "s#<VERSION>#$(PKG_VSN)#g" $(SRCDIR)/debian/changelog
|
||||||
if [ ! -z $(shell echo $(EMQX_NAME) |grep edge) ]; then \
|
sed -i "s/emqx-pkg/$(EMQX_NAME)-pkg/g" $(SRCDIR)/debian/rules; \
|
||||||
sed -i "s/emqx-pkg/emqx-edge-pkg/g" $(SRCDIR)/debian/rules; \
|
sed -i "s debian/emqx debian/$(EMQX_NAME) g" $(SRCDIR)/debian/rules; \
|
||||||
sed -i "s debian/emqx debian/emqx-edge g" $(SRCDIR)/debian/rules; \
|
sed -i "s/Package: emqx/Package: $(EMQX_NAME)/1" $(SRCDIR)/debian/control; \
|
||||||
sed -i "s/Package: emqx/Package: emqx-edge/1" $(SRCDIR)/debian/control; \
|
|
||||||
fi
|
|
||||||
cd $(SRCDIR) && dpkg-buildpackage -us -uc
|
cd $(SRCDIR) && dpkg-buildpackage -us -uc
|
||||||
mkdir -p $(EMQX_REL)/_packages/$(EMQX_NAME)
|
mkdir -p $(EMQX_REL)/_packages/$(EMQX_NAME)
|
||||||
cp $(SRCDIR)/../$(SOURCE_PKG).deb $(EMQX_REL)/_packages/$(EMQX_NAME)/$(TARGET_PKG).deb
|
cp $(SRCDIR)/../$(SOURCE_PKG).deb $(EMQX_REL)/_packages/$(EMQX_NAME)/$(TARGET_PKG).deb
|
||||||
|
|
|
@ -9,12 +9,16 @@ QEMU_VERSION ?= v5.0.0-2
|
||||||
OS ?= alpine
|
OS ?= alpine
|
||||||
export PKG_VSN ?= $(shell $(CURDIR)/pkg-vsn.sh)
|
export PKG_VSN ?= $(shell $(CURDIR)/pkg-vsn.sh)
|
||||||
|
|
||||||
ifeq ($(findstring emqx-edge, $(TARGET)), emqx-edge)
|
ifeq ($(findstring emqx-ee, $(TARGET)), emqx-ee)
|
||||||
|
ARCH_LIST := amd64 arm64v8 arm32v7
|
||||||
|
EMQX_NAME := emqx-ee
|
||||||
|
else ifeq ($(findstring emqx-edge, $(TARGET)), emqx-edge)
|
||||||
|
ARCH_LIST := amd64 arm64v8 arm32v7 i386 s390x
|
||||||
EMQX_NAME := emqx-edge
|
EMQX_NAME := emqx-edge
|
||||||
else
|
else
|
||||||
|
ARCH_LIST := amd64 arm64v8 arm32v7 i386 s390x
|
||||||
EMQX_NAME := emqx
|
EMQX_NAME := emqx
|
||||||
endif
|
endif
|
||||||
ARCH_LIST = amd64 arm64v8 arm32v7 i386 s390x
|
|
||||||
|
|
||||||
.PHONY: docker
|
.PHONY: docker
|
||||||
docker: docker-build docker-tag docker-save
|
docker: docker-build docker-tag docker-save
|
||||||
|
|
Loading…
Reference in New Issue