-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from emqx/ci-build-and-publish-packages
ci: build and publish binary packages
- Loading branch information
Showing
7 changed files
with
205 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,23 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
branches: | ||
- master | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
otp: [24] | ||
otp: | ||
- 24 | ||
container: | ||
image: erlang:${{ matrix.otp }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Compile and run tests | ||
run: BUILD_WITHOUT_QUIC=true make | ||
|
||
# services: | ||
# emqx: | ||
# image: emqx:4.4 | ||
# ports: | ||
# - 1883:1883 | ||
env: | ||
BUILD_WITHOUT_QUIC: "true" | ||
run: make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
type: string | ||
required: true | ||
dryrun: | ||
type: boolean | ||
required: true | ||
default: false | ||
|
||
jobs: | ||
package: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
otp: | ||
- "24" | ||
quic_support: | ||
- true | ||
- false | ||
os: | ||
- ubuntu22.04 | ||
- ubuntu20.04 | ||
- ubuntu18.04 | ||
- ubuntu16.04 | ||
- debian10 | ||
- debian9 | ||
- rockylinux8 | ||
- rockylinux9 | ||
- centos7 | ||
- amzn2 | ||
container: | ||
image: erlang:${{ matrix.otp }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- shell: bash | ||
run: | | ||
[ "false" == ${{ matrix.quic_support }} ] && export BUILD_WITHOUT_QUIC=1 | ||
make release | ||
- if: failure() | ||
run: cat rebar3.crashdump | ||
- run: ./_build/default/bin/emqttb | ||
- uses: actions/upload-artifact@v3 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
name: packages | ||
path: ./*.tar.gz | ||
|
||
mac: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
macos: | ||
- macos-12 | ||
otp: | ||
- "24" | ||
|
||
runs-on: ${{ matrix.macos }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: prepare | ||
env: | ||
HOMEBREW_NO_AUTO_UPDATE: 1 | ||
HOMEBREW_NO_INSTALL_UPGRADE: 1 | ||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 | ||
run: brew install coreutils erlang@${{ matrix.otp }} | ||
- name: build | ||
shell: bash | ||
run: make release | ||
- if: failure() | ||
run: cat rebar3.crashdump | ||
- run: ./_build/default/bin/emqttb | ||
- uses: actions/upload-artifact@v3 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
name: packages | ||
path: ./*.tar.gz | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: package | ||
if: startsWith(github.ref, 'refs/tags/') && !inputs.dryrun | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: packages | ||
path: packages | ||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: EMQTT bench daemon ${{ github.ref }} Released | ||
body: EMQTT bench daemon ${{ github.ref }} Released | ||
draft: false | ||
prerelease: false | ||
- uses: Rory-Z/upload-release-asset@v1 | ||
with: | ||
repo: emqttb | ||
path: "packages/emqttb-*" | ||
token: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,9 @@ _build | |
rebar3.crashdump | ||
*~ | ||
docs/ | ||
TAGS | ||
TAGS | ||
/rebar.lock | ||
/.emqttb.repeat | ||
/*.tar.gz | ||
/emqttb | ||
/libquicer_nif.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
.PHONY: all dialyzer compile | ||
REBAR ?= rebar3 | ||
|
||
.PHONY: all | ||
all: | ||
rebar3 do compile, dialyzer, escriptize, eunit, ct | ||
$(REBAR) do compile, dialyzer, eunit, ct | ||
|
||
.PHONY: compile | ||
compile: | ||
$(REBAR) compile | ||
|
||
.PHONY: dialyzer | ||
dialyzer: | ||
rebar3 do dialyzer | ||
$(REBAR) do compile, dialyzer | ||
|
||
compile: | ||
rebar3 do compile | ||
.PHONY: test | ||
test: | ||
$(REBAR) do eunit, ct | ||
|
||
.PHONY: release | ||
release: | ||
$(REBAR) do compile, tar | ||
|
||
.PHONY: README.md | ||
README.md: | ||
rebar3 escriptize | ||
README.md: compile | ||
./emqttb @make-docs --src "$$(pwd)/doc/src/conf.xml" | ||
pandoc -o "$@" --to gfm-gfm_auto_identifiers --from docbook 'docs/EMQTT bench daemon.xml' | ||
|
||
.PHONY: clean | ||
clean: distclean | ||
|
||
.PHONY: distclean | ||
distclean: | ||
@rm -rf _build erl_crash.dump rebar3.crashdump rebar.lock emqttb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." | ||
|
||
UNAME="$(uname -s)" | ||
|
||
case "$UNAME" in | ||
Darwin) | ||
DIST='macos' | ||
VERSION_ID=$(sw_vers -productVersion | cut -d '.' -f 1) | ||
SYSTEM="${DIST}${VERSION_ID}" | ||
;; | ||
Linux) | ||
DIST="$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')" | ||
VERSION_ID="$(sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')" | ||
SYSTEM="$(echo "${DIST}${VERSION_ID}" | sed -r 's/([a-zA-Z]*)-.*/\1/g')" | ||
;; | ||
CYGWIN*|MSYS*|MINGW*) | ||
SYSTEM="windows" | ||
;; | ||
esac | ||
|
||
ARCH="$(uname -m)" | ||
case "$ARCH" in | ||
x86_64) | ||
ARCH='amd64' | ||
;; | ||
aarch64) | ||
ARCH='arm64' | ||
;; | ||
arm*) | ||
ARCH=arm | ||
;; | ||
esac | ||
|
||
VSN="$(grep -E ".+vsn.+" _build/default/lib/emqttb/ebin/emqttb.app | cut -d '"' -f2)" | ||
BASE=$(find ./_build/default/rel/emqttb -name "*.tar.gz" | tail -1) | ||
QUIC=$(find ./_build/default/rel/emqttb -name "quicer-*" | grep -q quicer && echo '-quic' || echo '') | ||
cp "$BASE" "./emqttb-${VSN}-${SYSTEM}-${ARCH}${QUIC}.tar.gz" |