diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..828665ac --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +on: [push, pull_request] + +name: Test + +jobs: + test: + name: Test + runs-on: ubuntu-latest + env: + CORELIB_PATH: /corelib/src + steps: + - name: Set up Git + run: git config --global core.sparseCheckout true + + - name: Clone specific folder from another repository + run: | + mkdir /corelib + cd /corelib + git init + git remote add origin https://github.com/0xLucqs/cairo.git + echo "/corelib" >> .git/info/sparse-checkout + git fetch --depth 1 origin lucas/multiline_diagnostic + git checkout lucas/multiline_diagnostic + + - uses: actions/checkout@v3 + + - name: Install toolchain + run: rustup show + + - uses: Swatinem/rust-cache@v2 + + - name: Run cargo clippy + run: cargo clippy -- -D warnings + + - name: Run cargo test + run: cargo test + + - name: Run cargo fmt + run: rustup update nightly && rustup run nightly cargo fmt -- --check diff --git a/Cargo.lock b/Cargo.lock index 2d15fb4d..ca808254 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -187,6 +187,7 @@ checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cairo-lang-casm" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-utils", "indoc", @@ -199,6 +200,7 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "anyhow", "cairo-lang-defs", @@ -222,6 +224,7 @@ dependencies = [ [[package]] name = "cairo-lang-debug" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-utils", ] @@ -229,6 +232,7 @@ dependencies = [ [[package]] name = "cairo-lang-defs" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -244,6 +248,7 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -254,6 +259,7 @@ dependencies = [ [[package]] name = "cairo-lang-doc" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-defs", "cairo-lang-formatter", @@ -267,6 +273,7 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-utils", "good_lp", @@ -275,6 +282,7 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", @@ -287,6 +295,7 @@ dependencies = [ [[package]] name = "cairo-lang-formatter" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "anyhow", "cairo-lang-diagnostics", @@ -306,6 +315,7 @@ dependencies = [ [[package]] name = "cairo-lang-language-server" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -340,6 +350,7 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -362,6 +373,7 @@ dependencies = [ [[package]] name = "cairo-lang-parser" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -380,6 +392,7 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -397,6 +410,7 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-debug", "quote", @@ -406,6 +420,7 @@ dependencies = [ [[package]] name = "cairo-lang-project" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", @@ -418,6 +433,7 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -442,6 +458,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "anyhow", "cairo-lang-utils", @@ -467,6 +484,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -481,6 +499,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -495,6 +514,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -517,6 +537,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "assert_matches", "cairo-lang-casm", @@ -536,6 +557,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-type-size" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-sierra", "cairo-lang-utils", @@ -544,6 +566,7 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -572,6 +595,7 @@ dependencies = [ [[package]] name = "cairo-lang-starknet-classes" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-casm", "cairo-lang-sierra", @@ -593,6 +617,7 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -607,6 +632,7 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "genco", "xshell", @@ -615,6 +641,7 @@ dependencies = [ [[package]] name = "cairo-lang-test-plugin" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -640,6 +667,7 @@ dependencies = [ [[package]] name = "cairo-lang-test-utils" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "cairo-lang-formatter", "cairo-lang-utils", @@ -651,6 +679,7 @@ dependencies = [ [[package]] name = "cairo-lang-utils" version = "2.7.0" +source = "git+https://github.com/0xLucqs/cairo?branch=lucas/multiline_diag#11f8a1979834e39f4a79cc9d3a2707017b46e1fa" dependencies = [ "hashbrown 0.14.5", "indexmap 2.3.0", diff --git a/Cargo.toml b/Cargo.toml index ff3902db..3ff48507 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,18 +10,18 @@ license = "Apache-2.0" license-file = "LICENSE" [workspace.dependencies] -cairo-lang-compiler = { path = "../cairo/crates/cairo-lang-compiler" } -cairo-lang-parser = { path = "../cairo/crates/cairo-lang-parser" } -cairo-lang-utils = { path = "../cairo/crates/cairo-lang-utils" } -cairo-lang-semantic = { path = "../cairo/crates/cairo-lang-semantic" } -cairo-lang-filesystem = { path = "../cairo/crates/cairo-lang-filesystem" } -cairo-lang-diagnostics = { path = "../cairo/crates/cairo-lang-diagnostics" } -cairo-lang-test-plugin = { path = "../cairo/crates/cairo-lang-test-plugin" } -cairo-lang-lowering = { path = "../cairo/crates/cairo-lang-lowering" } -cairo-lang-syntax = { path = "../cairo/crates/cairo-lang-syntax" } -cairo-lang-defs = { path = "../cairo/crates/cairo-lang-defs" } -cairo-lang-test-utils = { path = "../cairo/crates/cairo-lang-test-utils" } -cairo-lang-language-server = { path = "../cairo/crates/cairo-lang-language-server" } +cairo-lang-compiler = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-parser = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-utils = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-semantic = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-filesystem = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-diagnostics = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-test-plugin = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-lowering = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-syntax = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-defs = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-test-utils = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } +cairo-lang-language-server = { git = "https://github.com/0xLucqs/cairo", branch = "lucas/multiline_diag" } salsa = "0.16.1" indoc = "2" test-case = "3.0" diff --git a/crates/unretardify-test-utils/src/lib.rs b/crates/unretardify-test-utils/src/lib.rs index a89b882f..cf250ffe 100644 --- a/crates/unretardify-test-utils/src/lib.rs +++ b/crates/unretardify-test-utils/src/lib.rs @@ -17,7 +17,7 @@ pub struct Tests { pub should_fix: bool, } pub fn get_diags(crate_id: CrateId, db: &mut AnalysisDatabase) -> Vec> { - init_dev_corelib(db, PathBuf::from("/Users/lucas/cairo/corelib/src")); + init_dev_corelib(db, PathBuf::from(std::env::var("CORELIB_PATH").unwrap())); let mut diagnostics = Vec::new(); let module_file = db.module_main_file(ModuleId::CrateRoot(crate_id)).unwrap(); if db.file_content(module_file).is_none() {