rust.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. name: Build
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. branches: [ main ]
  7. env:
  8. CARGO_TERM_COLOR: always
  9. jobs:
  10. # Regular build (with std) + test execution
  11. build:
  12. runs-on: ubuntu-latest
  13. strategy:
  14. matrix:
  15. rust:
  16. - stable
  17. - nightly
  18. - 1.52.1 # MSVR
  19. steps:
  20. - uses: actions/checkout@v3
  21. # Important preparation step: override the latest default Rust version in GitHub CI
  22. # with the current value of the iteration in the "strategy.matrix.rust"-array.
  23. - uses: actions-rs/toolchain@v1
  24. with:
  25. profile: default
  26. toolchain: ${{ matrix.rust }}
  27. override: true
  28. # helps to identify if the right cargo version is actually used
  29. - run: cargo version
  30. - name: Build
  31. run: cargo build --all-targets --verbose
  32. - name: Run tests
  33. run: cargo test --verbose
  34. # no-std build without tests
  35. build_no_std:
  36. runs-on: ubuntu-latest
  37. strategy:
  38. matrix:
  39. rust:
  40. - stable
  41. - nightly
  42. - 1.52.1 # MSVR
  43. steps:
  44. - uses: actions/checkout@v3
  45. # Important preparation step: override the latest default Rust version in GitHub CI
  46. # with the current value of the iteration in the "strategy.matrix.rust"-array.
  47. - uses: actions-rs/toolchain@v1
  48. with:
  49. profile: default
  50. toolchain: ${{ matrix.rust }}
  51. override: true
  52. # helps to identify if the right cargo version is actually used
  53. - run: cargo version
  54. - name: "Rustup: install some no_std target"
  55. run: rustup target add thumbv7em-none-eabihf
  56. - name: Build (no_std)
  57. run: cargo build --target thumbv7em-none-eabihf
  58. # Tests that the unstable feature, which requires nightly, builds.
  59. build_unstable:
  60. runs-on: ubuntu-latest
  61. strategy:
  62. matrix:
  63. rust:
  64. - nightly
  65. steps:
  66. - uses: actions/checkout@v3
  67. # Important preparation step: override the latest default Rust version in GitHub CI
  68. # with the current value of the iteration in the "strategy.matrix.rust"-array.
  69. - uses: actions-rs/toolchain@v1
  70. with:
  71. profile: default
  72. toolchain: ${{ matrix.rust }}
  73. override: true
  74. - name: Build (unstable)
  75. run: cargo build --all-targets --features unstable
  76. - name: Test (unstable)
  77. run: cargo test --all-targets --features unstable
  78. # As discussed, these tasks are optional for PRs.
  79. style_checks:
  80. runs-on: ubuntu-latest
  81. strategy:
  82. matrix:
  83. rust:
  84. - 1.52.1 # MSVR
  85. steps:
  86. - uses: actions/checkout@v3
  87. # Important preparation step: override the latest default Rust version in GitHub CI
  88. # with the current value of the iteration in the "strategy.matrix.rust"-array.
  89. - uses: actions-rs/toolchain@v1
  90. with:
  91. profile: default
  92. toolchain: ${{ matrix.rust }}
  93. override: true
  94. # helps to identify if the right cargo version is actually used
  95. - run: cargo version
  96. - name: Rustfmt
  97. run: cargo fmt -- --check
  98. - name: Clippy
  99. run: cargo clippy --all-targets
  100. - name: Rustdoc
  101. run: cargo doc --document-private-items