Skip to content

Commit

Permalink
test(ci): add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLucqs committed Aug 6, 2024
1 parent ffd1235 commit 52a5fa1
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 13 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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: |
sudo mkdir /corelib
cd /corelib
sudo git init
sudo 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
29 changes: 29 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion crates/unretardify-test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct Tests {
pub should_fix: bool,
}
pub fn get_diags(crate_id: CrateId, db: &mut AnalysisDatabase) -> Vec<Diagnostics<SemanticDiagnostic>> {
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() {
Expand Down

0 comments on commit 52a5fa1

Please sign in to comment.