Skip to content

build(deps): update tonic-build requirement from 0.9.1 to 0.10.2 #70

build(deps): update tonic-build requirement from 0.9.1 to 0.10.2

build(deps): update tonic-build requirement from 0.9.1 to 0.10.2 #70

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths:
- src/*
- .github/workflows/CI.yml
- Cargo.toml
- Dockerfile
pull_request:
branches:
- main
paths:
- src/*
- .github/workflows/CI.yml
- Cargo.toml
- Dockerfile
release:
types: [published]
jobs:
commits:
name: commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: webiny/[email protected]
linter:
name: linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt install libpcap-dev
- name: Clippy
run: cargo clippy --all --all-features -- -D warnings
- name: Format
run: cargo fmt --all -- --check
ci:
name: ${{ matrix.os }} - ${{ matrix.profile }}
runs-on: ${{ matrix.os }}
needs: linter
permissions: write-all
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
build: ['', --release]
include:
- os: macos-latest
os_name: macos
deps: brew install libpcap
- os: ubuntu-latest
os_name: linux
deps: sudo apt install libpcap-dev
- build: ''
profile: debug
- build: --release
profile: release
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: ${{ matrix.deps }}
- name: Build project
run: cargo build ${{ matrix.build }}
- name: Test project
run: |
cargo run ${{ matrix.build }} --bin sniffer-test-server &
sleep 1
cargo run ${{ matrix.build }} --bin sniffer -- --url http://0.0.0.0:50051 -v debug -r test/dataset.pcap
diff test/dataset.pcap server.pcap
packaging:
name: packaging
runs-on: ubuntu-latest
needs: ci
permissions: write-all
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt install build-essential libpcap-dev ruby ruby-dev rubygems libarchive-tools
- name: Install fpm
run: sudo gem install fpm
- name: Build project
run: cargo build --release
- name: Build debian package
run: fpm -t deb -p sniffer-debian.deb --depends libpcap0.8
- name: Build redhat package
run: fpm -t rpm -p sniffer-redhat.rpm --depends libpcap
- name: Build archlinux package
run: fpm -t pacman -p sniffer-archlinux.pkg.tar.zst --depends libpcap
- name: Save debian artifact
uses: actions/upload-artifact@v3
with:
name: sniffer-debian.deb
path: ./sniffer-debian.deb
if-no-files-found: error
- name: Save redhat artifact
uses: actions/upload-artifact@v3
with:
name: sniffer-redhat.rpm
path: ./sniffer-redhat.rpm
if-no-files-found: error
- name: Save archlinux artifact
uses: actions/upload-artifact@v3
with:
name: sniffer-archlinux.pkg.tar.zst
path: ./sniffer-archlinux.pkg.tar.zst
if-no-files-found: error
- name: Upload packages
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: |
./sniffer-debian.deb
./sniffer-redhat.rpm
./sniffer-archlinux.pkg.tar.zst
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: build binary
runs-on: ubuntu-latest
needs: ci
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build
uses: docker/build-push-action@v3
with:
push: false
cache-from: type=gha,scope=sniffer
cache-to: type=gha,mode=max,scope=sniffer
tag: ghcr.io/megalotron/sniffer
outputs: type=image,name=ghcr.io/megalotron/sniffer
- name: Scan built image
uses: azure/container-scan@v0
continue-on-error: true
with:
image-name: ghcr.io/megalotron/sniffer