Skip to content

Commit ae1a00e

Browse files
authored
Add separate steps for linting rust and libraries (#13043)
- close #12086
1 parent d86898a commit ae1a00e

File tree

10 files changed

+54
-37
lines changed

10 files changed

+54
-37
lines changed

.github/workflows/engine-checks-nightly.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ jobs:
349349
run: ./run git-clean
350350
env:
351351
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
352+
- name: Check syntax
353+
run: ./run libraries check-syntax
352354
- run: rm -rf built-distribution test
353355
shell: bash
354356
- name: Download Engine Distribution

.github/workflows/engine-checks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ jobs:
174174
run: ./run git-clean
175175
env:
176176
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
177+
- name: Check syntax
178+
run: ./run libraries check-syntax
177179
- run: rm -rf built-distribution test
178180
shell: bash
179181
- name: Download Engine Distribution

.github/workflows/wasm-checks.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ concurrency:
1515
group: ${{ github.workflow }}-${{ github.ref }}-wasm-checks
1616
cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }}
1717
jobs:
18-
enso-build-ci-gen-job-lint-linux-amd64:
19-
name: Lint (linux, amd64)
18+
enso-build-ci-gen-job-native-test-linux-amd64:
19+
name: Native Rust tests (linux, amd64)
2020
runs-on:
2121
- self-hosted
2222
- Linux
@@ -54,16 +54,16 @@ jobs:
5454
run: ./run git-clean
5555
env:
5656
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
- run: ./run lint
57+
- run: ./run wasm test --no-wasm
5858
env:
5959
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060
- if: "(always()) && (contains(github.event.pull_request.labels.*.name, 'CI: Clean build required') || (github.ref == 'refs/heads/develop') || inputs.clean_build_required)"
6161
name: Clean after
6262
run: ./run git-clean
6363
env:
6464
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65-
enso-build-ci-gen-job-native-test-linux-amd64:
66-
name: Native Rust tests (linux, amd64)
65+
enso-build-ci-gen-job-wasm-lint-linux-amd64:
66+
name: Lint (linux, amd64)
6767
runs-on:
6868
- self-hosted
6969
- Linux
@@ -101,7 +101,7 @@ jobs:
101101
run: ./run git-clean
102102
env:
103103
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104-
- run: ./run wasm test --no-wasm
104+
- run: ./run wasm lint
105105
env:
106106
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107107
- if: "(always()) && (contains(github.event.pull_request.labels.*.name, 'CI: Clean build required') || (github.ref == 'refs/heads/develop') || inputs.clean_build_required)"

build_tools/build/src/ci_gen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ pub fn wasm_checks() -> Result<Workflow> {
844844
on,
845845
..default()
846846
};
847-
workflow.add(PRIMARY_TARGET, job::Lint);
847+
workflow.add(PRIMARY_TARGET, job::WasmLint);
848848
workflow.add(PRIMARY_TARGET, job::WasmTest);
849849
workflow.add(PRIMARY_TARGET, job::NativeTest);
850850
Ok(workflow)

build_tools/build/src/ci_gen/job.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,20 @@ impl JobArchetype for EnsoCodeLintCheck {
405405
let engine_launcher = self.engine_launcher;
406406
let mut job = RunStepsBuilder::new("libraries lint")
407407
.customize(move |step| {
408+
let check_syntax = Step {
409+
name: Some("Check syntax".into()),
410+
run: Some("./run libraries check-syntax".into()),
411+
..Default::default()
412+
};
413+
408414
let cleanup_engine_distribution =
409415
step::cleanup_engine_distribution(engine_launcher);
410416

411417
let download_engine_distribution =
412418
step::download_engine_distribution(target, engine_launcher, graal_edition);
413419

414420
vec![
421+
check_syntax,
415422
cleanup_engine_distribution,
416423
download_engine_distribution,
417424
step::unpack_engine_distribution(),
@@ -646,11 +653,11 @@ impl JobArchetype for SnowflakeTests {
646653
}
647654

648655
#[derive(Clone, Copy, Debug)]
649-
pub struct Lint;
656+
pub struct WasmLint;
650657

651-
impl JobArchetype for Lint {
658+
impl JobArchetype for WasmLint {
652659
fn job(&self, target: Target) -> Job {
653-
plain_job(target, "Lint", "lint")
660+
plain_job(target, "Lint", "wasm lint")
654661
}
655662
}
656663

build_tools/build/src/rust/enso_linter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn collect_source_paths(repo_root: &RepoRoot) -> Result<Vec<PathBuf>> {
3131
Ok(glob_paths.into_iter().flatten().collect::<std::result::Result<_, _>>()?)
3232
}
3333

34-
pub async fn lint_all(repo_root: RepoRoot) -> Result<()> {
34+
pub async fn check_syntax(repo_root: RepoRoot) -> Result<()> {
3535
let sources = collect_source_paths(&repo_root)?;
3636
cargo_run_linter_cmd(&repo_root)?.arg("--").args(sources).run_ok().await?;
3737
Ok(())

build_tools/cli/src/arg.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ pub enum Target {
127127
/// Clean the repository. Keeps the IntelliJ's .idea directory intact. WARNING: This removes
128128
/// files that are not under version control in the repository subtree.
129129
GitClean(git_clean::Options),
130-
/// Lint non-TypeScript codebase. TypeScript Linting is part of the GUI Check target.
131-
Lint,
132130
/// Apply automatic formatters on the repository.
133131
#[clap(alias = "format")]
134132
Fmt,

build_tools/cli/src/arg/libraries.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use clap::Subcommand;
77

88
#[derive(Subcommand, Clone, Copy, Debug, PartialEq, Eq)]
99
pub enum Command {
10+
/// Run enso parser on Enso source files.
11+
CheckSyntax,
1012
/// Run a linter on Enso source files.
1113
Lint,
1214
}

build_tools/cli/src/arg/wasm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub enum Command {
2424
#[clap(long, enso_env(), value_enum, default_values_t = [Browser::Firefox])]
2525
browser: Vec<Browser>,
2626
},
27+
Lint,
2728
}
2829

2930
#[derive(Args, Clone, Debug)]

build_tools/cli/src/lib.rs

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,32 @@ impl Processor {
278278
let root = self.repo_root.to_path_buf();
279279
async move { project::wasm::test(root, &wasm_browsers, !no_native).await }.boxed()
280280
}
281+
arg::wasm::Command::Lint => {
282+
let repo_root = self.repo_root.clone();
283+
async move {
284+
Cargo
285+
.cmd()?
286+
.current_dir(&repo_root)
287+
.arg(cargo::clippy::COMMAND)
288+
.apply(&cargo::Options::Workspace)
289+
.apply(&cargo::Options::Package("enso-integration-test".into()))
290+
.apply(&cargo::Options::AllTargets)
291+
.apply(&cargo::Color::Always)
292+
.arg("--")
293+
.apply(&rustc::Option::Deny(rustc::Lint::Warnings))
294+
.run_ok()
295+
.await?;
296+
297+
Cargo
298+
.cmd()?
299+
.current_dir(&repo_root)
300+
.arg("fmt")
301+
.args(["--", "--check"])
302+
.run_ok()
303+
.await
304+
}
305+
.boxed()
306+
}
281307
}
282308
}
283309

@@ -737,30 +763,6 @@ pub async fn main_internal(config: Option<Config>) -> Result {
737763
};
738764
try_join(git_clean, clean_cache).await?;
739765
}
740-
Target::Lint => {
741-
Cargo
742-
.cmd()?
743-
.current_dir(&ctx.repo_root)
744-
.arg(cargo::clippy::COMMAND)
745-
.apply(&cargo::Options::Workspace)
746-
.apply(&cargo::Options::Package("enso-integration-test".into()))
747-
.apply(&cargo::Options::AllTargets)
748-
.apply(&cargo::Color::Always)
749-
.arg("--")
750-
.apply(&rustc::Option::Deny(rustc::Lint::Warnings))
751-
.run_ok()
752-
.await?;
753-
754-
Cargo
755-
.cmd()?
756-
.current_dir(&ctx.repo_root)
757-
.arg("fmt")
758-
.args(["--", "--check"])
759-
.run_ok()
760-
.await?;
761-
762-
enso_build::rust::enso_linter::lint_all(ctx.repo_root.clone()).await?;
763-
}
764766
Target::Fmt => {
765767
enso_build::web::install(&ctx.repo_root).await?;
766768
let prettier =
@@ -839,6 +841,9 @@ pub async fn main_internal(config: Option<Config>) -> Result {
839841
enso_build::changelog::check::check(ctx.repo_root.clone(), ci_context).await?;
840842
}
841843
Target::Libraries(command) => match command.action {
844+
libraries::Command::CheckSyntax => {
845+
enso_build::rust::enso_linter::check_syntax(ctx.repo_root.clone()).await?;
846+
}
842847
libraries::Command::Lint => {
843848
let config = enso_build::engine::BuildConfigurationFlags {
844849
run_enso_lint: true,

0 commit comments

Comments
 (0)