gen.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. name: codegen
  2. on: workflow_dispatch
  3. jobs:
  4. codegen:
  5. runs-on: ubuntu-24.04
  6. steps:
  7. - uses: actions/checkout@v4
  8. with:
  9. submodules: recursive
  10. - name: update libbpf
  11. working-directory: xtask/libbpf
  12. run: |
  13. set -e
  14. git fetch origin
  15. git checkout origin/HEAD
  16. echo "LIBBPF_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
  17. - uses: dtolnay/rust-toolchain@master
  18. with:
  19. toolchain: nightly
  20. components: rustfmt, clippy
  21. - uses: Swatinem/rust-cache@v2
  22. - name: Install headers
  23. continue-on-error: true
  24. run: |
  25. sudo apt-get -y update
  26. sudo apt -y install linux-headers-`uname -r` libelf-dev libc6-dev libc6-dev-{arm64,armel,riscv64,ppc64el,s390x}-cross
  27. sudo dpkg --add-architecture arm64
  28. sudo dpkg --add-architecture armel
  29. sudo dpkg --add-architecture riscv64
  30. sudo dpkg --add-architecture ppc64el
  31. sudo dpkg --add-architecture s390x
  32. sudo find / -name posix_types.h | grep "asm/posix_types.h"
  33. - name: Run codegen
  34. run: |
  35. cargo xtask codegen
  36. - name: Check for changes
  37. run: |
  38. git diff --quiet || echo "COMMIT_CHANGES=1" >> $GITHUB_ENV
  39. - name: Commit Changes
  40. id: commit
  41. if: env.COMMIT_CHANGES == 1
  42. uses: devops-infra/action-commit-push@master
  43. with:
  44. github_token: "${{ secrets.CRABBY_GITHUB_TOKEN }}"
  45. commit_prefix: "[codegen] Update libbpf to ${{ env.LIBBPF_SHA }}"
  46. commit_message: "Update libbpf to ${{ env.LIBBPF_SHA }}"
  47. target_branch: codegen
  48. force: true
  49. - name: Create pull request
  50. if: steps.commit.outputs.files_changed != ''
  51. uses: devops-infra/action-pull-request@master
  52. with:
  53. github_token: ${{ secrets.CRABBY_GITHUB_TOKEN }}
  54. body: "**Automated pull request**<br><br>Update libbpf to ${{ env.LIBBPF_SHA }}"
  55. title: Update libbpf to ${{ env.LIBBPF_SHA }}
  56. source_branch: codegen
  57. target_branch: main
  58. get_diff: true