forked from xfangfang/PPPwn_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (121 loc) · 5.44 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
on:
push:
workflow_dispatch:
jobs:
info:
name: Info
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: info
run: |
echo "Git commit: $(git rev-parse HEAD)" > build_info.txt
echo "Build time: $(date)" >> build_info.txt
echo "BUILD_TIME=$(date +"%Y%m%d_%H-%M-%S")" >> $GITHUB_OUTPUT
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: ${{ steps.info.outputs.BUILD_TIME }}
path: build_info.txt
build:
name: "${{ matrix.target }}${{ matrix.name}}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { target: x86_64-macos-none, os: macos-13 , strip: "strip", upx: "ls" }
- { target: aarch64-macos-none, os: macos-14 , strip: "strip", upx: "ls" }
- { target: x86_64-windows-gnu, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF -DPacket_ROOT=/tmp/sdk", ext: ".exe" }
- { target: x86-windows-gnu, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF -DPacket_ROOT=/tmp/sdk86", ext: ".exe" }
- { target: aarch64-windows-gnu, os: ubuntu-latest, strip: "llvm-strip", upx: "ls",
cmake: "-DUSE_SYSTEM_PCAP=OFF -DPacket_ROOT=/tmp/sdkarm", ext: ".exe" }
- { target: x86_64-linux-musl, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF" }
- { target: aarch64-linux-musl, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF" }
- { target: arm-linux-musleabi, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF -DZIG_COMPILE_OPTION='-mcpu=cortex_a7'", name: "(cortex_a7)" }
- { target: arm-linux-musleabi, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF -DZIG_COMPILE_OPTION='-mcpu=mpcorenovfp'", name: "(mpcorenovfp)" }
- { target: arm-linux-musleabi, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF -DZIG_COMPILE_OPTION='-mcpu=arm1176jzf_s'", name: "(pi_zero_w)" }
- { target: mipsel-linux-musl, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF -DZIG_COMPILE_OPTION='-msoft-float;-ffunction-sections'" }
- { target: mips-linux-musl, os: ubuntu-latest, strip: "llvm-strip", upx: "upx --lzma",
cmake: "-DUSE_SYSTEM_PCAP=OFF -DZIG_COMPILE_OPTION='-msoft-float;-ffunction-sections'" }
steps:
- uses: actions/checkout@v4
- name: Install UPX
if: matrix.os == 'ubuntu-latest'
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: Install Dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install llvm --no-install-recommends
- name: Download NPCAP SDK
if: contains(matrix.target, 'windows')
run: |
wget https://github.com/xfangfang/PPPwn_cpp/releases/download/1.0.0/npcap-sdk-1.13.zip -O /tmp/sdk.zip
unzip /tmp/sdk.zip -d /tmp/sdk
mkdir -p /tmp/sdk/lib/x64
mkdir -p /tmp/sdk86/lib
mkdir -p /tmp/sdkarm/lib
cp /tmp/sdk/Lib/x64/*lib /tmp/sdk/lib/x64
cp /tmp/sdk/Lib/x64/*lib /tmp/sdk/lib
cp /tmp/sdk/Lib/*lib /tmp/sdk86/lib
cp -r /tmp/sdk/Include /tmp/sdk86
cp /tmp/sdk/Lib/ARM64/*lib /tmp/sdkarm/lib
cp -r /tmp/sdk/Include /tmp/sdkarm
- name: Build executable
run: |
sudo rm -rf /usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc
cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel -DZIG_TARGET=${{ matrix.target }} ${{ matrix.cmake }}
cmake --build build -t pppwn -- -j$(nproc)
${{ matrix.strip }} build/pppwn${{ matrix.ext }}
${{ matrix.upx }} build/pppwn${{ matrix.ext }}
cd build && tar -czvf pppwn.tar.gz pppwn${{ matrix.ext }}
- name: Upload result
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.target }}${{ matrix.name}}"
path: build/pppwn.tar.gz
build-windows:
name: "${{ matrix.arch }}-windows-gnu(win7)"
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
include:
- { arch: x86_64, msystem: MINGW64 }
- { arch: x86, msystem: MINGW32 }
env:
MSYSTEM: ${{ matrix.msystem }}
MSYS2_PATH_TYPE: inherit
defaults:
run:
shell: C:\shells\msys2bash.cmd {0}
steps:
- uses: actions/checkout@v4
- name: Install dependency
run: |
pacman -S --needed --noconfirm --noprogressbar \
${MINGW_PACKAGE_PREFIX}-gcc \
${MINGW_PACKAGE_PREFIX}-ninja unzip upx
wget https://github.com/xfangfang/PPPwn_cpp/releases/download/1.0.0/npcap-sdk-1.13.zip -O npcap-sdk.zip
unzip npcap-sdk.zip -d sdk
- name: Build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel -DPCAP_ROOT=`pwd`/sdk
cmake --build build -t pppwn
strip build/pppwn.exe
upx --lzma build/pppwn.exe
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-windows-gnu(win7)
path: build/pppwn.exe