You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
4.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. name: CI
  2. on:
  3. pull_request:
  4. push:
  5. branches:
  6. - master
  7. env:
  8. RUST_BACKTRACE: 1
  9. jobs:
  10. style:
  11. name: Check Style
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Checkout
  15. uses: actions/checkout@v3
  16. - name: Install Rust
  17. uses: actions-rs/toolchain@v1
  18. with:
  19. profile: minimal
  20. toolchain: stable
  21. override: true
  22. components: rustfmt
  23. - name: cargo fmt --check
  24. uses: actions-rs/cargo@v1
  25. with:
  26. command: fmt
  27. args: --all -- --check
  28. check:
  29. name: Check
  30. runs-on: ubuntu-latest
  31. env:
  32. RUSTFLAGS: -Dwarnings
  33. strategy:
  34. matrix:
  35. rust:
  36. - stable
  37. - nightly
  38. steps:
  39. - name: Checkout
  40. uses: actions/checkout@v3
  41. - name: Install Rust (${{ matrix.rust }})
  42. uses: actions-rs/toolchain@v1
  43. with:
  44. profile: minimal
  45. toolchain: ${{ matrix.rust }}
  46. override: true
  47. - uses: actions/cache@v2
  48. with:
  49. path: |
  50. ~/.cargo/registry
  51. ~/.cargo/git
  52. target
  53. key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
  54. - name: Check examples
  55. uses: actions-rs/cargo@v1
  56. with:
  57. command: check
  58. args: --examples --all
  59. - name: Check examples with all features on stable
  60. uses: actions-rs/cargo@v1
  61. with:
  62. command: check
  63. args: --examples --all-features --all
  64. if: matrix.rust == 'stable'
  65. - name: Check benchmarks on nightly
  66. uses: actions-rs/cargo@v1
  67. with:
  68. command: check
  69. args: --all-features --examples --workspace --benches
  70. if: matrix.rust == 'nightly'
  71. directories: # Job that list subdirectories
  72. name: List directories for parallelizing tests
  73. runs-on: ubuntu-latest
  74. outputs:
  75. dir: ${{ steps.set-dirs.outputs.dir }} # generate output name dir by using inner step output
  76. steps:
  77. - uses: actions/checkout@v3
  78. - id: set-dirs # Give it an id to handle to get step outputs in the outputs key above
  79. run: echo "::set-output name=dir::$(ls -d */ | jq -R -s -c 'split("\n")[:-1]')"
  80. # Define step output named dir base on ls command transformed to JSON thanks to jq
  81. test:
  82. name: Test
  83. runs-on: ubuntu-latest
  84. needs: [directories] # Depends on previous job
  85. strategy:
  86. matrix:
  87. dir: ${{fromJson(needs.directories.outputs.dir)}} # List matrix strategy from directories dynamically
  88. # rust:
  89. # - stable
  90. # - nightly
  91. exclude:
  92. - dir: scripts/
  93. - dir: curve-constraint-tests/
  94. - dir: mnt4_753/
  95. - dir: mnt6_753/
  96. steps:
  97. - name: Checkout
  98. uses: actions/checkout@v3
  99. - name: Run tests
  100. run: |
  101. cd ${{matrix.dir}}
  102. cargo test --all-features
  103. test-mnt4-753:
  104. name: Test (mnt4_753/)
  105. runs-on: macos-latest
  106. needs: [directories] # Waits for the directory listing job
  107. steps:
  108. - name: Checkout
  109. uses: actions/checkout@v3
  110. - name: Run tests
  111. run: |
  112. cd mnt4_753/
  113. cargo test --all-features
  114. test-mnt6-753:
  115. name: Test (mnt6_753/)
  116. runs-on: macos-latest
  117. needs: [directories] # Waits for the directory listing job
  118. steps:
  119. - name: Checkout
  120. uses: actions/checkout@v3
  121. - name: Run tests
  122. run: |
  123. cd mnt6_753/
  124. cargo test --all-features
  125. docs:
  126. name: Check Documentation
  127. runs-on: ubuntu-latest
  128. steps:
  129. - name: Checkout
  130. uses: actions/checkout@v3
  131. - name: Install Rust
  132. uses: actions-rs/toolchain@v1
  133. with:
  134. profile: minimal
  135. toolchain: stable
  136. override: true
  137. components: rustfmt
  138. - name: cargo doc --all --no-deps --document-private-items --all-features
  139. uses: actions-rs/cargo@v1
  140. with:
  141. command: doc
  142. args: --all --no-deps --document-private-items --all-features
  143. check_no_std:
  144. name: Check no_std
  145. runs-on: ubuntu-latest
  146. steps:
  147. - name: Checkout
  148. uses: actions/checkout@v3
  149. - name: Install Rust (${{ matrix.rust }})
  150. uses: actions-rs/toolchain@v1
  151. with:
  152. toolchain: stable
  153. target: aarch64-unknown-none
  154. override: true
  155. - uses: actions/cache@v2
  156. with:
  157. path: |
  158. ~/.cargo/registry
  159. ~/.cargo/git
  160. target
  161. key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
  162. - name: check
  163. uses: actions-rs/cargo@v1
  164. with:
  165. command: check
  166. args: --examples --workspace --exclude ark-curve-constraint-tests --target aarch64-unknown-none
  167. - name: build
  168. uses: actions-rs/cargo@v1
  169. with:
  170. command: build
  171. args: --workspace --exclude ark-curve-constraint-tests --target aarch64-unknown-none