diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a854b64..dd6ef04 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,12 +15,44 @@ jobs: run: sudo apt-get install -y libsodium-dev - name: Setup Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version-file: 'go.mod' - name: Build run: make build - name: Test run: make test + + gomodtidy: + name: Enforce go.mod tidiness + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + with: + ref: "${{ github.event.pull_request.head.sha }}" + repository: ${{github.event.pull_request.head.repo.full_name}} + persist-credentials: false + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + + - name: Execute go mod tidy and check the outcome + working-directory: ./ + run: | + go mod tidy + exit_code=$(git diff --exit-code) + exit ${exit_code} + + - name: Print a comment in case of failure + run: | + echo "The go.mod and/or go.sum files appear not to be correctly tidied. + + Please, rerun go mod tidy to fix the issues." + exit 1 + if: | + failure() && github.event.pull_request.head.repo.full_name == github.repository diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8a0be82..2c354ea 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,6 +13,11 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' - name: Install sodium run: sudo apt-get install -y libsodium-dev diff --git a/.gitignore b/.gitignore index a83bb87..d4e14a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -build/ +pigeon .idea/ diff --git a/.goreleaser.yml b/.goreleaser.yml index cebcff8..eccb8bd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,6 @@ project_name: pigeon builds: - - id: "pigeon" + - id: "{{.ProjectName}}" goos: - linux goarch: @@ -9,7 +9,11 @@ builds: flags: - -v - -buildmode=pie - binary: pigeon + binary: "{{.ProjectName}}" + +dockers: + - image_templates: + - "ghcr.io/falcosecurity/{{.ProjectName}}" release: github: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..126daee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:24.04 + +RUN apt update && apt install -y libsodium-dev + +ENTRYPOINT ["/pigeon"] +COPY pigeon / diff --git a/Makefile b/Makefile index 0951051..d0215a4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -pigeon ?= build/pigeon +pigeon ?= pigeon .PHONY: build build: clean ${pigeon} @@ -6,7 +6,7 @@ build: clean ${pigeon} .PHONY: clean clean: $(RM) -R dist - $(RM) -R build + $(RM) -R ${pigeon} ${pigeon}: go build -buildmode=pie -o $@ .