Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zk_toolbox): Update lint CI with zk_toolbox #2694

Merged
merged 59 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3f33ef9
Add linter ci
matias-gonz Aug 20, 2024
1c35d1a
Update lint ci
matias-gonz Aug 20, 2024
3b50db8
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 20, 2024
0a3c31a
Add build step to code lint
matias-gonz Aug 20, 2024
84fe2f4
Merge branch 'matias-migrate-lint-ci' of github.com:matter-labs/zksyn…
matias-gonz Aug 20, 2024
25f4756
Add need option
matias-gonz Aug 20, 2024
fea982f
Add ZKSYNC_HOME
matias-gonz Aug 20, 2024
3bd0d9a
Update lint ci
matias-gonz Aug 22, 2024
834f951
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 22, 2024
4b208c1
Add external build workflow
matias-gonz Aug 26, 2024
2317867
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 26, 2024
fa3d0f6
Update build workflow
matias-gonz Aug 26, 2024
4e927fb
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 26, 2024
deebec3
Update ci if
matias-gonz Aug 26, 2024
5620311
Merge branch 'matias-migrate-lint-ci' of github.com:matter-labs/zksyn…
matias-gonz Aug 26, 2024
180eae7
Add wait for workflow
matias-gonz Aug 26, 2024
75698b3
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 26, 2024
8548f9f
trigger ci
matias-gonz Aug 26, 2024
7d54fca
Merge branch 'matias-migrate-lint-ci' of github.com:matter-labs/zksyn…
matias-gonz Aug 26, 2024
64bbfbf
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 26, 2024
baa8426
restore changes
matias-gonz Aug 26, 2024
56c7db4
update lint
matias-gonz Aug 26, 2024
3a23838
Add dep installation
matias-gonz Aug 26, 2024
6575f84
add ci_run
matias-gonz Aug 26, 2024
ab41306
Add db check
matias-gonz Aug 26, 2024
f07bb46
Add ecosystem init
matias-gonz Aug 26, 2024
02f681a
Update safe dir
matias-gonz Aug 26, 2024
3368ed7
move git config
matias-gonz Aug 26, 2024
faa2b91
Disable db check
matias-gonz Aug 26, 2024
a537644
Make contract lint an option
matias-gonz Aug 26, 2024
4ba7452
Remove unstable features flag
matias-gonz Aug 26, 2024
e821056
lint
matias-gonz Aug 26, 2024
9ca1599
lint
matias-gonz Aug 26, 2024
3f208fa
Add database check
matias-gonz Aug 26, 2024
c4dd88c
Add permissions
matias-gonz Aug 26, 2024
d98babc
Pre create volume dir
matias-gonz Aug 26, 2024
10d6db6
Add postgres volume
matias-gonz Aug 26, 2024
495e70f
Add rethdata dir
matias-gonz Aug 26, 2024
812b266
update ci_localnet_up
matias-gonz Aug 26, 2024
b12939c
fix
matias-gonz Aug 26, 2024
50b3b7b
use zk service for db
matias-gonz Aug 26, 2024
4099f2e
Fix db check command
matias-gonz Aug 26, 2024
400e107
Add ecosystem init
matias-gonz Aug 26, 2024
c96aa6c
Setup db with zk
matias-gonz Aug 27, 2024
6977249
Move db check to other ci
matias-gonz Aug 27, 2024
eb6360f
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 27, 2024
866b66d
Remove reth chaindata creation from ci
matias-gonz Aug 27, 2024
1bf1a35
Merge branch 'matias-migrate-lint-ci' of github.com:matter-labs/zksyn…
matias-gonz Aug 27, 2024
0c36ba9
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 27, 2024
631a805
Remove not needed `bach -c`
matias-gonz Aug 27, 2024
9af6149
Merge branch 'matias-migrate-lint-ci' of github.com:matter-labs/zksyn…
matias-gonz Aug 27, 2024
4e33283
Use zkt
matias-gonz Aug 27, 2024
a669e16
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 27, 2024
d2a991c
Merge branch 'main' into matias-migrate-lint-ci
matias-gonz Aug 27, 2024
e1a9995
Change extension to target
matias-gonz Aug 27, 2024
1ab5b37
Remove contracts option
matias-gonz Aug 27, 2024
63a50ac
Update readme
matias-gonz Aug 27, 2024
f732037
Merge branch 'main' of github.com:matter-labs/zksync-era into matias-…
matias-gonz Aug 27, 2024
a057740
Update ci
matias-gonz Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions .github/workflows/ci-core-lint-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,22 @@ jobs:

- name: Start services
run: |
mkdir -p ./volumes/postgres
run_retried docker compose pull zk postgres
docker compose up -d zk postgres
ci_localnet_up
ci_run sccache --start-server

- name: Setup db
- name: Build
run: |
ci_run zk
ci_run run_retried rustup show
ci_run zk db migrate
ci_run bash -c "cd zk_toolbox && cargo build --release"
cp ./zk_toolbox/target/release/zk_supervisor ./bin
cp ./zk_toolbox/target/release/zk_inception ./bin
Deniallugo marked this conversation as resolved.
Show resolved Hide resolved
ci_run bash -c "yarn install"
ci_run bash -c "git config --global --add safe.directory /usr/src/zksync"
Deniallugo marked this conversation as resolved.
Show resolved Hide resolved

- name: Lints
run: |
ci_run zk fmt --check
ci_run zk lint rust --check
ci_run zk lint toolbox --check
ci_run zk lint js --check
ci_run zk lint ts --check
ci_run zk lint md --check
ci_run zk db check-sqlx-data
ci_run zk_supervisor fmt --check
ci_run zk_supervisor lint -e md --check
ci_run zk_supervisor lint -e sol --check
ci_run zk_supervisor lint -e js --check
ci_run zk_supervisor lint -e ts --check
ci_run zk_supervisor lint -e rs --check
4 changes: 4 additions & 0 deletions .github/workflows/ci-zk-toolbox-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ jobs:
--prover-db-url=postgres://postgres:notsecurepassword@postgres:5432 \
--prover-db-name=zksync_prover_localhost_rollup

- name: Check Database
run: |
ci_run zk_supervisor database check-sqlx-data

Deniallugo marked this conversation as resolved.
Show resolved Hide resolved
- name: Run server
run: |
ci_run zk_inception server --ignore-prerequisites &>server.log &
Expand Down
19 changes: 8 additions & 11 deletions zk_toolbox/crates/zk_supervisor/src/commands/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub struct LintArgs {
pub check: bool,
#[clap(long, short = 'e')]
pub extensions: Vec<Extension>,
#[clap(long, default_missing_value = "true", num_args = 0..=1)]
pub contracts: Option<bool>,
Deniallugo marked this conversation as resolved.
Show resolved Hide resolved
}

pub fn run(shell: &Shell, args: LintArgs) -> anyhow::Result<()> {
Expand All @@ -37,15 +39,19 @@ pub fn run(shell: &Shell, args: LintArgs) -> anyhow::Result<()> {
logger::info(msg_running_linters_for_files(&extensions));

let ecosystem = EcosystemConfig::from_file(shell)?;
let contracts = args.contracts.unwrap_or(false);

for extension in extensions {
match extension {
Extension::Rs => lint_rs(shell, &ecosystem, args.check)?,
Extension::Sol => lint_contracts(shell, &ecosystem, args.check)?,
ext => lint(shell, &ecosystem, &ext, args.check)?,
}
}

if contracts {
lint_contracts(shell, &ecosystem, args.check)?;
}

Ok(())
}

Expand All @@ -61,14 +67,7 @@ fn lint_rs(shell: &Shell, ecosystem: &EcosystemConfig, check: bool) -> anyhow::R
for path in paths {
let _dir_guard = shell.push_dir(path);
let mut cmd = cmd!(shell, "cargo clippy");
let common_args = &[
"--locked",
"--",
"-D",
"warnings",
"-D",
"unstable_features",
];
let common_args = &["--locked", "--", "-D", "warnings"];
if !check {
cmd = cmd.args(&["--fix", "--allow-dirty"]);
}
Expand Down Expand Up @@ -128,8 +127,6 @@ fn lint(
}

fn lint_contracts(shell: &Shell, ecosystem: &EcosystemConfig, check: bool) -> anyhow::Result<()> {
lint(shell, ecosystem, &Extension::Sol, check)?;

let spinner = Spinner::new(MSG_RUNNING_CONTRACTS_LINTER_SPINNER);
let _dir_guard = shell.push_dir(&ecosystem.link_to_code);
let cmd = cmd!(shell, "yarn");
Expand Down
Loading