main.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. name: CI
  2. on:
  3. push:
  4. branches: [master]
  5. pull_request:
  6. jobs:
  7. check:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v2
  11. - uses: actions-rs/toolchain@v1
  12. with:
  13. profile: minimal
  14. toolchain: stable
  15. components: rustfmt, clippy
  16. - name: Check code format
  17. uses: actions-rs/cargo@v1
  18. with:
  19. command: fmt
  20. args: --all -- --check
  21. - name: Clippy
  22. uses: actions-rs/clippy-check@v1
  23. with:
  24. token: ${{ secrets.GITHUB_TOKEN }}
  25. build:
  26. runs-on: ubuntu-latest
  27. steps:
  28. - uses: actions/checkout@v2
  29. - uses: actions-rs/toolchain@v1
  30. with:
  31. profile: minimal
  32. toolchain: stable
  33. - name: Build with no features
  34. uses: actions-rs/cargo@v1
  35. with:
  36. command: build
  37. args: --no-default-features
  38. - name: Build with all features
  39. uses: actions-rs/cargo@v1
  40. with:
  41. command: build
  42. args: --all-features
  43. - name: Docs
  44. uses: actions-rs/cargo@v1
  45. with:
  46. command: doc
  47. - name: Test with no features
  48. uses: actions-rs/cargo@v1
  49. with:
  50. command: test
  51. args: --no-default-features
  52. - name: Test with all features
  53. uses: actions-rs/cargo@v1
  54. with:
  55. command: test
  56. args: --all-features
  57. examples:
  58. runs-on: ubuntu-22.04
  59. strategy:
  60. fail-fast: false
  61. matrix:
  62. example:
  63. - aarch64
  64. - riscv
  65. - x86_64
  66. include:
  67. - example: aarch64
  68. toolchain: stable
  69. target: aarch64-unknown-none
  70. packages: qemu-system-arm gcc-aarch64-linux-gnu
  71. - example: riscv
  72. toolchain: nightly-2022-11-03
  73. target: riscv64imac-unknown-none-elf
  74. packages: qemu-system-misc
  75. - example: x86_64
  76. toolchain: nightly
  77. target: x86_64-unknown-none
  78. packages: qemu-system-x86
  79. steps:
  80. - uses: actions/checkout@v2
  81. - name: Install QEMU
  82. run: sudo apt update && sudo apt install ${{ matrix.packages }} && sudo chmod 666 /dev/vhost-vsock
  83. - uses: actions-rs/toolchain@v1
  84. with:
  85. profile: minimal
  86. toolchain: ${{ matrix.toolchain }}
  87. target: ${{ matrix.target }}
  88. components: llvm-tools-preview, rustfmt
  89. - name: Check code format
  90. working-directory: examples/${{ matrix.example }}
  91. run: cargo fmt --all -- --check
  92. - name: Build
  93. working-directory: examples/${{ matrix.example }}
  94. run: make kernel
  95. - name: Run
  96. working-directory: examples/${{ matrix.example }}
  97. run: QEMU_ARGS="-display none" make qemu accel="off"