ci: use buildx in build_packages
This commit is contained in:
parent
56d0de8453
commit
9017d6afc3
|
@ -74,12 +74,12 @@ jobs:
|
|||
matrix:
|
||||
profile:
|
||||
- ${{ inputs.profile }}
|
||||
otp:
|
||||
- ${{ inputs.otp_vsn }}
|
||||
os:
|
||||
- macos-12
|
||||
- macos-12-arm64
|
||||
- macos-13
|
||||
otp:
|
||||
- ${{ inputs.otp_vsn }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
@ -98,27 +98,17 @@ jobs:
|
|||
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
if: success()
|
||||
with:
|
||||
name: ${{ matrix.profile }}
|
||||
name: ${{ matrix.profile }}-${{ matrix.os }}-${{ matrix.otp }}
|
||||
path: _packages/${{ matrix.profile }}/
|
||||
retention-days: 7
|
||||
|
||||
linux:
|
||||
runs-on: [self-hosted, ephemeral, linux, "${{ matrix.arch }}"]
|
||||
# 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 }}"
|
||||
|
||||
runs-on: [self-hosted, ephemeral, linux, "${{ matrix.arch == 'arm64' && 'arm64' || 'x64' }}"]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
profile:
|
||||
- ${{ inputs.profile }}
|
||||
otp:
|
||||
- ${{ inputs.otp_vsn }}
|
||||
arch:
|
||||
- x64
|
||||
- arm64
|
||||
os:
|
||||
- ubuntu22.04
|
||||
- ubuntu20.04
|
||||
|
@ -131,20 +121,25 @@ jobs:
|
|||
- el7
|
||||
- amzn2
|
||||
- amzn2023
|
||||
arch:
|
||||
- amd64
|
||||
- arm64
|
||||
with_elixir:
|
||||
- 'no'
|
||||
otp:
|
||||
- ${{ inputs.otp_vsn }}
|
||||
builder:
|
||||
- ${{ inputs.builder_vsn }}
|
||||
elixir:
|
||||
- ${{ inputs.elixir_vsn }}
|
||||
with_elixir:
|
||||
- 'no'
|
||||
include:
|
||||
- profile: ${{ inputs.profile }}
|
||||
otp: ${{ inputs.otp_vsn }}
|
||||
arch: x64
|
||||
os: ubuntu22.04
|
||||
arch: amd64
|
||||
with_elixir: 'yes'
|
||||
otp: ${{ inputs.otp_vsn }}
|
||||
builder: ${{ inputs.builder_vsn }}
|
||||
elixir: ${{ inputs.elixir_vsn }}
|
||||
with_elixir: 'yes'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
@ -155,46 +150,24 @@ jobs:
|
|||
with:
|
||||
ref: ${{ github.event.inputs.ref }}
|
||||
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
|
||||
env:
|
||||
PROFILE: ${{ matrix.profile }}
|
||||
ARCH: ${{ matrix.arch }}
|
||||
OS: ${{ matrix.os }}
|
||||
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: |
|
||||
set -eu
|
||||
if [ "${IS_ELIXIR:-}" == 'yes' ]; then
|
||||
make "${PROFILE}-elixir-tgz"
|
||||
else
|
||||
make "${PROFILE}-tgz"
|
||||
make "${PROFILE}-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
|
||||
./scripts/buildx.sh \
|
||||
--profile $PROFILE \
|
||||
--arch $ARCH \
|
||||
--builder $BUILDER \
|
||||
--elixir $IS_ELIXIR \
|
||||
--pkgtype pkg
|
||||
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
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 }}/
|
||||
retention-days: 7
|
||||
|
||||
|
@ -212,8 +185,9 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
|
||||
with:
|
||||
name: ${{ matrix.profile }}
|
||||
pattern: "${{ matrix.profile }}-*"
|
||||
path: packages/${{ matrix.profile }}
|
||||
merge-multiple: true
|
||||
- name: install dos2unix
|
||||
run: sudo apt-get update -y && sudo apt install -y dos2unix
|
||||
- name: get packages
|
||||
|
|
|
@ -101,8 +101,8 @@ elif [[ $(uname -m) == "armv7l" ]]; then
|
|||
fi
|
||||
ARCH="${ARCH:-${NATIVE_ARCH:-}}"
|
||||
|
||||
[ -z "${PROFILE:-}" ] && die "missing --prifile"
|
||||
[ -z "${PKGTYPE:-}" ] && die "missing --pkgtyp"
|
||||
[ -z "${PROFILE:-}" ] && die "missing --profile"
|
||||
[ -z "${PKGTYPE:-}" ] && die "missing --pkgtype"
|
||||
[ -z "${BUILDER:-}" ] && die "missing --builder"
|
||||
[ -z "${ARCH:-}" ] && die "missing --arch"
|
||||
|
||||
|
@ -135,14 +135,16 @@ else
|
|||
fi
|
||||
|
||||
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}"
|
||||
|
||||
IS_NATIVE_SYSTEM='no'
|
||||
if [[ "$BUILDER_SYSTEM" != "force_docker" ]]; then
|
||||
if [[ "$BUILDER_SYSTEM" == "force_host" ]] || [[ "$BUILDER_SYSTEM" == "$HOST_SYSTEM" ]]; then
|
||||
IS_NATIVE_SYSTEM='yes'
|
||||
fi
|
||||
fi
|
||||
|
||||
IS_NATIVE_ARCH='no'
|
||||
if [[ "$NATIVE_ARCH" == "$ARCH" ]]; then
|
||||
|
|
Loading…
Reference in New Issue