Skip to content

chore(deps): update github actions #664

chore(deps): update github actions

chore(deps): update github actions #664

Workflow file for this run

name: Continious integration
on:
pull_request:
branches:
- main
jobs:
tests:
name: Run tests and upload results
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.22", "1.23"]
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
# This is currently workaround for checking if gofiles have changed,
# Because paths filter doesn't work with required checks
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45
with:
files: |
cmd/**
internal/**
.golangci.yml
go.mod
go.sum
- name: Setup Go
if: steps.changed-files.outputs.any_modified == 'true'
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
with:
go-version: ${{ matrix.go-version }}
- name: golangci-lint
if: steps.changed-files.outputs.any_modified == 'true'
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6
with:
version: v1.61.0
args: --timeout=5m
- name: Install dependencies
if: steps.changed-files.outputs.any_modified == 'true'
run: go mod download
- name: Test with Go
if: steps.changed-files.outputs.any_modified == 'true'
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage reports to Codecov
if: steps.changed-files.outputs.any_modified == 'true'
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: cover.txt
slug: bl4ko/netbox-ssot
vulnerabilities:
name: Check for vulnerabilities
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45
with:
files: |
cmd/**
internal/**
.golangci.yml
go.mod
go.sum
.dockerignore
Dockerfile
# https://github.com/aquasecurity/trivy-action?tab=readme-ov-file#scan-ci-pipeline
- name: Build an image from Dockerfile
if: steps.changed-files.outputs.any_modified == 'true'
run: |
docker build -t netbox-ssot:${{ github.sha }} .
- name: Run Trivy vulnerability scanner
if: steps.changed-files.outputs.any_modified == 'true'
uses: aquasecurity/trivy-action@master
# We use proxies to avoid rate limiting for trivy database
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db
with:
image-ref: netbox-ssot:${{ github.sha }}
format: table
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'