Update main.yml #40
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
# ITNOA | |
# Based on https://github.com/flcdrg/VsShowMissing | |
name: CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
pull_request: | |
env: | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
DOTNET_VERSION: '8.0.x' # The .NET SDK version to use | |
PRODUCT_VERSION: '0.1.0' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
name: build-${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-2004, ubuntu-latest] | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
id: build | |
run: dotnet build --configuration Release --no-restore | |
- name: Install system dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: build-essential libxtables-dev libip6tc-dev libip4tc-dev libiptc-dev libnl-3-dev libnl-3-200 libnetfilter-conntrack3 libnfnetlink-dev libnfnetlink0 libpcap0.8 libpcap0.8-dev sudo | |
version: 1.0 | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Modprobe IP6 tables | |
run: | | |
sudo modprobe ip6_tables | |
sudo modprobe ip6table_filter | |
sudo modprobe ip6table_mangle | |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy | |
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy | |
fi | |
- name: NUnit Tests | |
run: SKIP_SYSTEM_TESTS=1 dotnet test IPTables.Net.Tests | |
- name: Install ipthelper dependency | |
run: | | |
cd ipthelper | |
CONFIG="Release" sudo -E bash install.sh | |
CONFIG="Debug" sudo -E bash install.sh | |
sudo ldconfig | |
cd .. | |
- name: All Tests | |
run: sudo dotnet test | |
upload: | |
name: upload | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
#- name: Upload | |
# run: bash nuget-upload.sh IPTables.Net |