Files
awg-openwrt/.drone.yml
Maksim Zavitaev caf1df999a
Some checks failed
continuous-integration/drone/tag Build is failing
Fix Drone file
2026-03-30 10:54:34 +03:00

169 lines
5.9 KiB
YAML

kind: pipeline
type: docker
name: awg-openwrt-build
trigger:
event:
- tag
volumes:
- name: drone_cache
host:
path: /cache
steps:
- name: build
image: node:20-bookworm
volumes:
- name: drone_cache
path: /cache
environment:
OPENWRT_TAG: "24.10.2"
OPENWRT_PKGARCH: "aarch64_generic"
OPENWRT_TARGET: "rockchip"
OPENWRT_SUBTARGET: "armv8"
OPENWRT_VERMAGIC: "0d90324e4fb76fa1183dcb1f1b600b7a-r1"
OPENWRT_KERNEL_DEP: "kernel (=6.6.93~0d90324e4fb76fa1183dcb1f1b600b7a-r1)"
commands:
- apt-get update
- |
DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates \
curl \
wget \
jq \
git \
rsync \
unzip \
zip \
xz-utils \
zstd \
gawk \
file \
patch \
perl \
python3 \
python3-dev \
python3-pyelftools \
python3-setuptools \
python3-distutils \
swig \
build-essential \
clang \
libncurses5-dev \
libncursesw5-dev \
libelf-dev \
gettext \
xsltproc \
cpio \
flex \
bison \
tar
- node --version
- npm --version
- python3 --version
- echo "DRONE_TAG=$DRONE_TAG"
- echo "OPENWRT_TAG=$OPENWRT_TAG"
- echo "OPENWRT_PKGARCH=$OPENWRT_PKGARCH"
- echo "OPENWRT_TARGET=$OPENWRT_TARGET"
- echo "OPENWRT_SUBTARGET=$OPENWRT_SUBTARGET"
- echo "OPENWRT_VERMAGIC=$OPENWRT_VERMAGIC"
- echo "OPENWRT_KERNEL_DEP=$OPENWRT_KERNEL_DEP"
- npm install
- mkdir -p "$DRONE_WORKSPACE/awgrelease"
- rm -rf "$DRONE_WORKSPACE/awgrelease"/*
- mkdir -p "/cache/awg-openwrt/$DRONE_TAG"
- find "/cache/awg-openwrt/$DRONE_TAG" -type f -delete || true
- SDK_FILE=$(curl -fsSL "https://downloads.openwrt.org/releases/$OPENWRT_TAG/targets/$OPENWRT_TARGET/$OPENWRT_SUBTARGET/" | grep -o 'openwrt-sdk-[^"]*\.Linux-x86_64\.tar\.\(xz\|zst\)' | head -n1)
- test -n "$SDK_FILE"
- SDK_URL="https://downloads.openwrt.org/releases/$OPENWRT_TAG/targets/$OPENWRT_TARGET/$OPENWRT_SUBTARGET/$SDK_FILE"
- echo "SDK_URL=$SDK_URL"
- wget -O "$SDK_FILE" "$SDK_URL"
- |
case "$SDK_FILE" in
*.tar.zst) tar --zstd -xf "$SDK_FILE" ;;
*.tar.xz) tar -xf "$SDK_FILE" ;;
*) echo "Unknown SDK archive format: $SDK_FILE"; exit 1 ;;
esac
- rm -f "$SDK_FILE"
- SDK_ROOT=$(find "$DRONE_WORKSPACE" -maxdepth 1 -type d -name 'openwrt-sdk-*' | head -n1)
- test -n "$SDK_ROOT"
- test -d "$SDK_ROOT"
- echo "SDK_ROOT=$SDK_ROOT"
- cd "$SDK_ROOT" && ./scripts/feeds update -a
- cd "$SDK_ROOT" && ./scripts/feeds install -a
- rm -rf "$SDK_ROOT/package/kmod-amneziawg" "$SDK_ROOT/package/amneziawg-tools" "$SDK_ROOT/package/luci-proto-amneziawg"
- cp -r "$DRONE_WORKSPACE/kmod-amneziawg" "$SDK_ROOT/package/"
- cp -r "$DRONE_WORKSPACE/amneziawg-tools" "$SDK_ROOT/package/"
- cp -r "$DRONE_WORKSPACE/luci-proto-amneziawg" "$SDK_ROOT/package/"
- cd "$SDK_ROOT" && printf '%s\n' 'CONFIG_PACKAGE_kmod-amneziawg=m' > .config
- cd "$SDK_ROOT" && printf '%s\n' 'CONFIG_PACKAGE_amneziawg-tools=y' >> .config
- cd "$SDK_ROOT" && printf '%s\n' 'CONFIG_PACKAGE_luci-proto-amneziawg=y' >> .config
- cd "$SDK_ROOT" && printf '%s\n' 'CONFIG_PACKAGE_luci-i18n-amneziawg-ru=y' >> .config
- cd "$SDK_ROOT" && make defconfig
- cd "$SDK_ROOT" && make package/kmod-amneziawg/download V=s || true
- cd "$SDK_ROOT" && make package/kmod-amneziawg/prepare V=s || true
- cd "$SDK_ROOT" && make package/kmod-amneziawg/compile V=s
- cd "$SDK_ROOT" && make package/luci-proto-amneziawg/download V=s
- cd "$SDK_ROOT" && make package/luci-proto-amneziawg/prepare V=s
- cd "$SDK_ROOT" && make package/luci-proto-amneziawg/compile V=s
- cd "$SDK_ROOT" && make package/amneziawg-tools/download V=s
- cd "$SDK_ROOT" && make package/amneziawg-tools/prepare V=s
- cd "$SDK_ROOT" && make package/amneziawg-tools/compile V=s
- KMOD_FILE=$(find "$SDK_ROOT/bin/targets" -type f -name 'kmod-amneziawg*.ipk' | sort | tail -n1)
- TOOLS_FILE=$(find "$SDK_ROOT/bin/packages" -type f -name 'amneziawg-tools*.ipk' | sort | tail -n1)
- LUCI_FILE=$(find "$SDK_ROOT/bin/packages" -type f -name 'luci-proto-amneziawg*.ipk' | sort | tail -n1)
- I18N_FILE=$(find "$SDK_ROOT/bin/packages" -type f -name 'luci-i18n-amneziawg-ru*.ipk' | sort | tail -n1)
- test -n "$KMOD_FILE"
- test -n "$TOOLS_FILE"
- test -n "$LUCI_FILE"
- test -n "$I18N_FILE"
- cp "$KMOD_FILE" "$DRONE_WORKSPACE/awgrelease/"
- cp "$TOOLS_FILE" "$DRONE_WORKSPACE/awgrelease/"
- cp "$LUCI_FILE" "$DRONE_WORKSPACE/awgrelease/"
- cp "$I18N_FILE" "$DRONE_WORKSPACE/awgrelease/"
- rm -rf /tmp/kmodcheck
- mkdir -p /tmp/kmodcheck/pkg /tmp/kmodcheck/control
- tar -xzf "$KMOD_FILE" -C /tmp/kmodcheck/pkg
- tar -xzf /tmp/kmodcheck/pkg/control.tar.gz -C /tmp/kmodcheck/control
- echo "===== kmod control ====="
- cat /tmp/kmodcheck/control/control
- grep -F "$OPENWRT_KERNEL_DEP" /tmp/kmodcheck/control/control
- ls -lah "$DRONE_WORKSPACE/awgrelease"
- test -n "$(find "$DRONE_WORKSPACE/awgrelease" -type f -name '*.ipk' | head -n1)"
- cp -a "$DRONE_WORKSPACE/awgrelease/." "/cache/awg-openwrt/$DRONE_TAG/"
- ls -lah "/cache/awg-openwrt/$DRONE_TAG/"
- name: publish-release
image: plugins/gitea-release
volumes:
- name: drone_cache
path: /cache
settings:
base_url: https://git.mzavitaev.ru
api_key:
from_secret: gitea_token
files:
- /cache/awg-openwrt/${DRONE_TAG}/*.ipk
checksum: sha256
file_exists: overwrite
title: AWG for OpenWrt 24.10.2