Fix LuCI menu duplication #312
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| IMAGE_NAME: wg-obfuscator | |
| MUSL_RELEASE: https://github.com/cross-tools/musl-cross/releases/download/20250520/ | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-docker: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| platform: [linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6, linux/arm/v5, linux/386, linux/ppc64le, linux/s390x] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Prepare filename and tag | |
| id: prep | |
| run: | | |
| SAFE_PLATFORM="${{ matrix.platform }}" | |
| SAFE_PLATFORM=$(echo "$SAFE_PLATFORM" | sed 's|linux/||;s|/|-|g') | |
| echo "safe_platform=$SAFE_PLATFORM" >> $GITHUB_OUTPUT | |
| - name: Build per-arch image and export as tar | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: false | |
| tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_NAME }}-${{ steps.prep.outputs.safe_platform }} | |
| platforms: ${{ matrix.platform }} | |
| outputs: type=docker,dest=${{ env.IMAGE_NAME }}-docker-${{ steps.prep.outputs.safe_platform }}.tar | |
| context: . | |
| - name: Upload image tar | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.IMAGE_NAME }}-docker-${{ steps.prep.outputs.safe_platform }}.tar | |
| path: ${{ env.IMAGE_NAME }}-docker-${{ steps.prep.outputs.safe_platform }}.tar | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| # name packages musl CC CFLAGS LDFLAGS | |
| # ======================== x86_64 / x86 ======================== | |
| - [x86, gcc-i686-linux-gnu, "", i686-linux-gnu-gcc, "", "-static"] | |
| #[x86, "", i686-unknown-linux-musl, i686-unknown-linux-musl-gcc, "", "-static"] | |
| - [x64, "", "", gcc, "", "-static"] | |
| #[x64-musl, "", x86_64-unknown-linux-musl, x86_64-unknown-linux-musl-gcc, "", "-static"] | |
| # ======================== ARM (32-bit) ========================= | |
| - [armv5-sf, gcc-arm-linux-gnueabi, "", arm-linux-gnueabi-gcc, "-march=armv5te -mfloat-abi=soft", "-static"] | |
| #[armv5-musl-sf, "", arm-unknown-linux-musleabi, arm-unknown-linux-musleabi-gcc, "-march=armv5te -mfloat-abi=soft", "-static"] | |
| - [armv6-softfp, gcc-arm-linux-gnueabi, "", arm-linux-gnueabi-gcc, "-march=armv6 -mfpu=vfp -mfloat-abi=softfp", "-static"] | |
| #[armv6-musl-softfp, "", arm-unknown-linux-musleabi, arm-unknown-linux-musleabi-gcc, "-march=armv6 -mfpu=vfp -mfloat-abi=softfp", "-static"] | |
| #[armv7-sf, gcc-arm-linux-gnueabi, "", arm-linux-gnueabi-gcc, "-march=armv7-a -mfloat-abi=soft", "-static"] | |
| #[armv7-sf, "", armv7-unknown-linux-musleabi, armv7-unknown-linux-musleabi-gcc, "-march=armv7-a -mfloat-abi=soft", "-static"] | |
| - [armv7-softfp, gcc-arm-linux-gnueabi, "", arm-linux-gnueabi-gcc, "-march=armv7-a -mfpu=vfp -mfloat-abi=softfp", "-static"] | |
| #[armv7-softfp, "", armv7-unknown-linux-musleabi, armv7-unknown-linux-musleabi-gcc, "-march=armv7-a -mfpu=vfp -mfloat-abi=softfp", "-static"] | |
| - [armv7-hf, gcc-arm-linux-gnueabihf, "", arm-linux-gnueabihf-gcc, "-march=armv7-a -mfpu=vfp -mfloat-abi=hard", "-static"] | |
| #[armv7-hf, "", armv7-unknown-linux-musleabihf, armv7-unknown-linux-musleabihf-gcc, "-march=armv7-a -mfpu=vfp -mfloat-abi=hard", "-static"] | |
| - [arm64, gcc-aarch64-linux-gnu, "", aarch64-linux-gnu-gcc, "", "-static"] | |
| #[arm64, "", aarch64-unknown-linux-musl, aarch64-unknown-linux-musl-gcc, "", "-static"] | |
| # ======================== MIPS little-endian ==================== | |
| - [mipsel-mips1, gcc-mipsel-linux-gnu, "", mipsel-linux-gnu-gcc, "-march=mips1 -mabi=32 -mfp32", "-static"] | |
| - [mipsel-mips32, gcc-mipsel-linux-gnu, "", mipsel-linux-gnu-gcc, "-march=mips32 -mabi=32", "-static"] | |
| #[mipsel-mips32, "", mipsel-unknown-linux-musl, mipsel-unknown-linux-musl-gcc, "-march=mips32 -mabi=32", "-static"] | |
| - [mipsel-mips32r2, gcc-mipsel-linux-gnu, "", mipsel-linux-gnu-gcc, "-march=mips32r2 -mabi=32", "-static"] | |
| #[mipsel-mips32r2, "", mipsel-unknown-linux-musl, mipsel-unknown-linux-musl-gcc, "-march=mips32r2 -mabi=32", "-static"] | |
| - [mips64el, gcc-mips64el-linux-gnuabi64, "", mips64el-linux-gnuabi64-gcc, "-march=mips64 -mabi=64", "-static"] | |
| #[mips64el, "", mips64el-unknown-linux-musl, mips64el-unknown-linux-musl-gcc, "-march=mips64 -mabi=64", "-static"] | |
| - [mips64elr2, gcc-mips64el-linux-gnuabi64, "", mips64el-linux-gnuabi64-gcc, "-march=mips64r2 -mabi=64", "-static"] | |
| #[mips64elr2, "", mips64el-unknown-linux-musl, mips64el-unknown-linux-musl-gcc, "-march=mips64r2 -mabi=64", "-static"] | |
| - [mipsel-mips32-sf, "", mipsel-unknown-linux-muslsf, mipsel-unknown-linux-muslsf-gcc, "-march=mips32 -mabi=32", "-static"] | |
| # ======================== MIPS big-endian ======================= | |
| - [mips-mips1, gcc-mips-linux-gnu, "", mips-linux-gnu-gcc, "-march=mips1 -mabi=32 -mfp32", "-static"] | |
| - [mips-mips32, gcc-mips-linux-gnu, "", mips-linux-gnu-gcc, "-march=mips32 -mabi=32", "-static"] | |
| #[mips-mips32, "", mips-unknown-linux-musl, mips-unknown-linux-musl-gcc, "-march=mips32 -mabi=32", "-static"] | |
| - [mips-mips32r2, gcc-mips-linux-gnu, "", mips-linux-gnu-gcc, "-march=mips32r2 -mabi=32", "-static"] | |
| #[mips-mips32r2, "", mips-unknown-linux-musl, mips-unknown-linux-musl-gcc, "-march=mips32r2 -mabi=32", "-static"] | |
| - [mips64, gcc-mips64-linux-gnuabi64, "", mips64-linux-gnuabi64-gcc, "-march=mips64 -mabi=64", "-static"] | |
| #[mips64, "", mips64-unknown-linux-musl, mips64-unknown-linux-musl-gcc, "-march=mips64 -mabi=64", "-static"] | |
| - [mips64r2, gcc-mips64-linux-gnuabi64, "", mips64-linux-gnuabi64-gcc, "-march=mips64r2 -mabi=64", "-static"] | |
| - [mips-mips32-sf, "", mips-unknown-linux-muslsf, mips-unknown-linux-muslsf-gcc, "-march=mips32 -mabi=32", "-static"] | |
| # ======================== other architectures ================= | |
| - [ppc64le, gcc-powerpc64le-linux-gnu, "", powerpc64le-linux-gnu-gcc, "", "-static"] | |
| #[ppc64le-musl, "", powerpc64-unknown-linux-musl, powerpc64-unknown-linux-musl-gcc, "", "-static"] | |
| - [powerpc, gcc-powerpc-linux-gnu, "", powerpc-linux-gnu-gcc, "", "-static"] | |
| #[powerpc, "", powerpc-unknown-linux-musl, powerpc-unknown-linux-musl-gcc, "", "-static"] | |
| - [s390x, gcc-s390x-linux-gnu, "", s390x-linux-gnu-gcc, "", "-static"] | |
| #[s390x, "", s390x-ibm-linux-musl, s390x-ibm-linux-musl-gcc, "", "-static"] | |
| #[riscv32, gcc-riscv64-linux-gnu, "", riscv64-linux-gnu-gcc, "-march=rv32gc -mabi=ilp32", "-static"] | |
| - [riscv32, "", riscv32-unknown-linux-musl, riscv32-unknown-linux-musl-gcc, "", "-static"] | |
| - [riscv64, gcc-riscv64-linux-gnu, "", riscv64-linux-gnu-gcc, "", "-static"] | |
| #[riscv64-musl, "", riscv64-unknown-linux-musl, riscv64-unknown-linux-musl-gcc, "", "-static"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install ${{ matrix.target[1] }} | |
| if: matrix.target[1] != '' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ${{ matrix.target[1] }} | |
| - name: Install musl ${{ matrix.target[2] }} toolchain | |
| if: matrix.target[2] != '' | |
| run: | | |
| #LATEST=$(curl -s https://api.github.com/repos/cross-tools/musl-cross/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
| #MUSL_RELEASE=https://github.com/cross-tools/musl-cross/releases/download/${LATEST}/ | |
| URL=${{ env.MUSL_RELEASE }}${{ matrix.target[2] }}.tar.xz | |
| echo "Downloading musl toolchain from $URL" | |
| wget $URL | |
| tar -xJvf ${{ matrix.target[2] }}.tar.xz | |
| echo "$(pwd)/${{ matrix.target[2] }}/bin" >> $GITHUB_PATH | |
| - name: Clean and build ${{ matrix.target[0] }} | |
| run: | | |
| make clean | |
| make all CC=${{ matrix.target[3] }} CFLAGS='-O2 -Wall ${{ matrix.target[4] }}' LDFLAGS='${{ matrix.target[5] }}' | |
| - name: Prepare files | |
| run: | | |
| mkdir -p output | |
| cp LICENSE *.md ${{ env.IMAGE_NAME }} *.conf output/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.IMAGE_NAME }}-linux-${{ matrix.target[0] }}.zip | |
| path: output/ | |
| build-macos-arm64: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: make clean all | |
| run: make clean all | |
| - name: Prepare files | |
| run: | | |
| mkdir -p output | |
| cp LICENSE *.md ${{ env.IMAGE_NAME }} *.conf output/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.IMAGE_NAME }}-macos-arm64.zip | |
| path: output/ | |
| build-macos-x64: | |
| runs-on: macos-13 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: make clean all | |
| run: make clean all | |
| - name: Prepare files | |
| run: | | |
| mkdir -p output | |
| cp LICENSE *.md ${{ env.IMAGE_NAME }} *.conf output/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.IMAGE_NAME }}-macos-x64.zip | |
| path: output/ | |
| build-windows: | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| update: true | |
| install: >- | |
| base-devel | |
| gcc | |
| git | |
| zip | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: make clean all | |
| run: make clean all | |
| - name: Prepare files | |
| run: | | |
| mkdir -p output | |
| cp LICENSE *.md *.dll *.exe *.conf output/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.IMAGE_NAME }}-windows-x64.zip | |
| path: output/ | |
| upload-to-pages: | |
| needs: | |
| - build-docker | |
| - build-linux | |
| - build-macos-arm64 | |
| - build-windows | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Install zip | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y zip | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Process docker images | |
| run: | | |
| for d in *.tar; do | |
| [ -d "$d" ] || continue | |
| mv "$d" "${d}-tmp" | |
| mv "${d}-tmp"/* . | |
| rm -rf "${d}-tmp" | |
| done | |
| - name: Process binaries | |
| run: | | |
| for d in *.zip; do | |
| [ -d "$d" ] || continue | |
| mv "$d" "wg-obfuscator" | |
| FN="${d%.*}.zip" | |
| zip -r9m "$FN" "wg-obfuscator" | |
| done | |
| - name: Generate index.html | |
| run: "(echo \"<html><head><title>WireGuard Obfuscator</title></head><body><h1>WireGuard Obfuscator</h1>This is automatic CI builds: binaries and Docker images. Install those builds only if you want to test some unreleased features. Can be buggy.<br/><br/>Updated: `date`<br/><br/>Binaries:<br/>\" ; for file in *.zip ; do echo \"<a href='$file'>$file</a><br/>\" ; done ; echo \"<br/>Docker images:<br/>\" ; for file in *.tar ; do echo \"<a href='$file'>$file</a><br/>\" ; done ; echo \"</body></html>\") > index.html" | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: '.' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |