ci.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. - uses: taiki-e/install-action@v2
  22. with:
  23. tool: cargo-hack,taplo-cli
  24. - run: taplo fmt --check
  25. - name: Check formatting
  26. run: cargo fmt --all -- --check
  27. - name: Run clippy
  28. run: cargo hack clippy --all-targets --feature-powerset --workspace -- --deny warnings
  29. - name: Check public API
  30. run: cargo xtask public-api
  31. - name: Run miri
  32. run: |
  33. cargo hack miri test --all-targets --feature-powerset \
  34. --exclude aya-bpf \
  35. --exclude aya-bpf-bindings \
  36. --exclude aya-log-ebpf \
  37. --exclude integration-ebpf \
  38. --exclude integration-test \
  39. --workspace
  40. build-test-aya:
  41. strategy:
  42. fail-fast: false
  43. matrix:
  44. arch:
  45. - x86_64-unknown-linux-gnu
  46. - aarch64-unknown-linux-gnu
  47. - armv7-unknown-linux-gnueabi
  48. - riscv64gc-unknown-linux-gnu
  49. runs-on: ubuntu-22.04
  50. steps:
  51. - uses: actions/checkout@v3
  52. - uses: dtolnay/rust-toolchain@master
  53. with:
  54. toolchain: stable
  55. targets: ${{ matrix.arch }}
  56. - uses: Swatinem/rust-cache@v2
  57. - uses: taiki-e/install-action@cargo-hack
  58. - uses: taiki-e/setup-cross-toolchain-action@v1
  59. with:
  60. target: ${{ matrix.arch }}
  61. - name: Build
  62. run: |
  63. cargo hack build --all-targets --feature-powerset \
  64. --exclude aya-bpf \
  65. --exclude aya-bpf-bindings \
  66. --exclude aya-log-ebpf \
  67. --exclude integration-ebpf \
  68. --workspace
  69. - name: Test
  70. env:
  71. RUST_BACKTRACE: full
  72. run: |
  73. cargo hack test --all-targets --feature-powerset \
  74. --exclude aya-bpf \
  75. --exclude aya-bpf-bindings \
  76. --exclude aya-log-ebpf \
  77. --exclude integration-ebpf \
  78. --exclude integration-test \
  79. --workspace
  80. build-test-aya-bpf:
  81. strategy:
  82. fail-fast: false
  83. matrix:
  84. arch:
  85. - x86_64
  86. - aarch64
  87. - arm
  88. - riscv64
  89. target:
  90. - bpfel-unknown-none
  91. - bpfeb-unknown-none
  92. runs-on: ubuntu-22.04
  93. steps:
  94. - uses: actions/checkout@v3
  95. - uses: dtolnay/rust-toolchain@master
  96. with:
  97. toolchain: nightly
  98. components: rust-src
  99. - uses: Swatinem/rust-cache@v2
  100. - name: Prereqs
  101. run: cargo install bpf-linker --git https://github.com/aya-rs/bpf-linker.git
  102. - uses: taiki-e/install-action@cargo-hack
  103. - name: Build
  104. env:
  105. CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }}
  106. run: |
  107. cargo hack build --package aya-bpf --package aya-log-ebpf \
  108. --feature-powerset \
  109. --target ${{ matrix.target }} \
  110. -Z build-std=core
  111. integration-test:
  112. runs-on: macos-latest
  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"