mirror of
https://github.com/Slava-Shchipunov/awg-openwrt.git
synced 2026-03-14 01:13:09 +00:00
feat: update build-module.yml
This commit is contained in:
152
.github/workflows/build-module.yml
vendored
152
.github/workflows/build-module.yml
vendored
@@ -53,94 +53,116 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout AWG source code
|
||||||
with:
|
uses: actions/checkout@v4
|
||||||
repository: openwrt/openwrt
|
|
||||||
ref: v${{ matrix.build_env.tag }}
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Cache Tools and Kernel
|
- name: Cache OpenWrt SDK
|
||||||
id: cache-tools-kernel
|
id: cache-sdk
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
env:
|
env:
|
||||||
cache-name: "cache-tools-kernel-${{ matrix.build_env.tag }}-${{ matrix.build_env.pkgarch}}-${{ matrix.build_env.target}}-${{ matrix.build_env.subtarget}}"
|
cache-name: "cache-sdk-${{ matrix.build_env.tag }}-${{ matrix.build_env.target}}-${{ matrix.build_env.subtarget}}"
|
||||||
with:
|
with:
|
||||||
path: "**"
|
path: openwrt-sdk-*/
|
||||||
key: ${{ runner.os }}-build-vm4-${{ env.cache-name }}
|
key: ${{ runner.os }}-sdk-${{ env.cache-name }}
|
||||||
|
|
||||||
- name: Building kernel and tools
|
- name: Download and extract OpenWrt SDK
|
||||||
#if: ${{ steps.cache-tools-kernel.outputs.cache-hit != 'true' }}
|
if: steps.cache-sdk.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
echo "pkgarch: ${{ matrix.build_env.pkgarch}}, target:${{ matrix.build_env.target}}, subtarget: ${{ matrix.build_env.subtarget}}"
|
echo "pkgarch: ${{ matrix.build_env.pkgarch}}, target:${{ matrix.build_env.target}}, subtarget: ${{ matrix.build_env.subtarget}}"
|
||||||
|
|
||||||
# Setup & install feeds
|
# Get the actual SDK filename from the directory listing
|
||||||
wget https://downloads.openwrt.org/releases/${{ matrix.build_env.tag }}/targets/${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}}/feeds.buildinfo -O feeds.conf
|
SDK_FILE=$(curl -s "https://downloads.openwrt.org/releases/${{ matrix.build_env.tag }}/targets/${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}}/" | grep -o "openwrt-sdk-${{ matrix.build_env.tag }}-${{ matrix.build_env.target}}-${{ matrix.build_env.subtarget}}_gcc-[^\"]*_musl\.Linux-x86_64\.tar\.[xz|zst]*" | head -n1)
|
||||||
echo "src-git awgopenwrt https://github.com/Slava-Shchipunov/awg-openwrt.git" >> ./feeds.conf
|
|
||||||
./scripts/feeds update && ./scripts/feeds install -a
|
if [ -z "$SDK_FILE" ]; then
|
||||||
|
echo "SDK file not found for ${{ matrix.build_env.tag }} ${{ matrix.build_env.target}} ${{ matrix.build_env.subtarget}}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SDK_DOWNLOAD_URL="https://downloads.openwrt.org/releases/${{ matrix.build_env.tag }}/targets/${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}}/${SDK_FILE}"
|
||||||
|
echo "Downloading SDK: $SDK_DOWNLOAD_URL"
|
||||||
|
|
||||||
|
wget "$SDK_DOWNLOAD_URL"
|
||||||
|
|
||||||
|
# Extract based on file extension
|
||||||
|
if [[ "$SDK_FILE" == *.tar.zst ]]; then
|
||||||
|
tar --zstd -xf "$SDK_FILE"
|
||||||
|
elif [[ "$SDK_FILE" == *.tar.xz ]]; then
|
||||||
|
tar -xf "$SDK_FILE"
|
||||||
|
else
|
||||||
|
echo "Unknown archive format: $SDK_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm "$SDK_FILE"
|
||||||
|
|
||||||
# Setup config with AWG and dependencies
|
- name: Setup SDK and feeds
|
||||||
wget https://downloads.openwrt.org/releases/${{ matrix.build_env.tag }}/targets/${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}}/config.buildinfo -O .config
|
run: |
|
||||||
echo "CONFIG_PACKAGE_kmod-amneziawg=m" >> .config
|
# Find SDK directory
|
||||||
|
SDK_DIR=$(find . -maxdepth 1 -name "openwrt-sdk-*" -type d | head -n1)
|
||||||
|
|
||||||
|
if [ -z "$SDK_DIR" ]; then
|
||||||
|
echo "SDK directory not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$SDK_DIR"
|
||||||
|
|
||||||
|
# Copy current repository packages to SDK
|
||||||
|
mkdir -p feeds/awgopenwrt
|
||||||
|
cp -r ../../kmod-amneziawg feeds/awgopenwrt/
|
||||||
|
cp -r ../../amneziawg-tools feeds/awgopenwrt/
|
||||||
|
cp -r ../../luci-proto-amneziawg feeds/awgopenwrt/
|
||||||
|
|
||||||
|
# Create feed index
|
||||||
|
echo "src-link awgopenwrt $(pwd)/feeds/awgopenwrt" >> feeds.conf.default
|
||||||
|
./scripts/feeds update awgopenwrt
|
||||||
|
./scripts/feeds install -a -p awgopenwrt
|
||||||
|
|
||||||
|
# Configure packages to build
|
||||||
|
echo "CONFIG_PACKAGE_kmod-amneziawg=m" > .config
|
||||||
echo "CONFIG_PACKAGE_amneziawg-tools=y" >> .config
|
echo "CONFIG_PACKAGE_amneziawg-tools=y" >> .config
|
||||||
echo "CONFIG_PACKAGE_luci-app-amneziawg=y" >> .config
|
echo "CONFIG_PACKAGE_luci-proto-amneziawg=y" >> .config
|
||||||
echo "CONFIG_PACKAGE_kmod-crypto-lib-chacha20=m" >> .config
|
|
||||||
echo "CONFIG_PACKAGE_kmod-crypto-lib-chacha20poly1305=m" >> .config
|
|
||||||
echo "CONFIG_PACKAGE_kmod-crypto-chacha20poly1305=m" >> .config
|
|
||||||
|
|
||||||
make defconfig
|
make defconfig
|
||||||
|
|
||||||
echo " > make tools/install"
|
- name: Build AmneziaWG packages
|
||||||
make tools/install -i -j `nproc`
|
|
||||||
|
|
||||||
cat ./build_dir/target-*/linux-*/linux-*/.vermagic || true
|
|
||||||
|
|
||||||
echo " > make toolchain/install"
|
|
||||||
make toolchain/install -i -j `nproc`
|
|
||||||
|
|
||||||
cat ./build_dir/target-*/linux-*/linux-*/.vermagic || true
|
|
||||||
|
|
||||||
# compile kernel module
|
|
||||||
echo " > make target/linux/compile"
|
|
||||||
make target/linux/compile -i -j `nproc` V=s
|
|
||||||
|
|
||||||
VERMAGIC=`cat ./build_dir/target-*/linux-*/linux-*/.vermagic`
|
|
||||||
VERMAGIC_EXPECTED=${{ matrix.build_env.vermagic }}
|
|
||||||
|
|
||||||
if [ "$VERMAGIC" != "$VERMAGIC_EXPECTED" ]; then
|
|
||||||
echo Vermagic mismatch: $VERMAGIC, expected $VERMAGIC_EXPECTED
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build AmneziaWG
|
|
||||||
run: |
|
run: |
|
||||||
VERMAGIC=`cat ./build_dir/target-*/linux-*/linux-*/.vermagic`
|
# Find SDK directory
|
||||||
echo "Vermagic: $VERMAGIC"
|
SDK_DIR=$(find . -maxdepth 1 -name "openwrt-sdk-*" -type d | head -n1)
|
||||||
|
cd "$SDK_DIR"
|
||||||
|
|
||||||
VERMAGIC_EXPECTED=${{ matrix.build_env.vermagic }}
|
echo "Building AmneziaWG packages..."
|
||||||
|
|
||||||
if [ "$VERMAGIC" != "$VERMAGIC_EXPECTED" ]; then
|
# Build kmod-amneziawg (kernel module)
|
||||||
echo Vermagic mismatch: $VERMAGIC, expected $VERMAGIC_EXPECTED
|
echo "Building kmod-amneziawg..."
|
||||||
exit 1
|
make package/kmod-amneziawg/{download,prepare} V=s || true
|
||||||
fi
|
|
||||||
|
|
||||||
# Ignore kmod build for some targets, replace with the awg-go
|
|
||||||
make package/kmod-amneziawg/{clean,download,prepare} V=s || true
|
|
||||||
make package/kmod-amneziawg/compile V=s || true
|
make package/kmod-amneziawg/compile V=s || true
|
||||||
|
|
||||||
make package/luci-app-amneziawg/{clean,download,prepare}
|
# Build luci-proto-amneziawg (web interface)
|
||||||
make package/luci-app-amneziawg/compile V=s
|
echo "Building luci-proto-amneziawg..."
|
||||||
|
make package/luci-proto-amneziawg/{download,prepare} V=s
|
||||||
|
make package/luci-proto-amneziawg/compile V=s
|
||||||
|
|
||||||
make V=s package/amneziawg-tools/{clean,download,prepare}
|
# Build amneziawg-tools (userspace tools)
|
||||||
make V=s package/amneziawg-tools/compile
|
echo "Building amneziawg-tools..."
|
||||||
|
make package/amneziawg-tools/{download,prepare} V=s
|
||||||
|
make package/amneziawg-tools/compile V=s
|
||||||
|
|
||||||
- name: Prepare artifacts
|
- name: Prepare artifacts
|
||||||
run: |
|
run: |
|
||||||
tag_name=${{ github.ref_name }}
|
# Find SDK directory
|
||||||
|
SDK_DIR=$(find . -maxdepth 1 -name "openwrt-sdk-*" -type d | head -n1)
|
||||||
|
|
||||||
mkdir -p awgrelease
|
mkdir -p awgrelease
|
||||||
postfix="v${{ matrix.build_env.tag }}_${{ matrix.build_env.pkgarch}}_${{ matrix.build_env.target}}_${{ matrix.build_env.subtarget}}"
|
postfix="v${{ matrix.build_env.tag }}_${{ matrix.build_env.pkgarch}}_${{ matrix.build_env.target}}_${{ matrix.build_env.subtarget}}"
|
||||||
cp bin/packages/${{ matrix.build_env.pkgarch }}/awgopenwrt/amneziawg-tools_*.ipk awgrelease/amneziawg-tools_${postfix}.ipk
|
|
||||||
cp bin/packages/${{ matrix.build_env.pkgarch }}/awgopenwrt/luci-app-amneziawg_*.ipk awgrelease/luci-app-amneziawg_${postfix}.ipk
|
# Copy built packages
|
||||||
cp bin/targets/${{ matrix.build_env.target}}/${{ matrix.build_env.subtarget}}/packages/kmod-amneziawg_*.ipk awgrelease/kmod-amneziawg_${postfix}.ipk
|
find "$SDK_DIR/bin/packages" -name "amneziawg-tools_*.ipk" -exec cp {} awgrelease/amneziawg-tools_${postfix}.ipk \; || echo "amneziawg-tools package not found"
|
||||||
|
find "$SDK_DIR/bin/packages" -name "luci-proto-amneziawg_*.ipk" -exec cp {} awgrelease/luci-proto-amneziawg_${postfix}.ipk \; || echo "luci-proto-amneziawg package not found"
|
||||||
|
find "$SDK_DIR/bin/targets" -name "kmod-amneziawg_*.ipk" -exec cp {} awgrelease/kmod-amneziawg_${postfix}.ipk \; || echo "kmod-amneziawg package not found"
|
||||||
|
|
||||||
|
echo "Built packages:"
|
||||||
|
ls -la awgrelease/
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
Reference in New Issue
Block a user