Skip to content

Commit

Permalink
dotnet-core.yml github workflow script
Browse files Browse the repository at this point in the history
  • Loading branch information
chmorgan committed Aug 16, 2020
1 parent 6898951 commit 27acfe5
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: .NET Core

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
ubuntu:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301
- name: Install .net dependencies
run: dotnet restore
- name: Install libpcap
run: sudo -E bash scripts/install-libpcap.sh
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet test
- name: publish on version change
id: publish_nuget
uses: rohith/publish-nuget@v2
with:
# Filepath of the project to be packaged, relative to root of repository
PROJECT_FILE_PATH: PacketDotNetConnections/PacketDotNetConnections.csproj

# API key to authenticate with NuGet server
NUGET_KEY: ${{secrets.NUGET_API_KEY}}

windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301
- name: Install .net dependencies
run: dotnet restore
- name: Install winpcap
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install winpcap
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet test
35 changes: 35 additions & 0 deletions scripts/install-libpcap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# the default installation of libpcap does not have remote pcap enabled
# so we need to compile our own
# see https://github.com/the-tcpdump-group/libpcap/issues/795

# Those are the dependencies needed to build libpcap
if [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX, use https://www.macports.org/
port install bison
port install flex
else
# Ubuntu
apt-get install -y build-essential bison flex
fi

# clone into tmp folder
rm -rf /tmp/install-libpcap

# 1.9.1 is the version we tested to work
git clone --depth 1 -b libpcap-1.9.1 https://github.com/the-tcpdump-group/libpcap.git /tmp/install-libpcap

pushd /tmp/install-libpcap

# remote is disabled by default, so we need to enable it
./configure --enable-remote --disable-universal

# install the library
make install

# create the necessary links and cache
# see https://www.mono-project.com/docs/advanced/pinvoke/dllnotfoundexception/
ldconfig

popd

0 comments on commit 27acfe5

Please sign in to comment.