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