rust.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. name: CI
  2. on:
  3. push:
  4. branches: [ "main" ]
  5. pull_request:
  6. branches: [ "main" ]
  7. workflow_dispatch:
  8. env:
  9. CARGO_UNSTABLE_SPARSE_REGISTRY: true
  10. CARGO_TERM_COLOR: always
  11. jobs:
  12. fmt:
  13. name: Rustfmt
  14. runs-on: ubuntu-latest
  15. steps:
  16. - uses: actions/checkout@v4
  17. - uses: actions-rs/toolchain@v1
  18. with:
  19. profile: minimal
  20. toolchain: stable
  21. override: true
  22. components: rustfmt
  23. - name: Cache Dependencies
  24. uses: Swatinem/rust-cache@v2
  25. - uses: actions-rs/cargo@v1
  26. with:
  27. command: fmt
  28. args: --all -- --check
  29. check-stable:
  30. name: Cargo check (stable)
  31. runs-on: ubuntu-latest
  32. needs: fmt
  33. strategy:
  34. matrix:
  35. TARGET: [riscv64imac-unknown-none-elf, riscv32imac-unknown-none-elf]
  36. steps:
  37. - uses: actions/checkout@v4
  38. - uses: actions-rs/toolchain@v1
  39. with:
  40. profile: minimal
  41. toolchain: stable
  42. override: true
  43. target: ${{ matrix.TARGET }}
  44. - name: Cache Dependencies
  45. uses: Swatinem/rust-cache@v2
  46. with:
  47. key: ${{ matrix.TARGET }}
  48. - name: Check (no default features)
  49. uses: actions-rs/cargo@v1
  50. with:
  51. command: check
  52. args: --target ${{ matrix.TARGET }} --verbose
  53. - name: Check (machine)
  54. uses: actions-rs/cargo@v1
  55. with:
  56. command: check
  57. args: --target ${{ matrix.TARGET }} --features "machine" --verbose
  58. check-nightly:
  59. name: Cargo check (nightly)
  60. runs-on: ubuntu-latest
  61. needs: fmt
  62. strategy:
  63. matrix:
  64. TARGET: [riscv64imac-unknown-none-elf, riscv32imac-unknown-none-elf]
  65. steps:
  66. - uses: actions/checkout@v4
  67. - uses: actions-rs/toolchain@v1
  68. with:
  69. profile: minimal
  70. toolchain: nightly
  71. override: true
  72. target: ${{ matrix.TARGET }}
  73. - name: Cache Dependencies
  74. uses: Swatinem/rust-cache@v2
  75. with:
  76. key: ${{ matrix.TARGET }}
  77. tests:
  78. name: Run tests
  79. needs: fmt
  80. runs-on: ubuntu-latest
  81. steps:
  82. - uses: actions/checkout@v4
  83. - uses: actions-rs/toolchain@v1
  84. with:
  85. profile: minimal
  86. toolchain: stable
  87. components: clippy
  88. override: true
  89. - name: Cache Dependencies
  90. uses: Swatinem/rust-cache@v2
  91. - name: Clippy
  92. uses: actions-rs/cargo@v1
  93. with:
  94. command: clippy
  95. - name: Run tests (no default features)
  96. uses: actions-rs/cargo@v1
  97. with:
  98. command: test
  99. args: --verbose
  100. - name: Run tests (machine)
  101. uses: actions-rs/cargo@v1
  102. with:
  103. command: test
  104. args: --features "machine" --verbose