build.yaml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. on:
  2. push:
  3. branches: [ staging, trying, master ]
  4. pull_request:
  5. merge_group:
  6. name: Build check
  7. jobs:
  8. # We check that the crate builds and links for all the toolchains and targets.
  9. build-riscv:
  10. strategy:
  11. matrix:
  12. # All generated code should be running on stable now, MRSV is 1.59.0
  13. toolchain: [ stable, nightly, 1.59.0 ]
  14. target:
  15. - riscv32i-unknown-none-elf
  16. - riscv32imc-unknown-none-elf
  17. - riscv32imac-unknown-none-elf
  18. - riscv64imac-unknown-none-elf
  19. - riscv64gc-unknown-none-elf
  20. cargo_flags: [ "--no-default-features", "--all-features" ]
  21. include:
  22. # Nightly is only for reference and allowed to fail
  23. - toolchain: nightly
  24. experimental: true
  25. runs-on: ubuntu-latest
  26. continue-on-error: ${{ matrix.experimental || false }}
  27. steps:
  28. - uses: actions/checkout@v3
  29. - uses: dtolnay/rust-toolchain@master
  30. with:
  31. toolchain: ${{ matrix.toolchain }}
  32. targets: ${{ matrix.target }}
  33. - name: Build library
  34. run: cargo build --target ${{ matrix.target }} ${{ matrix.cargo_flags }}
  35. # On MacOS, Ubuntu, and Windows, we at least make sure that the crate builds and links.
  36. build-others:
  37. strategy:
  38. matrix:
  39. os:
  40. - macos-latest
  41. - ubuntu-latest
  42. - windows-latest
  43. cargo_flags: [ "--no-default-features", "--all-features" ]
  44. runs-on: ${{ matrix.os }}
  45. steps:
  46. - uses: actions/checkout@v3
  47. - uses: dtolnay/rust-toolchain@stable
  48. - name: Build crate for host OS
  49. run: cargo build ${{ matrix.cargo_flags }}
  50. # Job to check that all the builds succeeded
  51. build-check:
  52. needs:
  53. - build-riscv
  54. - build-others
  55. runs-on: ubuntu-latest
  56. if: always()
  57. steps:
  58. - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'