Compare commits

...

4 Commits

Author SHA1 Message Date
mengzhenyu eb3a2e258b chore(autotest): broker 5.0 new packages 2021-11-16 10:30:17 +08:00
mengzhenyu 96e4c35aa8 chore(autotest): broker 5.0 new packages 2021-11-16 10:29:49 +08:00
mengzhenyu 9a9a26a9a0 chore(autotest): build broker 5.0 packges 2021-11-16 10:28:39 +08:00
mengzhenyu 167de6c975 chore(autotest): build broker 5.0 packges 2021-11-16 10:28:39 +08:00
2 changed files with 256 additions and 253 deletions

View File

@ -5,6 +5,7 @@ concurrency:
cancel-in-progress: true
on:
push:
schedule:
- cron: '0 */6 * * *'
release:
@ -71,77 +72,77 @@ jobs:
name: source-${{ steps.get_otp_version.outputs.otp }}
path: source-${{ steps.get_otp_version.outputs.otp }}.zip
windows:
runs-on: windows-2019
needs: prepare
if: endsWith(github.repository, 'emqx')
strategy:
fail-fast: false
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
exclude:
- profile: emqx-edge
steps:
- uses: actions/download-artifact@v2
with:
name: source-23.2.7.2-emqx-2
path: .
- name: unzip source code
run: Expand-Archive -Path source-23.2.7.2-emqx-2.zip -DestinationPath ./
- uses: ilammy/msvc-dev-cmd@v1
- uses: gleam-lang/setup-erlang@v1.1.2
id: install_erlang
## gleam-lang/setup-erlang does not yet support the installation of otp24 on windows
with:
otp-version: 23.2
- name: build
env:
PYTHON: python
DIAGNOSTIC: 1
working-directory: source
run: |
$env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH"
$version = $( "${{ github.ref }}" -replace "^(.*)/(.*)/" )
if ($version -match "^v[0-9]+\.[0-9]+(\.[0-9]+)?") {
$regex = "[0-9]+\.[0-9]+(-alpha|-beta|-rc)?\.[0-9]+"
$pkg_name = "${{ matrix.profile }}-windows-$([regex]::matches($version, $regex).value).zip"
}
else {
$pkg_name = "${{ matrix.profile }}-windows-$($version -replace '/').zip"
}
## We do not build/release bcrypt and quic for windows package
Remove-Item -Recurse -Force -Path _build/default/lib/bcrypt/
Remove-Item -Recurse -Force -Path _build/default/lib/quicer/
if (Test-Path rebar.lock) {
Remove-Item -Force -Path rebar.lock
}
make ensure-rebar3
copy rebar3 "${{ steps.install_erlang.outputs.erlpath }}\bin"
ls "${{ steps.install_erlang.outputs.erlpath }}\bin"
rebar3 --help
make ${{ matrix.profile }}
mkdir -p _packages/${{ matrix.profile }}
Compress-Archive -Path _build/${{ matrix.profile }}/rel/emqx -DestinationPath _build/${{ matrix.profile }}/rel/$pkg_name
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
timeout-minutes: 1
working-directory: source
run: |
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
Start-Sleep -s 5
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
- uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ matrix.profile }}-23.2.7.2-emqx-2
path: source/_packages/${{ matrix.profile }}/.
# windows:
# runs-on: windows-2019
#
# needs: prepare
# if: endsWith(github.repository, 'emqx')
#
# strategy:
# fail-fast: false
# matrix:
# profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
# exclude:
# - profile: emqx-edge
#
# steps:
# - uses: actions/download-artifact@v2
# with:
# name: source-23.2.7.2-emqx-2
# path: .
# - name: unzip source code
# run: Expand-Archive -Path source-23.2.7.2-emqx-2.zip -DestinationPath ./
# - uses: ilammy/msvc-dev-cmd@v1
# - uses: gleam-lang/setup-erlang@v1.1.2
# id: install_erlang
# ## gleam-lang/setup-erlang does not yet support the installation of otp24 on windows
# with:
# otp-version: 23.2
# - name: build
# env:
# PYTHON: python
# DIAGNOSTIC: 1
# working-directory: source
# run: |
# $env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH"
#
# $version = $( "${{ github.ref }}" -replace "^(.*)/(.*)/" )
# if ($version -match "^v[0-9]+\.[0-9]+(\.[0-9]+)?") {
# $regex = "[0-9]+\.[0-9]+(-alpha|-beta|-rc)?\.[0-9]+"
# $pkg_name = "${{ matrix.profile }}-windows-$([regex]::matches($version, $regex).value).zip"
# }
# else {
# $pkg_name = "${{ matrix.profile }}-windows-$($version -replace '/').zip"
# }
# ## We do not build/release bcrypt and quic for windows package
# Remove-Item -Recurse -Force -Path _build/default/lib/bcrypt/
# Remove-Item -Recurse -Force -Path _build/default/lib/quicer/
# if (Test-Path rebar.lock) {
# Remove-Item -Force -Path rebar.lock
# }
# make ensure-rebar3
# copy rebar3 "${{ steps.install_erlang.outputs.erlpath }}\bin"
# ls "${{ steps.install_erlang.outputs.erlpath }}\bin"
# rebar3 --help
# make ${{ matrix.profile }}
# mkdir -p _packages/${{ matrix.profile }}
# Compress-Archive -Path _build/${{ matrix.profile }}/rel/emqx -DestinationPath _build/${{ matrix.profile }}/rel/$pkg_name
# 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
# timeout-minutes: 1
# working-directory: source
# run: |
# ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
# Start-Sleep -s 5
# ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
# ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
# ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
# - uses: actions/upload-artifact@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# name: ${{ matrix.profile }}-23.2.7.2-emqx-2
# path: source/_packages/${{ matrix.profile }}/.
mac:
@ -222,181 +223,181 @@ jobs:
name: ${{ matrix.profile }}-${{ matrix.otp }}
path: source/_packages/${{ matrix.profile }}/.
linux:
runs-on: ubuntu-20.04
needs: prepare
strategy:
fail-fast: false
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
os:
- ubuntu20.04
- ubuntu18.04
- ubuntu16.04
- debian10
- debian9
# - opensuse
- centos8
- centos7
- centos6
- raspbian10
# - raspbian9
arch:
- amd64
- arm64
otp:
- 23.2.7.2-emqx-2
- 24.1.1-emqx-1
exclude:
- os: centos6
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:
run:
shell: bash
steps:
- uses: docker/setup-buildx-action@v1
- uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- uses: actions/download-artifact@v2
with:
name: source-${{ matrix.otp }}
path: .
- name: unzip source code
run: unzip -q source-${{ matrix.otp }}.zip
- name: downloads old emqx zip packages
env:
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }}
SYSTEM: ${{ matrix.os }}
OLD_VSNS: ${{ needs.prepare.outputs.old_vsns }}
working-directory: source
run: |
set -e -x -u
broker=$PROFILE
if [ $PROFILE = "emqx" ];then
broker="emqx-ce"
fi
if [ ! -z "$(echo $SYSTEM | grep -oE 'raspbian')" ]; then
export ARCH="arm"
fi
mkdir -p _upgrade_base
cd _upgrade_base
old_vsns=($(echo $OLD_VSNS | tr ' ' ' '))
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/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip) | grep -oE "^[23]+")" ];then
wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip
wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip.sha256
echo "$(cat $PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip.sha256) $PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip" | sha256sum -c || exit 1
fi
done
- name: build emqx packages
env:
OTP: ${{ matrix.otp }}
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }}
SYSTEM: ${{ matrix.os }}
working-directory: source
run: |
docker run -i --rm \
-v $(pwd):/emqx \
--workdir /emqx \
--platform linux/$ARCH \
ghcr.io/emqx/emqx-builder/5.0:$OTP-$SYSTEM \
bash -euc "make $PROFILE-zip || cat rebar3.crashdump; \
make $PROFILE-pkg || cat rebar3.crashdump; \
EMQX_NAME=$PROFILE && .ci/build_packages/tests.sh"
- name: create sha256
env:
PROFILE: ${{ matrix.profile}}
working-directory: source
run: |
if [ -d _packages/$PROFILE ]; then
cd _packages/$PROFILE
for var in $(ls emqx-* ); do
sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"
done
cd -
fi
- uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ matrix.profile }}-${{ matrix.otp }}
path: source/_packages/${{ matrix.profile }}/.
docker:
runs-on: ubuntu-20.04
needs: prepare
strategy:
fail-fast: false
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
otp:
- 24.1.1-emqx-1
steps:
- uses: actions/download-artifact@v2
with:
name: source-${{ matrix.otp }}
path: .
- name: unzip source code
run: unzip -q source-${{ matrix.otp }}.zip
- uses: docker/setup-buildx-action@v1
- uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- uses: docker/metadata-action@v3
id: meta
with:
images: ${{ github.repository_owner }}/${{ matrix.profile }}
flavor: |
latest=${{ !github.event.release.prerelease }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/login-action@v1
if: github.event_name == 'release'
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/build-push-action@v2
with:
push: ${{ github.event_name == 'release' }}
pull: true
no-cache: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0:${{ matrix.otp }}-alpine3.14
RUN_FROM=alpine:3.14
EMQX_NAME=${{ matrix.profile }}
file: source/deploy/docker/Dockerfile
context: source
# linux:
# runs-on: ubuntu-20.04
#
# needs: prepare
#
# strategy:
# fail-fast: false
# matrix:
# profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
# os:
# - ubuntu20.04
# - ubuntu18.04
# - ubuntu16.04
# - debian10
# - debian9
# # - opensuse
# - centos8
# - centos7
# - centos6
# - raspbian10
# # - raspbian9
# arch:
# - amd64
# - arm64
# otp:
# - 23.2.7.2-emqx-2
# - 24.1.1-emqx-1
# exclude:
# - os: centos6
# 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:
# run:
# shell: bash
#
# steps:
# - uses: docker/setup-buildx-action@v1
# - uses: docker/setup-qemu-action@v1
# with:
# image: tonistiigi/binfmt:latest
# platforms: all
# - uses: actions/download-artifact@v2
# with:
# name: source-${{ matrix.otp }}
# path: .
# - name: unzip source code
# run: unzip -q source-${{ matrix.otp }}.zip
# - name: downloads old emqx zip packages
# env:
# PROFILE: ${{ matrix.profile }}
# ARCH: ${{ matrix.arch }}
# SYSTEM: ${{ matrix.os }}
# OLD_VSNS: ${{ needs.prepare.outputs.old_vsns }}
# working-directory: source
# run: |
# set -e -x -u
# broker=$PROFILE
# if [ $PROFILE = "emqx" ];then
# broker="emqx-ce"
# fi
# if [ ! -z "$(echo $SYSTEM | grep -oE 'raspbian')" ]; then
# export ARCH="arm"
# fi
#
# mkdir -p _upgrade_base
# cd _upgrade_base
# old_vsns=($(echo $OLD_VSNS | tr ' ' ' '))
# 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/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip) | grep -oE "^[23]+")" ];then
# wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip
# wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip.sha256
# echo "$(cat $PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip.sha256) $PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip" | sha256sum -c || exit 1
# fi
# done
# - name: build emqx packages
# env:
# OTP: ${{ matrix.otp }}
# PROFILE: ${{ matrix.profile }}
# ARCH: ${{ matrix.arch }}
# SYSTEM: ${{ matrix.os }}
# working-directory: source
# run: |
# docker run -i --rm \
# -v $(pwd):/emqx \
# --workdir /emqx \
# --platform linux/$ARCH \
# ghcr.io/emqx/emqx-builder/5.0:$OTP-$SYSTEM \
# bash -euc "make $PROFILE-zip || cat rebar3.crashdump; \
# make $PROFILE-pkg || cat rebar3.crashdump; \
# EMQX_NAME=$PROFILE && .ci/build_packages/tests.sh"
# - name: create sha256
# env:
# PROFILE: ${{ matrix.profile}}
# working-directory: source
# run: |
# if [ -d _packages/$PROFILE ]; then
# cd _packages/$PROFILE
# for var in $(ls emqx-* ); do
# sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"
# done
# cd -
# fi
# - uses: actions/upload-artifact@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# name: ${{ matrix.profile }}-${{ matrix.otp }}
# path: source/_packages/${{ matrix.profile }}/.
#
# docker:
# runs-on: ubuntu-20.04
# needs: prepare
#
# strategy:
# fail-fast: false
# matrix:
# profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
# otp:
# - 24.1.1-emqx-1
#
# steps:
# - uses: actions/download-artifact@v2
# with:
# name: source-${{ matrix.otp }}
# path: .
# - name: unzip source code
# run: unzip -q source-${{ matrix.otp }}.zip
# - uses: docker/setup-buildx-action@v1
# - uses: docker/setup-qemu-action@v1
# with:
# image: tonistiigi/binfmt:latest
# platforms: all
# - uses: docker/metadata-action@v3
# id: meta
# with:
# images: ${{ github.repository_owner }}/${{ matrix.profile }}
# flavor: |
# latest=${{ !github.event.release.prerelease }}
# tags: |
# type=ref,event=branch
# type=ref,event=pr
# type=ref,event=tag
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
# - uses: docker/login-action@v1
# if: github.event_name == 'release'
# with:
# username: ${{ secrets.DOCKER_HUB_USER }}
# password: ${{ secrets.DOCKER_HUB_TOKEN }}
# - uses: docker/build-push-action@v2
# with:
# push: ${{ github.event_name == 'release' }}
# pull: true
# no-cache: true
# platforms: linux/amd64,linux/arm64
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# build-args: |
# BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0:${{ matrix.otp }}-alpine3.14
# RUN_FROM=alpine:3.14
# EMQX_NAME=${{ matrix.profile }}
# file: source/deploy/docker/Dockerfile
# context: source
#
delete-artifact:
runs-on: ubuntu-20.04
@ -405,7 +406,8 @@ jobs:
otp:
- 23.2.7.2-emqx-2
- 24.1.1-emqx-1
needs: [prepare, mac, linux, docker]
# needs: [prepare, mac, linux, docker]
needs: [mac]
steps:
- uses: geekyeggo/delete-artifact@v1
with:
@ -416,7 +418,8 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
needs: [prepare, mac, linux, docker]
# needs: [prepare, mac, linux, docker]
needs: [mac]
strategy:
matrix:

View File

@ -7,11 +7,11 @@ concurrency:
on:
push:
tags:
- v*
- e*
pull_request:
workflow_dispatch:
# tags:
# - v*
# - e*
# pull_request:
# workflow_dispatch:
jobs:
build: