Skip to content

Include last 10 releases in apt repo (#110) #236

Include last 10 releases in apt repo (#110)

Include last 10 releases in apt repo (#110) #236

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
concurrency:
group: go-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
env:
NFPM_VERSION: v2.45.0
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
changes:
runs-on: ubuntu-latest
outputs:
run_ci: ${{ steps.filter.outputs.ci }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- id: filter
uses: ./.github/actions/common-ci-filter
build:
needs: changes
if: needs.changes.outputs.run_ci == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Install libpcap-dev
run: sudo apt-get update && sudo apt-get install -y libpcap-dev
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Check formatting
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "The following files are not formatted:"
gofmt -l .
exit 1
fi
- name: golangci-lint
run: golangci-lint run --timeout=5m
- name: go mod tidy
run: |
go mod tidy
if [ -n "$(git status --porcelain go.mod go.sum)" ]; then
echo "go.mod or go.sum is not tidy"
git diff go.mod go.sum
exit 1
fi
- name: Test
run: go test -v ./...
- name: Build
run: go build -v ./cmd/etr
- name: Validate packaging config (nfpm)
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${NFPM_VERSION}
mkdir -p dist
install -m 0755 ./etr ./dist/etr
ARCH=amd64 VERSION=0.0.0-ci nfpm package --packager deb --config ./nfpm.yaml --target ./dist/etr_0.0.0-ci_amd64.deb
ARCH=x86_64 VERSION=0.0.0-ci nfpm package --packager rpm --config ./nfpm.yaml --target ./dist/etr-0.0.0-ci-1.x86_64.rpm