rust.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. # CI for the whole Cargo workspace. Although having two relatively independent
  2. # crates in this workspace (as they do not get released together, as for example
  3. # tokio with its sub crates), a PR for a certain CI may report errors in the
  4. # other workspace members. I think this is unfortunate. I've experimented with
  5. # CI runs per workspace member but the complexity in the end was not worth it.
  6. # Instead, it is the right thing that the CI always covers the whole repository
  7. # and that it is as stable as possible.
  8. name: "Cargo workspace"
  9. # Run on every push (tag, branch) and pull_request
  10. on: [pull_request, push, workflow_dispatch]
  11. env:
  12. CARGO_TERM_COLOR: always
  13. jobs:
  14. ### Regular Build #########################
  15. build_msrv:
  16. name: build (msrv)
  17. uses: ./.github/workflows/_build-rust.yml
  18. with:
  19. rust-version: 1.68.0 # MSRV
  20. do-style-check: false
  21. features: builder
  22. build_stable:
  23. name: build (stable)
  24. uses: ./.github/workflows/_build-rust.yml
  25. with:
  26. rust-version: stable
  27. do-style-check: false
  28. features: builder
  29. build_nightly:
  30. name: build (nightly)
  31. uses: ./.github/workflows/_build-rust.yml
  32. with:
  33. rust-version: nightly
  34. do-style-check: false
  35. features: builder,unstable
  36. ### no-std Build #########################
  37. build_nostd_msrv:
  38. name: build no_std (msrv)
  39. needs: build_msrv
  40. uses: ./.github/workflows/_build-rust.yml
  41. with:
  42. rust-version: 1.68.0 # MSRV
  43. do-style-check: false
  44. rust-target: thumbv7em-none-eabihf
  45. features: builder
  46. build_nostd_stable:
  47. name: build no_std (stable)
  48. needs: build_stable
  49. uses: ./.github/workflows/_build-rust.yml
  50. with:
  51. rust-version: stable
  52. do-style-check: false
  53. rust-target: thumbv7em-none-eabihf
  54. features: builder
  55. # Also tests the build one time without the "builder" feature.
  56. build_nostd_stable_no_builder:
  57. name: build no_std (stable) [w/o builder]
  58. needs: build_stable
  59. uses: ./.github/workflows/_build-rust.yml
  60. with:
  61. rust-version: stable
  62. do-style-check: false
  63. rust-target: thumbv7em-none-eabihf
  64. # We perform one single run also in Windows. This should be sufficient to
  65. # check that devs can also use this on Windows.
  66. build_nostd_stable_windows:
  67. name: build no_std (stable) [Windows]
  68. needs: build_stable
  69. uses: ./.github/workflows/_build-rust.yml
  70. with:
  71. runs-on: windows-latest
  72. # Quirk for the Windows powershell and its handling of empty arguments.
  73. # features: >
  74. # '""'
  75. rust-version: stable
  76. do-style-check: false
  77. rust-target: thumbv7em-none-eabihf
  78. features: builder
  79. build_nostd_nightly:
  80. name: build no_std (nightly)
  81. needs: build_nightly
  82. uses: ./.github/workflows/_build-rust.yml
  83. with:
  84. rust-version: nightly
  85. do-style-check: false
  86. rust-target: thumbv7em-none-eabihf
  87. features: builder,unstable
  88. ### Style Checks + Doc #####################
  89. style_msrv:
  90. name: style (msrv)
  91. needs: build_msrv
  92. uses: ./.github/workflows/_build-rust.yml
  93. with:
  94. rust-version: 1.68.0 # MSRV
  95. do-style-check: true
  96. do-test: false
  97. features: builder
  98. style_stable:
  99. name: style (stable)
  100. needs: build_stable
  101. uses: ./.github/workflows/_build-rust.yml
  102. with:
  103. rust-version: stable
  104. do-style-check: true
  105. do-test: false
  106. features: builder
  107. style_nightly:
  108. name: style (nightly)
  109. needs: build_nightly
  110. uses: ./.github/workflows/_build-rust.yml
  111. with:
  112. rust-version: nightly
  113. do-style-check: true
  114. do-test: false
  115. features: builder,unstable
  116. integrationtest:
  117. name: integrationtest
  118. needs:
  119. - build_nightly
  120. - build_nostd_nightly
  121. runs-on: ubuntu-latest
  122. steps:
  123. - name: Check out
  124. uses: actions/checkout@v3
  125. - uses: cachix/install-nix-action@v20
  126. with:
  127. # This channel is only required to invoke "nix-shell".
  128. # Everything inside that nix-shell will use a pinned version of
  129. # nixpkgs.
  130. nix_path: nixpkgs=channel:nixos-23.05
  131. - name: Set up cargo cache
  132. uses: actions/cache@v3
  133. continue-on-error: false
  134. with:
  135. path: |
  136. ~/.cargo/bin/
  137. ~/.cargo/registry/index/
  138. ~/.cargo/registry/cache/
  139. ~/.cargo/git/db/
  140. integration-test/bins/target/
  141. # Hash over Cargo.toml and Cargo.lock, as this might be copied to
  142. # projects that do not have a Cargo.lock in their repository tree!
  143. key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('integration-test/**/Cargo.toml', 'integration-test/**/Cargo.lock', 'integration-test/bins/rust-toolchain.toml') }}
  144. # Have all the "copying into Nix store" messages in a dedicated step for
  145. # better log visibility.
  146. - run: cd integration-test && nix-shell --run "echo OK" && cd ..
  147. # Now, run the actual test.
  148. - run: cd integration-test && nix-shell --run ./run.sh && cd ..
  149. miri:
  150. name: tests with miri (nightly)
  151. needs: build_nightly
  152. uses: ./.github/workflows/_build-rust.yml
  153. with:
  154. rust-version: nightly
  155. do-style-check: false
  156. do-test: false
  157. do-miri: true
  158. features: builder,unstable