name: Build slim packages on: pull_request: workflow_dispatch: jobs: build: runs-on: ${{ matrix.runs-on }} strategy: matrix: erl_otp: - erl23.3.4.9-3 os: - ubuntu20.04 - centos7 runs-on: - aws-amd64 - ubuntu-20.04 use-self-hosted: - ${{ github.repository_owner == 'emqx' }} exclude: - runs-on: ubuntu-20.04 use-self-hosted: true - runs-on: aws-amd64 use-self-hosted: false container: emqx/build-env:${{ matrix.erl_otp }}-${{ matrix.os }} steps: - uses: actions/checkout@v1 - name: prepare run: | if make 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 "EMQX_NAME=emqx-ee" >> $GITHUB_ENV else echo "EMQX_NAME=emqx" >> $GITHUB_ENV fi - name: fix-git-unsafe-repository run: git config --global --add safe.directory /__w/emqx/emqx - uses: actions/cache@v2 with: # dialyzer PLTs path: ~/.cache/rebar3/ key: dialyer-${{ matrix.erl_otp }} - name: make xref run: make xref - name: make dialyzer run: make dialyzer - name: build zip packages run: make ${EMQX_NAME}-zip - name: build deb/rpm packages run: make ${EMQX_NAME}-pkg - uses: actions/upload-artifact@v1 if: failure() with: name: rebar3.crashdump path: ./rebar3.crashdump - name: packages test run: | export CODE_PATH=$GITHUB_WORKSPACE .ci/build_packages/tests.sh - uses: actions/upload-artifact@v2 with: name: ${{ matrix.os }} path: _packages/**/*.zip mac: strategy: matrix: erl_otp: - 23.3.4.9-3 macos: - macos-11 runs-on: ${{ matrix.macos }} steps: - uses: actions/checkout@v1 - name: prepare run: | if make 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 "EMQX_NAME=emqx-ee" >> $GITHUB_ENV else echo "EMQX_NAME=emqx" >> $GITHUB_ENV fi - name: prepare run: | brew update brew install curl zip unzip gnu-sed kerl unixodbc freetds echo "/usr/local/bin" >> $GITHUB_PATH git config --global credential.helper store - uses: actions/cache@v2 id: cache with: path: ~/.kerl/${{ matrix.erl_otp }} key: otp-install-${{ matrix.erl_otp }}-${{ matrix.macos }}-static-ssl-disable-hipe-disable-jit - 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 KERL_CONFIGURE_OPTIONS: --disable-dynamic-ssl-lib --with-ssl=/usr/local/opt/openssl@1.1 --disable-hipe --disable-jit run: | kerl update releases kerl build ${{ matrix.erl_otp }} kerl install ${{ matrix.erl_otp }} $HOME/.kerl/${{ matrix.erl_otp }} - name: build env: APPLE_SIGN_BINARIES: 1 APPLE_ID: developers@emqx.io APPLE_TEAM_ID: 26N6HYJLZA APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} APPLE_DEVELOPER_IDENTITY: ${{ secrets.APPLE_DEVELOPER_IDENTITY }} APPLE_DEVELOPER_ID_BUNDLE: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE }} APPLE_DEVELOPER_ID_BUNDLE_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE_PASSWORD }} run: | . $HOME/.kerl/${{ matrix.erl_otp }}/activate make ensure-rebar3 sudo cp rebar3 /usr/local/bin/rebar3 make ${EMQX_NAME}-zip - uses: actions/upload-artifact@v1 if: failure() with: name: rebar3.crashdump path: ./rebar3.crashdump - name: test run: | pkg_name=$(basename _packages/${EMQX_NAME}/emqx-*.zip) unzip -q _packages/${EMQX_NAME}/$pkg_name gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins # test with a spaces in path mv ./emqx "./emqx home/" cd "./emqx home/" ./bin/emqx start || cat log/erlang.log.1 ready='no' for i in {1..10}; do if curl -fs 127.0.0.1:18083 > /dev/null; then ready='yes' break fi sleep 1 done if [ "$ready" != "yes" ]; then echo "Timed out waiting for emqx to be ready" cat log/erlang.log.1 exit 1 fi ./bin/emqx_ctl status ./bin/emqx stop cd .. rm -rf "emqx home" - uses: actions/upload-artifact@v2 with: name: macos path: _packages/**/*.zip