-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (119 loc) · 6.08 KB
/
ci.yml
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
name: CI
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
jobs:
job:
env:
VCPKG_ROOT: '${{ github.workspace }}\vcpkg'
name: build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup CMake and dependencies on macOS
if: ${{ runner.os == 'macOS' }}
run: |
brew install cmake libevent libpcap libsodium openssl
- name: Setup CMake, GCC, and dependencies on Ubuntu
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ cmake libevent-dev libpcap-dev libsodium-dev libssl-dev
- name: Install MSBuild
if: ${{ runner.os == 'Windows' }}
uses: microsoft/[email protected]
- name: Restore vcpkg and its artifacts
if: ${{ runner.os == 'Windows' }}
uses: actions/cache@v3
id: vcpkg-cache
with:
path: |
${{ env.VCPKG_ROOT }}
${{ env.VCPKG_ROOT }}\packages
!${{ env.VCPKG_ROOT }}\.git
!${{ env.VCPKG_ROOT }}\buildtrees
!${{ env.VCPKG_ROOT }}\downloads
Source/Tools
key: |
${{ hashFiles( 'vcpkg.bat' ) }}-${{ runner.os }}-cache-key-v1
- name: Install vcpkg and dependencies on Windows
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
run: |
git clone https://github.com/Microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg.bat
- name: Build the solution
if: ${{ runner.os == 'Windows' }}
run: |
.\vcpkg\vcpkg integrate install
mkdir Source/Dependency
mkdir Source/Dependency/LibEvent
mkdir Source/Dependency/LibEvent/Include_Windows
mkdir Source/Dependency/LibSodium
mkdir Source/Dependency/LibSodium/Include_Windows
mkdir Source/Dependency/WinPcap
mkdir Source/Dependency/WinPcap/Include
cp -Recurse vcpkg/packages/libevent_x64-windows/include/* Source/Dependency/LibEvent/Include_Windows
cp -Recurse vcpkg/packages/libevent_x64-windows/lib/event_core.lib Source/Dependency/LibEvent/LibEvent_Core_x64.lib
cp -Recurse vcpkg/packages/libsodium_x64-windows/include/* Source/Dependency/LibSodium/Include_Windows
cp -Recurse vcpkg/packages/libsodium_x64-windows/lib/libsodium.lib Source/Dependency/LibSodium/LibSodium_x64.lib
cp -Recurse vcpkg/packages/libpcap_x64-windows/include/* Source/Dependency/WinPcap/Include
cp -Recurse vcpkg/packages/winpcap_x64-windows/lib/Packet.lib Source/Dependency/WinPcap/Packet_x64.lib
cp -Recurse vcpkg/packages/winpcap_x64-windows/lib/wpcap.lib Source/Dependency/WinPcap/WPCAP_X64.lib
msbuild Source/Pcap_DNSProxy.sln /p:Configuration=Release /p:Platform=x64 /p:AdditionalIncludeDirectories="$GITHUB_WORKSPACE\vcpkg\installed\x64-windows\include"
cp -Recurse -Force vcpkg/packages/libevent_x86-windows/include/* Source/Dependency/LibEvent/Include_Windows
cp -Recurse -Force vcpkg/packages/libevent_x86-windows/lib/event_core.lib Source/Dependency/LibEvent/LibEvent_Core_x86.lib
cp -Recurse -Force vcpkg/packages/libsodium_x86-windows/include/* Source/Dependency/LibSodium/Include_Windows
cp -Recurse -Force vcpkg/packages/libsodium_x86-windows/lib/libsodium.lib Source/Dependency/LibSodium/LibSodium_x86.lib
cp -Recurse -Force vcpkg/packages/libpcap_x86-windows/include/* Source/Dependency/WinPcap/Include
cp -Recurse -Force vcpkg/packages/winpcap_x86-windows/lib/Packet.lib Source/Dependency/WinPcap/Packet_x86.lib
cp -Recurse -Force vcpkg/packages/winpcap_x86-windows/lib/wpcap.lib Source/Dependency/WinPcap/WPCAP_X86.lib
msbuild Source/Pcap_DNSProxy.sln /p:Configuration=Release /p:Platform=x86 /p:AdditionalIncludeDirectories="$GITHUB_WORKSPACE\vcpkg\installed\x86-windows\include"
- name: Compile and configure Pcap_DNSProxy
run: |
cd Source/Auxiliary/Scripts
chmod +x CMake_Build.sh
./CMake_Build.sh
- name: Download Support for Windows
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
run: |
cd Source
mkdir Tools
mkdir Tools/Support
Invoke-WebRequest https://www.winpcap.org/install/bin/WinPcap_4_1_3.exe -OutFile Tools/WinPcap_4.1.3.exe
Invoke-WebRequest https://westmesatech.com/files/sst27.zip -OutFile Tools/sst27.zip
Expand-Archive Tools/sst27.zip -DestinationPath Tools/Support
Invoke-WebRequest https://www.fourmilab.ch/md5/md5.zip -OutFile Tools/md5.zip
Expand-Archive Tools/md5.zip -DestinationPath Tools/Support
Invoke-WebRequest https://github.com/mbuilov/sed-windows/raw/master/sed-4.9-x86.exe -OutFile Tools/Support/sed.exe
- name: Package release for Windows
if: ${{ runner.os == 'Windows' }}
run: |
cd Source
mkdir Release/x64
cp -Recurse x64/Release/* Release/x64
cp Auxiliary/ExampleConfig/Config.ini Release
cp Auxiliary/ExampleConfig/Hosts.ini Release
cp Auxiliary/ExampleConfig/IPFilter.ini Release
cp Auxiliary/ExampleConfig/Routing.txt Release
cp Auxiliary/ExampleConfig/WhiteList.txt Release
cp Auxiliary/ExampleConfig/ServiceControl.bat Release
mkdir Release/Tools
cp -Recurse Auxiliary/Tools/* Release/Tools
cp Tools/WinPcap_4.1.3.exe Release/Tools
mkdir Release/Tools/Support
cp Tools/Support/CCase.exe Release/Tools/Support
cp (Get-Command curl.exe).Path Release/Tools/Support
cp Tools/Support/md5.exe Release/Tools/Support
cp Tools/Support/sed.exe Release/Tools/Support
- name: Create artifacts
uses: actions/upload-artifact@v3
with:
name: Pcap_DNSProxy-bin-${{ runner.os }}
path: Source/Release/