ci: use buildx in build_packages
This commit is contained in:
parent
56d0de8453
commit
9017d6afc3
|
@ -74,12 +74,12 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
profile:
|
profile:
|
||||||
- ${{ inputs.profile }}
|
- ${{ inputs.profile }}
|
||||||
otp:
|
|
||||||
- ${{ inputs.otp_vsn }}
|
|
||||||
os:
|
os:
|
||||||
- macos-12
|
- macos-12
|
||||||
- macos-12-arm64
|
- macos-12-arm64
|
||||||
- macos-13
|
- macos-13
|
||||||
|
otp:
|
||||||
|
- ${{ inputs.otp_vsn }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
@ -98,27 +98,17 @@ jobs:
|
||||||
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||||
if: success()
|
if: success()
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.profile }}
|
name: ${{ matrix.profile }}-${{ matrix.os }}-${{ matrix.otp }}
|
||||||
path: _packages/${{ matrix.profile }}/
|
path: _packages/${{ matrix.profile }}/
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
runs-on: [self-hosted, ephemeral, linux, "${{ matrix.arch }}"]
|
runs-on: [self-hosted, ephemeral, linux, "${{ matrix.arch == 'arm64' && 'arm64' || 'x64' }}"]
|
||||||
# always run in builder container because the host might have the wrong OTP version etc.
|
|
||||||
# otherwise buildx.sh does not run docker if arch and os matches the target arch and os.
|
|
||||||
container:
|
|
||||||
image: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
profile:
|
profile:
|
||||||
- ${{ inputs.profile }}
|
- ${{ inputs.profile }}
|
||||||
otp:
|
|
||||||
- ${{ inputs.otp_vsn }}
|
|
||||||
arch:
|
|
||||||
- x64
|
|
||||||
- arm64
|
|
||||||
os:
|
os:
|
||||||
- ubuntu22.04
|
- ubuntu22.04
|
||||||
- ubuntu20.04
|
- ubuntu20.04
|
||||||
|
@ -131,20 +121,25 @@ jobs:
|
||||||
- el7
|
- el7
|
||||||
- amzn2
|
- amzn2
|
||||||
- amzn2023
|
- amzn2023
|
||||||
|
arch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
with_elixir:
|
||||||
|
- 'no'
|
||||||
|
otp:
|
||||||
|
- ${{ inputs.otp_vsn }}
|
||||||
builder:
|
builder:
|
||||||
- ${{ inputs.builder_vsn }}
|
- ${{ inputs.builder_vsn }}
|
||||||
elixir:
|
elixir:
|
||||||
- ${{ inputs.elixir_vsn }}
|
- ${{ inputs.elixir_vsn }}
|
||||||
with_elixir:
|
|
||||||
- 'no'
|
|
||||||
include:
|
include:
|
||||||
- profile: ${{ inputs.profile }}
|
- profile: ${{ inputs.profile }}
|
||||||
otp: ${{ inputs.otp_vsn }}
|
|
||||||
arch: x64
|
|
||||||
os: ubuntu22.04
|
os: ubuntu22.04
|
||||||
|
arch: amd64
|
||||||
|
with_elixir: 'yes'
|
||||||
|
otp: ${{ inputs.otp_vsn }}
|
||||||
builder: ${{ inputs.builder_vsn }}
|
builder: ${{ inputs.builder_vsn }}
|
||||||
elixir: ${{ inputs.elixir_vsn }}
|
elixir: ${{ inputs.elixir_vsn }}
|
||||||
with_elixir: 'yes'
|
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
|
@ -155,46 +150,24 @@ jobs:
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.inputs.ref }}
|
ref: ${{ github.event.inputs.ref }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: fix workdir
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
||||||
# Align path for CMake caches
|
|
||||||
if [ ! "$PWD" = "/emqx" ]; then
|
|
||||||
ln -s $PWD /emqx
|
|
||||||
cd /emqx
|
|
||||||
fi
|
|
||||||
echo "pwd is $PWD"
|
|
||||||
|
|
||||||
- name: build emqx packages
|
- name: build emqx packages
|
||||||
env:
|
env:
|
||||||
PROFILE: ${{ matrix.profile }}
|
PROFILE: ${{ matrix.profile }}
|
||||||
|
ARCH: ${{ matrix.arch }}
|
||||||
|
OS: ${{ matrix.os }}
|
||||||
IS_ELIXIR: ${{ matrix.with_elixir }}
|
IS_ELIXIR: ${{ matrix.with_elixir }}
|
||||||
ACLOCAL_PATH: "/usr/share/aclocal:/usr/local/share/aclocal"
|
BUILDER: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
|
||||||
|
BUILDER_SYSTEM: force_docker
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
./scripts/buildx.sh \
|
||||||
if [ "${IS_ELIXIR:-}" == 'yes' ]; then
|
--profile $PROFILE \
|
||||||
make "${PROFILE}-elixir-tgz"
|
--arch $ARCH \
|
||||||
else
|
--builder $BUILDER \
|
||||||
make "${PROFILE}-tgz"
|
--elixir $IS_ELIXIR \
|
||||||
make "${PROFILE}-pkg"
|
--pkgtype pkg
|
||||||
fi
|
|
||||||
- name: test emqx packages
|
|
||||||
env:
|
|
||||||
PROFILE: ${{ matrix.profile }}
|
|
||||||
IS_ELIXIR: ${{ matrix.with_elixir }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
if [ "${IS_ELIXIR:-}" == 'yes' ]; then
|
|
||||||
./scripts/pkg-tests.sh "${PROFILE}-elixir-tgz"
|
|
||||||
else
|
|
||||||
./scripts/pkg-tests.sh "${PROFILE}-tgz"
|
|
||||||
./scripts/pkg-tests.sh "${PROFILE}-pkg"
|
|
||||||
fi
|
|
||||||
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.profile }}
|
name: ${{ matrix.profile }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.with_elixir == 'yes' && '-elixir' || '' }}-${{ matrix.builder }}-${{ matrix.otp }}-${{ matrix.elixir }}
|
||||||
path: _packages/${{ matrix.profile }}/
|
path: _packages/${{ matrix.profile }}/
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
|
@ -212,8 +185,9 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
|
- uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.profile }}
|
pattern: "${{ matrix.profile }}-*"
|
||||||
path: packages/${{ matrix.profile }}
|
path: packages/${{ matrix.profile }}
|
||||||
|
merge-multiple: true
|
||||||
- name: install dos2unix
|
- name: install dos2unix
|
||||||
run: sudo apt-get update -y && sudo apt install -y dos2unix
|
run: sudo apt-get update -y && sudo apt install -y dos2unix
|
||||||
- name: get packages
|
- name: get packages
|
||||||
|
|
|
@ -101,8 +101,8 @@ elif [[ $(uname -m) == "armv7l" ]]; then
|
||||||
fi
|
fi
|
||||||
ARCH="${ARCH:-${NATIVE_ARCH:-}}"
|
ARCH="${ARCH:-${NATIVE_ARCH:-}}"
|
||||||
|
|
||||||
[ -z "${PROFILE:-}" ] && die "missing --prifile"
|
[ -z "${PROFILE:-}" ] && die "missing --profile"
|
||||||
[ -z "${PKGTYPE:-}" ] && die "missing --pkgtyp"
|
[ -z "${PKGTYPE:-}" ] && die "missing --pkgtype"
|
||||||
[ -z "${BUILDER:-}" ] && die "missing --builder"
|
[ -z "${BUILDER:-}" ] && die "missing --builder"
|
||||||
[ -z "${ARCH:-}" ] && die "missing --arch"
|
[ -z "${ARCH:-}" ] && die "missing --arch"
|
||||||
|
|
||||||
|
@ -135,13 +135,15 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HOST_SYSTEM="$(./scripts/get-distro.sh)"
|
HOST_SYSTEM="$(./scripts/get-distro.sh)"
|
||||||
BUILDER_SYSTEM="$(echo "$BUILDER" | awk -F'-' '{print $NF}')"
|
BUILDER_SYSTEM="${BUILDER_SYSTEM:-$(echo "$BUILDER" | awk -F'-' '{print $NF}')}"
|
||||||
|
|
||||||
CMD_RUN="make ${MAKE_TARGET} && ./scripts/pkg-tests.sh ${MAKE_TARGET}"
|
CMD_RUN="make ${MAKE_TARGET} && ./scripts/pkg-tests.sh ${MAKE_TARGET}"
|
||||||
|
|
||||||
IS_NATIVE_SYSTEM='no'
|
IS_NATIVE_SYSTEM='no'
|
||||||
if [[ "$BUILDER_SYSTEM" == "force_host" ]] || [[ "$BUILDER_SYSTEM" == "$HOST_SYSTEM" ]]; then
|
if [[ "$BUILDER_SYSTEM" != "force_docker" ]]; then
|
||||||
IS_NATIVE_SYSTEM='yes'
|
if [[ "$BUILDER_SYSTEM" == "force_host" ]] || [[ "$BUILDER_SYSTEM" == "$HOST_SYSTEM" ]]; then
|
||||||
|
IS_NATIVE_SYSTEM='yes'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IS_NATIVE_ARCH='no'
|
IS_NATIVE_ARCH='no'
|
||||||
|
|
Loading…
Reference in New Issue