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.

195 lines
5.0 KiB

  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@v1
  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. test:
  29. name: Test
  30. runs-on: ubuntu-latest
  31. env:
  32. RUSTFLAGS: -Dwarnings --cfg ci
  33. strategy:
  34. matrix:
  35. rust:
  36. - stable
  37. - nightly
  38. steps:
  39. - name: Checkout
  40. uses: actions/checkout@v2
  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 --all --benches
  70. if: matrix.rust == 'nightly'
  71. - name: Test
  72. uses: actions-rs/cargo@v1
  73. with:
  74. command: test
  75. args: "--all \
  76. --all-features \
  77. --exclude cp-benches "
  78. docs:
  79. name: Check Documentation
  80. runs-on: ubuntu-latest
  81. steps:
  82. - name: Checkout
  83. uses: actions/checkout@v1
  84. - name: Install Rust
  85. uses: actions-rs/toolchain@v1
  86. with:
  87. profile: minimal
  88. toolchain: stable
  89. override: true
  90. components: rustfmt
  91. - name: cargo doc --all --no-deps --document-private-items --all-features
  92. uses: actions-rs/cargo@v1
  93. with:
  94. command: doc
  95. args: --all --no-deps --document-private-items --all-features
  96. check_no_std:
  97. name: Check no_std
  98. runs-on: ubuntu-latest
  99. steps:
  100. - name: Checkout
  101. uses: actions/checkout@v2
  102. - name: Install Rust (${{ matrix.rust }})
  103. uses: actions-rs/toolchain@v1
  104. with:
  105. toolchain: stable
  106. target: thumbv6m-none-eabi
  107. override: true
  108. - name: Install Rust ARM64 (${{ matrix.rust }})
  109. uses: actions-rs/toolchain@v1
  110. with:
  111. toolchain: stable
  112. target: aarch64-unknown-none
  113. override: true
  114. - uses: actions/cache@v2
  115. with:
  116. path: |
  117. ~/.cargo/registry
  118. ~/.cargo/git
  119. target
  120. key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
  121. - name: r1cs-std
  122. run: |
  123. cargo build --no-default-features --target aarch64-unknown-none
  124. cargo check --examples --no-default-features --target aarch64-unknown-none
  125. test_against_curves:
  126. name: Test against curves
  127. runs-on: ubuntu-latest
  128. env:
  129. RUSTFLAGS: -Dwarnings
  130. strategy:
  131. matrix:
  132. curve:
  133. - bls12_377
  134. - pallas
  135. - vesta
  136. - mnt4_298
  137. - mnt6_298
  138. - mnt6_753
  139. - ed_on_bls12_381
  140. steps:
  141. - name: Checkout curves
  142. uses: actions/checkout@v2
  143. with:
  144. repository: arkworks-rs/curves
  145. - name: Checkout r1cs-std
  146. uses: actions/checkout@v2
  147. with:
  148. path: r1cs-std
  149. - name: Install Rust
  150. uses: actions-rs/toolchain@v1
  151. with:
  152. profile: minimal
  153. toolchain: stable
  154. override: true
  155. - name: Patch cargo.toml
  156. run: |
  157. if grep -q "\[patch.crates-io\]" Cargo.toml ; then
  158. MATCH=$(awk '/\[patch.crates-io\]/{ print NR; exit }' Cargo.toml);
  159. sed -i "$MATCH,\$d" Cargo.toml
  160. fi
  161. {
  162. echo "[patch.crates-io]"
  163. echo "ark-std = { git = 'https://github.com/arkworks-rs/std' }"
  164. echo "ark-ec = { git = 'https://github.com/arkworks-rs/algebra' }"
  165. echo "ark-ff = { git = 'https://github.com/arkworks-rs/algebra' }"
  166. echo "ark-poly = { git = 'https://github.com/arkworks-rs/algebra' }"
  167. echo "ark-serialize = { git = 'https://github.com/arkworks-rs/algebra' }"
  168. echo "ark-algebra-test-templates = { git = 'https://github.com/arkworks-rs/algebra' }"
  169. echo "ark-r1cs-std = { path = 'r1cs-std' }"
  170. } >> Cargo.toml
  171. - name: Test on ${{ matrix.curve }}
  172. run: "cd ${{ matrix.curve }} && cargo test --features 'r1cs'"