name: build-branch run-name: Build for branches on: workflow_dispatch: push: branches: - development paths: - 'ip2net/**' - 'mdig/**' - 'nfq/**' - 'tpws/**' jobs: build-linux: name: Linux ${{ matrix.arch }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - arch: arm64 tool: aarch64-unknown-linux-musl - arch: arm tool: arm-unknown-linux-musleabi - arch: mips64 tool: mips64-unknown-linux-musl - arch: mipselsf tool: mipsel-unknown-linux-muslsf - arch: mipssf tool: mips-unknown-linux-muslsf - arch: ppc tool: powerpc-unknown-linux-musl - arch: x86 tool: i586-unknown-linux-musl - arch: x86_64 tool: x86_64-unknown-linux-musl steps: - name: Checkout uses: actions/checkout@v4 with: path: zapret - name: Set up build tools env: ARCH: ${{ matrix.arch }} TOOL: ${{ matrix.tool }} run: | sudo apt update -qq sudo apt install -y libcap-dev URL=https://github.com/spvkgn/musl-cross/releases/download/latest/$TOOL.tar.xz mkdir -p $HOME/tools wget -qO- $URL | tar -C $HOME/tools -xJ || exit 1 [[ -d "$HOME/tools/$TOOL/bin" ]] && echo "$HOME/tools/$TOOL/bin" >> $GITHUB_PATH - name: Build env: ARCH: ${{ matrix.arch }} TARGET: ${{ matrix.tool }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | export CC="$TARGET-gcc" export LD=$TARGET-ld export AR=$TARGET-ar export NM=$TARGET-nm export STRIP=$TARGET-strip make -C zapret -j$(nproc) tar -C zapret/binaries/my -cJf zapret-linux-$ARCH.tar.xz . - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: zapret-linux-${{ matrix.arch }} path: zapret-*.tar.xz if-no-files-found: error build-macos: name: macOS runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Build zapret run: | export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}" make mac -j$(sysctl -n hw.logicalcpu) tar -C binaries/my -cJf zapret-mac-x64.tar.xz . - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: zapret-mac-x64 path: zapret-*.tar.xz if-no-files-found: error build-windows: name: Windows ${{ matrix.arch }} runs-on: windows-latest strategy: fail-fast: false matrix: arch: [ x86_64, x86 ] steps: - name: Checkout uses: actions/checkout@v4 with: path: zapret - name: Set up MinGW uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.arch == 'x86_64' && 'MINGW64' || 'MINGW32' }} install: >- ${{ matrix.arch == 'x86_64' && 'mingw-w64-x86_64-toolchain' || 'mingw-w64-i686-toolchain' }} - name: Build ip2net, mdig shell: msys2 {0} run: | export CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }}" mkdir -p output cd zapret mingw32-make -C ip2net win mingw32-make -C mdig win cp -a {ip2net/ip2net,mdig/mdig}.exe ../output - name: Create zip env: BITS: ${{ matrix.arch == 'x86_64' && '64' || '32' }} run: | zip zapret-win-${{ matrix.arch }}.zip -j output/* - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: zapret-win-${{ matrix.arch }} path: zapret-*.zip if-no-files-found: error