zkmopro / mopro

Making client-side proving on mobile simple.
https://zkmopro.org
Apache License 2.0
120 stars 33 forks source link

Speed up CI #9

Closed oskarth closed 3 months ago

oskarth commented 11 months ago

Problem

Right now it takes around 40-50m: https://github.com/oskarth/mopro/actions

Very roughly:

We want to get this down to <10m before we can use CI to block PRs from merging at this stage.

Acceptance criteria

CI runs faster, and ideally in <10m

oskarth commented 10 months ago

Circom binary cache sketch:

jobs:
  # ... other jobs ...

  setup:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest]
    steps:
      - uses: actions/checkout@v3

      - name: Cache circom
        uses: actions/cache@v2
        with:
          path: circom-install  # Directory where we will install circom
          key: circom-binary-${{ hashFiles('**/Cargo.lock') }}  # Assuming Cargo.lock file is in the root of your repository

      - name: Install circom
        if: steps.cache-circom.outputs.cache-hit != 'true'
        run: |
          git clone https://github.com/iden3/circom.git
          cd circom
          cargo build --release
          mkdir -p ${{ github.workspace }}/circom-install
          cargo install --path circom --root ${{ github.workspace }}/circom-install

      - name: Prepare CI
        run: ./scripts/prepare_ci.sh

  # ... rest of your jobs ...
oskarth commented 7 months ago

With workspaces https://github.com/oskarth/mopro/pull/80 we can probably reduce core/ffi build time so we don't build it twice. This is because we are sharing the target directory.

oskarth commented 7 months ago

With recent improvements https://github.com/oskarth/mopro/pull/76 and https://github.com/oskarth/mopro/pull/82 CI is much faster.

Currently it takes 17m total (test-ios) / 20m (test-android) total, which is much better! https://github.com/oskarth/mopro/actions/runs/8058892793/job/22012399580

Probably some more things can be improved when preparing/building to get total down to ~10m, but it OK now