main.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. name: Rust CI
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths:
  7. - packages/**
  8. - examples/**
  9. - docs/guide/**
  10. - src/**
  11. - .github/**
  12. - lib.rs
  13. - Cargo.toml
  14. - Makefile.toml
  15. - playwright-tests/**
  16. pull_request:
  17. types: [opened, synchronize, reopened, ready_for_review]
  18. branches:
  19. - master
  20. paths:
  21. - packages/**
  22. - examples/**
  23. - src/**
  24. - .github/**
  25. - lib.rs
  26. - Cargo.toml
  27. concurrency:
  28. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  29. cancel-in-progress: true
  30. jobs:
  31. check:
  32. if: github.event.pull_request.draft == false
  33. name: Check
  34. runs-on: ubuntu-latest
  35. steps:
  36. - uses: dtolnay/rust-toolchain@stable
  37. - uses: Swatinem/rust-cache@v2
  38. - run: sudo apt-get update
  39. - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
  40. - uses: actions/checkout@v3
  41. - run: cargo check --all --examples --tests
  42. test:
  43. if: github.event.pull_request.draft == false
  44. name: Test Suite
  45. runs-on: ubuntu-latest
  46. steps:
  47. - uses: dtolnay/rust-toolchain@stable
  48. - uses: Swatinem/rust-cache@v2
  49. - run: sudo apt-get update
  50. - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
  51. - uses: davidB/rust-cargo-make@v1
  52. - uses: browser-actions/setup-firefox@latest
  53. - uses: jetli/wasm-pack-action@v0.4.0
  54. - uses: actions/checkout@v3
  55. - run: cargo make tests
  56. fmt:
  57. if: github.event.pull_request.draft == false
  58. name: Rustfmt
  59. runs-on: ubuntu-latest
  60. steps:
  61. - uses: dtolnay/rust-toolchain@stable
  62. - uses: Swatinem/rust-cache@v2
  63. - run: rustup component add rustfmt
  64. - uses: actions/checkout@v3
  65. - run: cargo fmt --all -- --check
  66. clippy:
  67. if: github.event.pull_request.draft == false
  68. name: Clippy
  69. runs-on: ubuntu-latest
  70. steps:
  71. - uses: dtolnay/rust-toolchain@stable
  72. - uses: Swatinem/rust-cache@v2
  73. - run: sudo apt-get update
  74. - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
  75. - run: rustup component add clippy
  76. - uses: actions/checkout@v3
  77. - run: cargo clippy --workspace --examples --tests -- -D warnings
  78. matrix_test:
  79. runs-on: ${{ matrix.platform.os }}
  80. strategy:
  81. matrix:
  82. platform:
  83. - {
  84. target: x86_64-pc-windows-msvc,
  85. os: windows-latest,
  86. toolchain: '1.65.0',
  87. cross: false,
  88. command: 'test',
  89. args: '--all --tests'
  90. }
  91. - {
  92. target: x86_64-unknown-linux-gnu,
  93. os: ubuntu-latest,
  94. toolchain: '1.65.0',
  95. cross: false,
  96. command: 'test',
  97. args: '--all --tests'
  98. }
  99. - {
  100. target: x86_64-apple-darwin,
  101. os: macos-latest,
  102. toolchain: '1.65.0',
  103. cross: false,
  104. command: 'test',
  105. args: '--all --tests'
  106. }
  107. - {
  108. target: aarch64-apple-ios,
  109. os: macos-latest,
  110. toolchain: '1.65.0',
  111. cross: false,
  112. command: 'build',
  113. args: '--package dioxus-mobile'
  114. }
  115. - {
  116. target: aarch64-linux-android,
  117. os: ubuntu-latest,
  118. toolchain: '1.65.0',
  119. cross: true,
  120. command: 'build',
  121. args: '--package dioxus-mobile'
  122. }
  123. steps:
  124. - uses: actions/checkout@v2
  125. - name: install stable
  126. uses: actions-rs/toolchain@v1
  127. with:
  128. toolchain: ${{ matrix.platform.toolchain }}
  129. target: ${{ matrix.platform.target }}
  130. override: true
  131. default: true
  132. - name: install Linux dependencies
  133. if: contains(matrix.platform.target, 'unknown-linux')
  134. run: |
  135. sudo apt-get update
  136. sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
  137. - uses: Swatinem/rust-cache@v2
  138. with:
  139. workspaces: core -> ../target
  140. save-if: ${{ matrix.features.key == 'all' }}
  141. - name: test
  142. uses: actions-rs/cargo@v1
  143. with:
  144. use-cross: ${{ matrix.platform.cross }}
  145. command: ${{ matrix.platform.command }}
  146. args: --target ${{ matrix.platform.target }} ${{ matrix.platform.args }}
  147. # Coverage is disabled until we can fix it
  148. # coverage:
  149. # name: Coverage
  150. # runs-on: ubuntu-latest
  151. # container:
  152. # image: xd009642/tarpaulin:develop-nightly
  153. # options: --security-opt seccomp=unconfined
  154. # steps:
  155. # - name: Checkout repository
  156. # uses: actions/checkout@v3
  157. # - name: Generate code coverage
  158. # run: |
  159. # apt-get update &&\
  160. # apt-get install build-essential &&\
  161. # apt install libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev -y &&\
  162. # cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
  163. # - name: Upload to codecov.io
  164. # uses: codecov/codecov-action@v2
  165. # with:
  166. # fail_ci_if_error: false