arnaucube
arnaucube/ark-r1cs-stdPublic Self-hosted repository
ark-r1cs-std/.github/workflows/ci.yml
.github/workflows/ci.ymlRaw
  1name: CI
  2on:
  3  pull_request:
  4  push:
  5    branches:
  6      - master
  7env:
  8  RUST_BACKTRACE: 1
  9
 10jobs:
 11  style:
 12    name: Check Style
 13    runs-on: ubuntu-latest
 14    steps:
 15
 16    - name: Checkout
 17      uses: actions/checkout@v3
 18
 19    - name: Install Rust
 20      uses: dtolnay/rust-toolchain@stable
 21      with:
 22        components: rustfmt
 23
 24    - name: cargo fmt --check
 25      uses: actions-rs/cargo@v1
 26      with:
 27        command: fmt
 28        args: --all -- --check
 29
 30  test:
 31    name: Test
 32    runs-on: ubuntu-latest
 33    env:
 34      RUSTFLAGS: -Dwarnings --cfg ci
 35    strategy:
 36      matrix:
 37        rust:
 38          - stable
 39          - nightly
 40    steps:
 41      - name: Checkout
 42        uses: actions/checkout@v3
 43
 44      - name: Install Rust (${{ matrix.rust }})
 45        uses: dtolnay/rust-toolchain@master
 46        with:
 47          toolchain: ${{ matrix.rust }}
 48        id: toolchain
 49      - run: rustup override set ${{steps.toolchain.outputs.name}}
 50
 51      - uses: actions/cache@v2
 52        with:
 53          path: |
 54            ~/.cargo/registry
 55            ~/.cargo/git
 56            target            
 57          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
 58
 59      - name: Check examples
 60        uses: actions-rs/cargo@v1
 61        with:
 62            command: check
 63            args: --examples --all
 64
 65      - name: Check examples with all features on stable
 66        uses: actions-rs/cargo@v1
 67        with:
 68            command: check
 69            args: --examples --all-features --all
 70        if: matrix.rust == 'stable'
 71
 72      - name: Check benchmarks on nightly
 73        uses: actions-rs/cargo@v1
 74        with:
 75            command: check
 76            args: --all-features --examples --all --benches
 77        if: matrix.rust == 'nightly'
 78
 79      - name: Test
 80        uses: actions-rs/cargo@v1
 81        with:
 82            command: test
 83            args: "--all \
 84                   --all-features \
 85                   --exclude cp-benches "
 86
 87  docs:
 88    name: Check Documentation
 89    runs-on: ubuntu-latest
 90    steps:
 91
 92    - name: Checkout
 93      uses: actions/checkout@v3
 94    - name: Install Rust
 95      uses: dtolnay/rust-toolchain@stable
 96      with:
 97        components: rustfmt
 98
 99    - name: cargo doc --all --no-deps --document-private-items --all-features
100      uses: actions-rs/cargo@v1
101      with:
102        command: doc
103        args: --all --no-deps --document-private-items --all-features
104
105  check_no_std:
106    name: Check no_std
107    runs-on: ubuntu-latest
108    steps:
109      - name: Checkout
110        uses: actions/checkout@v3
111
112      - name: Install Rust
113        uses: dtolnay/rust-toolchain@stable
114        id: toolchain-thumbv6m
115        with:
116          target: thumbv6m-none-eabi
117      - run: rustup override set ${{steps.toolchain-thumbv6m.outputs.name}}
118
119      - name: Install Rust ARM64
120        uses: dtolnay/rust-toolchain@stable
121        id: toolchain-aarch64
122        with:
123          target: aarch64-unknown-none
124      - run: rustup override set ${{steps.toolchain-aarch64.outputs.name}}
125
126      - uses: actions/cache@v2
127        with:
128          path: |
129            ~/.cargo/registry
130            ~/.cargo/git
131            target            
132          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
133
134      - name: r1cs-std
135        run: |
136          cargo build --no-default-features --target aarch64-unknown-none
137          cargo check --examples --no-default-features --target aarch64-unknown-none          
138
139  test_against_curves:
140    name: Test against curves
141    runs-on: ubuntu-latest
142    env:
143      RUSTFLAGS: -Dwarnings
144    strategy:
145      matrix:
146        curve:
147          - bls12_377
148          - pallas
149          - vesta
150          - mnt4_298
151          - mnt6_298
152          - ed_on_bls12_381
153    steps:
154      - name: Checkout curves
155        uses: actions/checkout@v4
156        with:
157          repository: arkworks-rs/algebra
158
159      - name: Checkout r1cs-std
160        uses: actions/checkout@v4
161        with:
162          path: r1cs-std
163
164      - name: Install Rust
165        uses: dtolnay/rust-toolchain@stable
166
167      - name: Patch cargo.toml
168        run: |
169          cd curves
170          if  grep -q "\[patch.crates-io\]" Cargo.toml ; then
171              MATCH=$(awk '/\[patch.crates-io\]/{ print NR; exit }' Cargo.toml); 
172              sed -i "$MATCH,\$d" Cargo.toml
173          fi
174          {
175            echo "[patch.crates-io]"
176            echo "ark-std = { git = 'https://github.com/arkworks-rs/std' }"
177            echo "ark-ec = { path = '../ec' }"
178            echo "ark-ff = { path = '../ff' }"
179            echo "ark-poly = { path = '../poly' }"
180            echo "ark-relations = { git = 'https://github.com/arkworks-rs/snark' }"
181            echo "ark-serialize = { path = '../serialize' }"
182            echo "ark-algebra-bench-templates = { path = '../bench-templates' }"
183            echo "ark-algebra-test-templates = { path = '../test-templates' }"
184            echo "ark-r1cs-std = { path = '../r1cs-std' }"
185          } >> Cargo.toml
186          cd ${{ matrix.curve }} && cargo test --features 'r1cs'