name: Build kpatch

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: src/kpatch
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Install build tools
        run: sudo apt-get update && sudo apt-get install -y build-essential

      - name: Build kpatch binaries
        run: make

      - name: Upload entire repository as zip
        uses: actions/upload-artifact@v4
        with:
          name: psfree-lapse
          path: ${{ github.workspace }}
          if-no-files-found: error
          compression-level: 9
