Update bug-report.yml #22
This file contains 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 and upload artifacts | |
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/ |