arnaucube
arnaucube/sonobePublic Self-hosted repository
sonobe/.github/workflows/ci.yml
.github/workflows/ci.ymlRaw
  1name: CI Check
  2on:
  3  merge_group:
  4  pull_request:
  5  push:
  6    branches:
  7      - main
  8env:
  9  CARGO_TERM_COLOR: always
 10  # Disable incremental compilation.
 11  #
 12  # Incremental compilation is useful as part of an edit-build-test-edit cycle,
 13  # as it lets the compiler avoid recompiling code that hasn't changed. However,
 14  # on CI, we're not making small edits; we're almost always building the entire
 15  # project from scratch. Thus, incremental compilation on CI actually
 16  # introduces *additional* overhead to support making future builds
 17  # faster...but no future builds will ever occur in any given CI environment.
 18  #
 19  # See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
 20  # for details.
 21  CARGO_INCREMENTAL: 0
 22  # Allow more retries for network requests in cargo (downloading crates) and
 23  # rustup (installing toolchains). This should help to reduce flaky CI failures
 24  # from transient network timeouts or other issues.
 25  CARGO_NET_RETRY: 10
 26  RUSTUP_MAX_RETRIES: 10
 27  # Don't emit giant backtraces in the CI logs.
 28  RUST_BACKTRACE: short
 29
 30# Jobs launched for a PR event cancel the ongoing one for the same workflow + PR,
 31# Only retries (of the same run) for a Push event cancel the prior one.
 32concurrency:
 33  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
 34  cancel-in-progress: true
 35  
 36
 37jobs:
 38  test:
 39    if: github.event.pull_request.draft == false
 40    name: Test
 41    runs-on: ubuntu-latest
 42    strategy:
 43      matrix:
 44        include:
 45          - feature: default
 46    steps:
 47      - uses: actions/checkout@v2
 48      - uses: actions-rs/toolchain@v1
 49      # use the more efficient nextest
 50      - uses: taiki-e/install-action@nextest
 51      - uses: Swatinem/rust-cache@v2
 52      - name: Download Circom
 53        run: |
 54          mkdir -p $HOME/bin
 55          curl -sSfL https://github.com/iden3/circom/releases/download/v2.1.6/circom-linux-amd64 -o $HOME/bin/circom
 56          chmod +x $HOME/bin/circom
 57          echo "$HOME/bin" >> $GITHUB_PATH          
 58      - name: Download solc
 59        run: |
 60          curl -sSfL https://github.com/ethereum/solidity/releases/download/v0.8.4/solc-static-linux -o /usr/local/bin/solc
 61          chmod +x /usr/local/bin/solc          
 62      - name: Execute compile.sh to generate .r1cs and .wasm from .circom
 63        run: ./folding-schemes/src/frontend/circom/test_folder/compile.sh
 64      - name: Build
 65        # This build will be reused by nextest,
 66        # and also checks (--all-targets) that benches don't bit-rot
 67        run: cargo build --release --all-targets --no-default-features --features "light-test,${{ matrix.feature }}"
 68      - name: Test
 69        run: |
 70          cargo nextest run --profile ci --release --workspace --no-default-features --features "light-test,${{ matrix.feature }}"          
 71      - name: Doctests # nextest does not support doc tests
 72        run: |
 73          cargo test --doc          
 74
 75  examples:
 76    if: github.event.pull_request.draft == false
 77    name: Run examples & examples tests
 78    runs-on: ubuntu-latest
 79    steps:
 80      - uses: actions/checkout@v2
 81      - uses: actions-rs/toolchain@v1
 82      - name: Download Circom
 83        run: |
 84          mkdir -p $HOME/bin
 85          curl -sSfL https://github.com/iden3/circom/releases/download/v2.1.6/circom-linux-amd64 -o $HOME/bin/circom
 86          chmod +x $HOME/bin/circom
 87          echo "$HOME/bin" >> $GITHUB_PATH          
 88      - name: Download solc
 89        run: |
 90          curl -sSfL https://github.com/ethereum/solidity/releases/download/v0.8.4/solc-static-linux -o /usr/local/bin/solc
 91          chmod +x /usr/local/bin/solc          
 92      - name: Execute compile.sh to generate .r1cs and .wasm from .circom
 93        run: ./folding-schemes/src/frontend/circom/test_folder/compile.sh 
 94      - name: Run examples tests
 95        run: cargo test --examples
 96      - name: Run examples
 97        run: cargo run --release --example 2>&1 | grep -E '^ ' | xargs -n1 cargo run --release --example
 98
 99  fmt:
100    if: github.event.pull_request.draft == false
101    name: Rustfmt
102    timeout-minutes: 30
103    runs-on: ubuntu-latest
104    steps:
105      - uses: actions/checkout@v2
106      - uses: actions-rs/toolchain@v1
107      - uses: Swatinem/rust-cache@v2
108      - run: rustup component add rustfmt
109      - uses: actions-rs/cargo@v1
110        with:
111          command: fmt
112          args: --all -- --check
113
114  clippy:
115    if: github.event.pull_request.draft == false
116    name: Clippy lint checks
117    runs-on: ubuntu-latest
118    steps:
119      - uses: actions/checkout@v2
120      - uses: actions-rs/toolchain@v1
121        with:
122          components: clippy
123      - uses: Swatinem/rust-cache@v2
124      - name: Run clippy
125        uses: actions-rs/cargo@v1
126        with:
127          command: clippy
128          args: --all-targets --all-features -- -D warnings
129
130  typos:
131    if: github.event.pull_request.draft == false
132    name: Spell Check with Typos
133    runs-on: ubuntu-latest
134    steps:
135    - uses: actions/checkout@v4
136    - name: Use typos with config file
137      uses: crate-ci/typos@master
138      with: 
139        config: .github/workflows/typos.toml