From 79a7ae72f8e9aa0ca6f8db0d74fa4d3a30078f71 Mon Sep 17 00:00:00 2001 From: Mahe Tardy Date: Wed, 29 Jan 2025 19:33:03 +0100 Subject: [PATCH] ci: build tetragon on every commit of a PR Authors can often lose track when rebasing large PR and submit a PR containing commits that don't compile. It can then make it harder to bisect regressions. This workflow should ensure that at least each commits build. Signed-off-by: Mahe Tardy --- .github/workflows/static-checks.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index 2a8baae3bd3..37f4ff90c9b 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -17,6 +17,31 @@ permissions: contents: read jobs: + build-every-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Install Go + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + # renovate: datasource=golang-version depName=go + go-version: '1.23.5' + + - name: Check if build works for every commit + run: | + set -x + PR_FIRST_COMMIT=$(git rev-list --reverse -1 origin/${{ github.event.pull_request.base.ref }}..HEAD) + git rebase --exec "make -j$(nproc) tetragon tetra tetragon-bpf tetragon-operator" $PR_FIRST_COMMIT^ + + - name: Failed commit during the build + if: ${{ failure() }} + run: git --no-pager log --format=%B -n 1 + ensure-no-binary-checkin: runs-on: ubuntu-latest steps: