rust.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. - name: Check (forward)
  59. uses: actions-rs/cargo@v1
  60. with:
  61. command: check
  62. args: --target ${{ matrix.TARGET }} --features "forward" --verbose
  63. - name: Check (machine + forward)
  64. uses: actions-rs/cargo@v1
  65. with:
  66. command: check
  67. args: --target ${{ matrix.TARGET }} --features "machine, forward" --verbose
  68. check-nightly:
  69. name: Cargo check (nightly)
  70. runs-on: ubuntu-latest
  71. needs: fmt
  72. strategy:
  73. matrix:
  74. TARGET: [riscv64imac-unknown-none-elf, riscv32imac-unknown-none-elf]
  75. steps:
  76. - uses: actions/checkout@v4
  77. - uses: actions-rs/toolchain@v1
  78. with:
  79. profile: minimal
  80. toolchain: nightly
  81. override: true
  82. target: ${{ matrix.TARGET }}
  83. - name: Cache Dependencies
  84. uses: Swatinem/rust-cache@v2
  85. with:
  86. key: ${{ matrix.TARGET }}
  87. tests:
  88. name: Run tests
  89. needs: fmt
  90. runs-on: ubuntu-latest
  91. steps:
  92. - uses: actions/checkout@v4
  93. - uses: actions-rs/toolchain@v1
  94. with:
  95. profile: minimal
  96. toolchain: stable
  97. components: clippy
  98. override: true
  99. - name: Cache Dependencies
  100. uses: Swatinem/rust-cache@v2
  101. - name: Clippy
  102. uses: actions-rs/cargo@v1
  103. with:
  104. command: clippy
  105. - name: Run tests (no default features)
  106. uses: actions-rs/cargo@v1
  107. with:
  108. command: test
  109. args: --verbose
  110. - name: Run tests (machine)
  111. uses: actions-rs/cargo@v1
  112. with:
  113. command: test
  114. args: --features "machine" --verbose