mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-06-19 07:36:59 +00:00
feat: support riscv64 docker and OpenWrt installs (#1551)
This commit is contained in:
@@ -542,7 +542,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build, build_macos_native]
|
needs: [build, build_macos_native]
|
||||||
env:
|
env:
|
||||||
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/arm/v5
|
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/arm/v5,linux/riscv64
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -569,6 +569,11 @@ jobs:
|
|||||||
- name: Prepare Artifacts
|
- name: Prepare Artifacts
|
||||||
run: chmod +x ./dist/nginx-ui-*/nginx-ui*
|
run: chmod +x ./dist/nginx-ui-*/nginx-ui*
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
|
platforms: arm,arm64,riscv64
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ RUN case "${TARGETARCH}/${TARGETVARIANT}" in \
|
|||||||
"arm/v7"*) S6_ARCH="arm" ;; \
|
"arm/v7"*) S6_ARCH="arm" ;; \
|
||||||
"arm/v6"*) S6_ARCH="arm" ;; \
|
"arm/v6"*) S6_ARCH="arm" ;; \
|
||||||
"arm/v5"*) S6_ARCH="arm" ;; \
|
"arm/v5"*) S6_ARCH="arm" ;; \
|
||||||
|
"riscv64/"*) S6_ARCH="riscv64" ;; \
|
||||||
*) echo "Unsupported arch: ${TARGETARCH}/${TARGETVARIANT}" && exit 1 ;; \
|
*) echo "Unsupported arch: ${TARGETARCH}/${TARGETVARIANT}" && exit 1 ;; \
|
||||||
esac && \
|
esac && \
|
||||||
wget -O /tmp/s6-overlay-noarch.tar.xz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz && \
|
wget -O /tmp/s6-overlay-noarch.tar.xz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz && \
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ RUN case "${TARGETARCH}/${TARGETVARIANT}" in \
|
|||||||
"arm/v7"*) S6_ARCH="arm" ;; \
|
"arm/v7"*) S6_ARCH="arm" ;; \
|
||||||
"arm/v6"*) S6_ARCH="arm" ;; \
|
"arm/v6"*) S6_ARCH="arm" ;; \
|
||||||
"arm/v5"*) S6_ARCH="arm" ;; \
|
"arm/v5"*) S6_ARCH="arm" ;; \
|
||||||
|
"riscv64/"*) S6_ARCH="riscv64" ;; \
|
||||||
*) echo "Unsupported arch: ${TARGETARCH}/${TARGETVARIANT}" && exit 1 ;; \
|
*) echo "Unsupported arch: ${TARGETARCH}/${TARGETVARIANT}" && exit 1 ;; \
|
||||||
esac && \
|
esac && \
|
||||||
wget -O /tmp/s6-overlay-noarch.tar.xz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz && \
|
wget -O /tmp/s6-overlay-noarch.tar.xz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz && \
|
||||||
|
|||||||
@@ -209,6 +209,9 @@ identify_the_operating_system_and_architecture() {
|
|||||||
'armv8' | 'aarch64')
|
'armv8' | 'aarch64')
|
||||||
MACHINE='arm64-v8a'
|
MACHINE='arm64-v8a'
|
||||||
;;
|
;;
|
||||||
|
'riscv64')
|
||||||
|
MACHINE='riscv64'
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "${FontRed}error: The architecture is not supported by this script.${FontSuffix}"
|
echo -e "${FontRed}error: The architecture is not supported by this script.${FontSuffix}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -41,6 +41,41 @@ EOF
|
|||||||
assert_contains "$output" "SERVICE_TYPE=openwrt" "OpenWrt 25 should use OpenWrt service type"
|
assert_contains "$output" "SERVICE_TYPE=openwrt" "OpenWrt 25 should use OpenWrt service type"
|
||||||
}
|
}
|
||||||
|
|
||||||
test_openwrt_with_apk_is_not_detected_as_openrc
|
test_openwrt_riscv64_is_supported() {
|
||||||
|
local sandbox output
|
||||||
|
sandbox="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$sandbox"' RETURN
|
||||||
|
|
||||||
|
mkdir -p "$sandbox/bin" "$sandbox/etc" "$sandbox/proc/1" "$sandbox/sbin"
|
||||||
|
cat > "$sandbox/bin/uname" <<'EOF'
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ "${1:-}" == "-m" ]]; then
|
||||||
|
echo 'riscv64'
|
||||||
|
else
|
||||||
|
echo 'Linux'
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
chmod +x "$sandbox/bin/uname"
|
||||||
|
|
||||||
|
cat > "$sandbox/etc/os-release" <<'EOF'
|
||||||
|
NAME="OpenWrt"
|
||||||
|
ID="openwrt"
|
||||||
|
VERSION_ID="25.10"
|
||||||
|
EOF
|
||||||
|
: > "$sandbox/etc/openwrt_release"
|
||||||
|
: > "$sandbox/proc/cpuinfo"
|
||||||
|
: > "$sandbox/proc/1/cgroup"
|
||||||
|
ln -s /bin/true "$sandbox/bin/apk"
|
||||||
|
|
||||||
|
output="$(PATH="$sandbox/bin:$PATH" NGINX_UI_INSTALL_TESTING=1 "$INSTALL_SCRIPT" __test_detect "$sandbox" 2>&1)"
|
||||||
|
|
||||||
|
assert_contains "$output" "MACHINE=riscv64" "OpenWrt riscv64 should use the linux-riscv64 artifact"
|
||||||
|
assert_contains "$output" "SERVICE_TYPE=openwrt" "OpenWrt riscv64 should use OpenWrt service type"
|
||||||
|
}
|
||||||
|
|
||||||
|
test_openwrt_with_apk_is_not_detected_as_openrc
|
||||||
echo "ok - install.sh detects OpenWrt 25 apk as openwrt"
|
echo "ok - install.sh detects OpenWrt 25 apk as openwrt"
|
||||||
|
|
||||||
|
test_openwrt_riscv64_is_supported
|
||||||
|
echo "ok - install.sh detects OpenWrt riscv64 as openwrt"
|
||||||
|
|||||||
Reference in New Issue
Block a user