Skip to content

Commit

Permalink
fix(ci): Conditional to build contracts in new CI (#3106)
Browse files Browse the repository at this point in the history
## What ❔

Do not build contracts if not needed in new CI

## Why ❔

Speed up CI

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev
lint`.
  • Loading branch information
artmakh authored Oct 16, 2024
1 parent 525ba9f commit 8790240
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 34 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
- '!prover/extract-setup-data-keys.sh'
- 'docker/prover*/**'
- '.github/workflows/build-prover-template.yml'
- '.github/workflows/new-build-prover-template.yml'
- '.github/workflows/build-witness-generator-template.yml'
- '.github/workflows/new-build-witness-generator-template.yml'
- '.github/workflows/ci-prover-reusable.yml'
- 'docker-compose-runner-nightly.yml'
- '!**/*.md'
Expand All @@ -53,7 +56,9 @@ jobs:
- 'docker/external-node/**'
- 'docker/server/**'
- '.github/workflows/build-core-template.yml'
- '.github/workflows/new-build-core-template.yml'
- '.github/workflows/build-contract-verifier-template.yml'
- '.github/workflows/new-build-contract-verifier-template.yml'
- '.github/workflows/ci-core-reusable.yml'
- '.github/workflows/ci-core-lint-reusable.yml'
- 'Cargo.toml'
Expand Down
25 changes: 8 additions & 17 deletions .github/workflows/new-build-contract-verifier-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,30 @@ jobs:
tar -C ./contracts -zxf system-contracts.tar.gz
- name: Install Apt dependencies
if: env.BUILD_CONTRACTS == 'true'
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config
- name: Install Node
if: env.BUILD_CONTRACTS == 'true'
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 20
cache: 'npm'

- name: Install Yarn
if: env.BUILD_CONTRACTS == 'true'
run: npm install -g yarn

- name: Setup rust
if: env.BUILD_CONTRACTS == 'true'
uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
with:
toolchain: nightly-2024-08-01

- name: Install cargo-nextest from crates.io
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 # v3.1.1
with:
crate: cargo-nextest

- name: Install sqlx-cli from crates.io
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 # v3.1.1
with:
crate: sqlx-cli
tag: 0.8.1

- name: Install foundry-zksync
if: env.BUILD_CONTRACTS == 'true'
run: |
mkdir ./foundry-zksync
curl -LO https://github.com/matter-labs/foundry-zksync/releases/download/nightly-15bec2f861b3b4c71e58f85e2b2c9dd722585aa8/foundry_nightly_linux_amd64.tar.gz
Expand All @@ -112,6 +106,7 @@ jobs:
echo "$PWD/foundry-zksync" >> $GITHUB_PATH
- name: Pre-download compilers
if: env.BUILD_CONTRACTS == 'true'
shell: bash
run: |
# Download needed versions of vyper compiler
Expand All @@ -129,18 +124,14 @@ jobs:
chmod +x "./hardhat-nodejs/compilers-v2/$compiler/${compiler}-v${version}"
done
- name: init
shell: bash
run: |
mkdir -p ./volumes/postgres
docker compose up -d postgres
- name: Install zkstack
if: env.BUILD_CONTRACTS == 'true'
run: |
./zkstack_cli/zkstackup/install --path ./zkstack_cli/zkstackup/zkstackup
zkstackup --local || true
- name: build contracts
if: env.BUILD_CONTRACTS == 'true'
shell: bash
run: |
cp etc/tokens/{test,localhost}.json
Expand Down
25 changes: 8 additions & 17 deletions .github/workflows/new-build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,30 @@ jobs:
tar -C ./contracts -zxf system-contracts.tar.gz
- name: Install Apt dependencies
if: env.BUILD_CONTRACTS == 'true'
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config
- name: Install Node
if: env.BUILD_CONTRACTS == 'true'
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 20
cache: 'npm'

- name: Install Yarn
if: env.BUILD_CONTRACTS == 'true'
run: npm install -g yarn

- name: Setup rust
if: env.BUILD_CONTRACTS == 'true'
uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
with:
toolchain: nightly-2024-08-01

- name: Install cargo-nextest from crates.io
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 # v3.1.1
with:
crate: cargo-nextest

- name: Install sqlx-cli from crates.io
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 # v3.1.1
with:
crate: sqlx-cli
tag: 0.8.1

- name: Install foundry-zksync
if: env.BUILD_CONTRACTS == 'true'
run: |
mkdir ./foundry-zksync
curl -LO https://github.com/matter-labs/foundry-zksync/releases/download/nightly-15bec2f861b3b4c71e58f85e2b2c9dd722585aa8/foundry_nightly_linux_amd64.tar.gz
Expand All @@ -117,6 +111,7 @@ jobs:
echo "$PWD/foundry-zksync" >> $GITHUB_PATH
- name: Pre-download compilers
if: env.BUILD_CONTRACTS == 'true'
shell: bash
run: |
# Download needed versions of vyper compiler
Expand All @@ -134,18 +129,14 @@ jobs:
chmod +x "./hardhat-nodejs/compilers-v2/$compiler/${compiler}-v${version}"
done
- name: init
shell: bash
run: |
mkdir -p ./volumes/postgres
docker compose up -d postgres
- name: Install zkstack
if: env.BUILD_CONTRACTS == 'true'
run: |
./zkstack_cli/zkstackup/install --path ./zkstack_cli/zkstackup/zkstackup
zkstackup --local || true
- name: build contracts
if: env.BUILD_CONTRACTS == 'true'
shell: bash
run: |
cp etc/tokens/{test,localhost}.json
Expand Down

0 comments on commit 8790240

Please sign in to comment.