update go and dependencies #54
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: Lint and Build | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'feature/**' | |
- 'bugfix/**' | |
- 'releases/**' | |
pull_request: | |
branches: ['main'] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install libpcap-dev | |
run: sudo apt install -y libpcap-dev | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Run golangci-lint | |
uses: reviewdog/action-golangci-lint@v2 | |
with: | |
go_version: "1.22" | |
- name: Run hadolint | |
uses: reviewdog/action-hadolint@v1 | |
build: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- name: Install libpcap-dev | |
run: sudo apt install -y libpcap-dev | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.x' | |
- name: Install dependencies | |
run: go get . | |
- name: Test | |
run: go test -v ./... --race | |
- name: Build | |
run: go build -v ./... | |
- name: Build an image from Dockerfile | |
run: | | |
docker build -t controlplane/netassertv2-packet-sniffer:${{ github.sha }} . | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'controlplane/netassertv2-packet-sniffer:${{ github.sha }}' | |
format: 'table' | |
exit-code: '1' | |
vuln-type: 'os,library' | |
output: 'trivy-results.txt' | |
severity: 'CRITICAL,HIGH,MEDIUM' | |
- run: cat trivy-results.txt |