- Secure tests on master branch after merge. - Improve build cache hit rates Due to security reason, github only allow reuse cache from - same branch - base branch - default branch Branch Feature-A could not reuse the cache from Feature-B - Developers could run the workflow in their own forked repo before make the PR, this could relieve the runners on upstream repo
187 lines
5.7 KiB
YAML
187 lines
5.7 KiB
YAML
name: Build slim packages
|
|
|
|
concurrency:
|
|
group: slim-${{ github.event_name }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branch:
|
|
- master
|
|
tags:
|
|
- v*
|
|
- e*
|
|
pull_request:
|
|
# GitHub pull_request action is by default triggered when
|
|
# opened reopened or synchronize,
|
|
# we add labeled and unlabeled to the list because
|
|
# the mac job dpends on the PR having a 'Mac' label
|
|
types:
|
|
- labeled
|
|
- unlabeled
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
linux:
|
|
runs-on: ubuntu-20.04
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
profile:
|
|
- emqx-edge
|
|
- emqx
|
|
- emqx-enterprise
|
|
otp:
|
|
- 24.1.5-4
|
|
elixir:
|
|
- 1.13.2
|
|
os:
|
|
- ubuntu20.04
|
|
- centos7
|
|
|
|
container: "ghcr.io/emqx/emqx-builder/5.0-5:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: prepare
|
|
run: |
|
|
echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
|
|
echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
|
|
echo "EMQX_PKG_NAME=${{ matrix.profile }}-$(./pkg-vsn.sh ${{ matrix.profile }})-otp${{ matrix.otp }}-${{ matrix.os }}-amd64" >> $GITHUB_ENV
|
|
echo "EMQX_ELIXIRPKG_NAME=${{ matrix.profile }}-$(./pkg-vsn.sh ${{ matrix.profile }})-elixir${{ matrix.elixir }}-otp${{ matrix.otp }}-${{ matrix.os }}-amd64" >> $GITHUB_ENV
|
|
- name: Get deps git refs for cache
|
|
id: deps-refs
|
|
run: |
|
|
scripts/get-dep-refs.sh
|
|
make clean-all
|
|
- name: load rocksdb cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
_build/default/lib/rocksdb/
|
|
deps/rocksdb/
|
|
key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
|
|
- name: load quicer cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
_build/default/lib/quicer/
|
|
deps/quicer/
|
|
key: ${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-amd64-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
|
|
- name: build and test tgz package
|
|
run: |
|
|
make ${EMQX_NAME}-tgz
|
|
.ci/build_packages/tests.sh "$EMQX_PKG_NAME" tgz amd64
|
|
- name: run static checks
|
|
if: contains(matrix.os, 'ubuntu')
|
|
run: |
|
|
make static_checks
|
|
- name: build and test deb/rpm packages
|
|
run: |
|
|
make ${EMQX_NAME}-pkg
|
|
.ci/build_packages/tests.sh "$EMQX_PKG_NAME" pkg amd64
|
|
- name: build and test tgz package (Elixir)
|
|
run: |
|
|
make ${EMQX_NAME}-elixir-tgz
|
|
.ci/build_packages/tests.sh "$EMQX_ELIXIRPKG_NAME" tgz amd64
|
|
- name: build and test deb/rpm packages (Elixir)
|
|
run: |
|
|
make ${EMQX_NAME}-elixirpkg
|
|
.ci/build_packages/tests.sh "$EMQX_ELIXIRPKG_NAME" pkg amd64
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.profile}}-${{ matrix.otp }}-${{ matrix.os }}
|
|
path: _packages/${{ matrix.profile}}/*.tar.gz
|
|
mac:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
profile:
|
|
- emqx
|
|
- emqx-enterprise
|
|
otp:
|
|
- 24.1.5-4
|
|
macos:
|
|
- macos-11
|
|
- macos-10.15
|
|
|
|
runs-on: ${{ matrix.macos }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: prepare
|
|
run: |
|
|
brew update
|
|
brew install curl zip unzip gnu-sed kerl unixodbc freetds
|
|
echo "/usr/local/bin" >> $GITHUB_PATH
|
|
echo "EMQX_NAME=${{ matrix.profile }}" >> $GITHUB_ENV
|
|
- uses: actions/cache@v2
|
|
id: cache
|
|
with:
|
|
path: ~/.kerl/${{ matrix.otp }}
|
|
key: otp-install-${{ matrix.otp }}-${{ matrix.macos }}
|
|
- name: build erlang
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
timeout-minutes: 60
|
|
env:
|
|
KERL_BUILD_BACKEND: git
|
|
OTP_GITHUB_URL: https://github.com/emqx/otp
|
|
run: |
|
|
kerl update releases
|
|
kerl build ${{ matrix.otp }}
|
|
kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
|
|
- name: Get deps git refs for cache
|
|
id: deps-refs
|
|
run: |
|
|
. $HOME/.kerl/${{ matrix.otp }}/activate
|
|
make ensure-rebar3
|
|
sudo cp rebar3 /usr/local/bin/rebar3
|
|
scripts/get-dep-refs.sh
|
|
make clean-all
|
|
- name: load rocksdb cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: _build/default/lib/rocksdb/
|
|
key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
|
|
- name: load quicer cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: _build/default/lib/quicer/
|
|
key: ${{ matrix.macos }}-${{ matrix.otp }}-macos-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
|
|
- name: build ${{ matrix.profile }}
|
|
run: |
|
|
. $HOME/.kerl/${{ matrix.otp }}/activate
|
|
make ensure-rebar3
|
|
sudo cp rebar3 /usr/local/bin/rebar3
|
|
make ${{ matrix.profile }}-tgz
|
|
- name: test
|
|
run: |
|
|
pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
|
|
tar -zxf $pkg_name
|
|
# gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
|
|
./emqx/bin/emqx start || cat emqx/log/erlang.log.1
|
|
ready='no'
|
|
for i in {1..10}; do
|
|
if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
|
|
ready='yes'
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
if [ "$ready" != "yes" ]; then
|
|
echo "Timed out waiting for emqx to be ready"
|
|
cat emqx/log/erlang.log.1
|
|
exit 1
|
|
fi
|
|
./emqx/bin/emqx_ctl status
|
|
./emqx/bin/emqx stop
|
|
rm -rf emqx
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: macos
|
|
path: _packages/**/*.tar.gz
|