ci.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. name: aya-ci
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. branches:
  8. - main
  9. env:
  10. CARGO_TERM_COLOR: always
  11. jobs:
  12. lint:
  13. runs-on: ubuntu-22.04
  14. steps:
  15. - uses: actions/checkout@v3
  16. - uses: dtolnay/rust-toolchain@master
  17. with:
  18. toolchain: nightly
  19. components: rustfmt, clippy, miri, rust-src
  20. - uses: Swatinem/rust-cache@v2
  21. - run: cargo install taplo-cli
  22. - run: taplo fmt --check
  23. - name: Check formatting
  24. run: cargo fmt --all -- --check
  25. - uses: taiki-e/install-action@cargo-hack
  26. - name: Run clippy
  27. run: cargo hack clippy --all-targets --feature-powerset --workspace -- --deny warnings
  28. - name: Run miri
  29. run: |
  30. cargo hack miri test --all-targets --feature-powerset \
  31. --exclude aya-bpf \
  32. --exclude aya-bpf-bindings \
  33. --exclude aya-log-ebpf \
  34. --exclude integration-ebpf \
  35. --exclude integration-test \
  36. --workspace
  37. build-test-aya:
  38. needs: ["lint"]
  39. strategy:
  40. fail-fast: false
  41. matrix:
  42. arch:
  43. - x86_64-unknown-linux-gnu
  44. - aarch64-unknown-linux-gnu
  45. - armv7-unknown-linux-gnueabi
  46. - riscv64gc-unknown-linux-gnu
  47. runs-on: ubuntu-22.04
  48. steps:
  49. - uses: actions/checkout@v3
  50. - uses: dtolnay/rust-toolchain@master
  51. with:
  52. toolchain: stable
  53. targets: ${{ matrix.arch }}
  54. - uses: Swatinem/rust-cache@v2
  55. - uses: taiki-e/install-action@cargo-hack
  56. - uses: taiki-e/setup-cross-toolchain-action@v1
  57. with:
  58. target: ${{ matrix.arch }}
  59. - name: Build
  60. run: |
  61. cargo hack build --all-targets --feature-powerset \
  62. --exclude aya-bpf \
  63. --exclude aya-bpf-bindings \
  64. --exclude aya-log-ebpf \
  65. --exclude integration-ebpf \
  66. --workspace
  67. - name: Test
  68. env:
  69. RUST_BACKTRACE: full
  70. run: |
  71. cargo hack test --all-targets --feature-powerset \
  72. --exclude aya-bpf \
  73. --exclude aya-bpf-bindings \
  74. --exclude aya-log-ebpf \
  75. --exclude integration-ebpf \
  76. --exclude integration-test \
  77. --workspace
  78. build-test-aya-bpf:
  79. needs: ["lint"]
  80. strategy:
  81. fail-fast: false
  82. matrix:
  83. arch:
  84. - x86_64
  85. - aarch64
  86. - arm
  87. - riscv64
  88. target:
  89. - bpfel-unknown-none
  90. - bpfeb-unknown-none
  91. runs-on: ubuntu-22.04
  92. steps:
  93. - uses: actions/checkout@v3
  94. - uses: dtolnay/rust-toolchain@master
  95. with:
  96. toolchain: nightly
  97. components: rust-src
  98. - uses: Swatinem/rust-cache@v2
  99. - name: Prereqs
  100. run: cargo install bpf-linker
  101. - uses: taiki-e/install-action@cargo-hack
  102. - name: Build
  103. env:
  104. CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }}
  105. run: |
  106. cargo hack build --package aya-bpf --package aya-log-ebpf \
  107. --feature-powerset \
  108. --target ${{ matrix.target }} \
  109. -Z build-std=core
  110. integration-test:
  111. runs-on: macos-latest
  112. needs: ["lint", "build-test-aya", "build-test-aya-bpf"]
  113. steps:
  114. - uses: actions/checkout@v3
  115. with:
  116. submodules: recursive
  117. - name: Install Pre-requisites
  118. run: |
  119. brew install qemu gnu-getopt coreutils cdrtools
  120. - name: Cache tmp files
  121. uses: actions/cache@v3
  122. with:
  123. path: |
  124. .tmp/*.qcow2
  125. .tmp/test_rsa
  126. .tmp/test_rsa.pub
  127. # FIXME: we should invalidate the cache on new bpf-linker releases.
  128. # For now we must manually delete the cache when we release a new
  129. # bpf-linker version.
  130. key: tmp-files-${{ hashFiles('test/run.sh') }}
  131. - name: Run integration tests
  132. run: test/run.sh
  133. # Provides a single status check for the entire build workflow.
  134. # This is used for merge automation, like Mergify, since GH actions
  135. # has no concept of "when all status checks pass".
  136. # https://docs.mergify.com/conditions/#validating-all-status-checks
  137. build-workflow-complete:
  138. needs: ["lint", "build-test-aya", "build-test-aya-bpf", "integration-test"]
  139. runs-on: ubuntu-latest
  140. steps:
  141. - name: Build Complete
  142. run: echo "Build Complete"