From 78c7f38116a39313795696e90729e50df96f4c7d Mon Sep 17 00:00:00 2001 From: Tony Stark Date: Tue, 1 Oct 2024 07:25:42 -0500 Subject: [PATCH 1/5] feat: add cairo-lint ci --- .github/workflows/check.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1c54c2b1..2f3a5fed 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,6 +18,27 @@ jobs: mdl -s .github/linter/readme_style.rb README.md mdl -s .github/linter/base_style.rb .github + cairo-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + components: rustfmt, clippy + + - name: Run cargo install cairo-lint + uses: actions-rs/cargo@v1 + with: + command: install + args: scarb-cairo-lint --git https://github.com/keep-starknet-strange/cairo-lint + + - uses: asdf-vm/actions/install@v3 + - run: scarb cairo-lint + - run: scarb cairo-lint --fix + test: runs-on: ubuntu-latest steps: From 19c12b0902f65d27b8a73662555c455424c1a8e7 Mon Sep 17 00:00:00 2001 From: Tony Stark Date: Tue, 1 Oct 2024 07:59:52 -0500 Subject: [PATCH 2/5] fix: cairo-lint ci upgrade --- .github/workflows/check.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2f3a5fed..6338e7bd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -22,18 +22,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install Rust nightly - uses: actions-rs/toolchain@v1 + - name: Setup Rust nightly + uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly - override: true components: rustfmt, clippy - - - name: Run cargo install cairo-lint - uses: actions-rs/cargo@v1 - with: - command: install - args: scarb-cairo-lint --git https://github.com/keep-starknet-strange/cairo-lint + - name: Install cairo-lint + run: cargo install scarb-cairo-lint --git https://github.com/keep-starknet-strange/cairo-lint - uses: asdf-vm/actions/install@v3 - run: scarb cairo-lint From 83f1d6552fcc77a35d3877c6f6d03fa11c7ffa3b Mon Sep 17 00:00:00 2001 From: Tony Stark Date: Sun, 6 Oct 2024 13:29:53 -0500 Subject: [PATCH 3/5] fix: ci fails with lint issue --- .github/workflows/check.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6338e7bd..66effab9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -30,8 +30,13 @@ jobs: run: cargo install scarb-cairo-lint --git https://github.com/keep-starknet-strange/cairo-lint - uses: asdf-vm/actions/install@v3 - - run: scarb cairo-lint - - run: scarb cairo-lint --fix + - name: Run cairo-lint + run: | + scarb cairo-lint > lint_output.txt + if grep -q "warning:" lint_output.txt; then + echo "Linting failed due to warnings" + exit 1 + fi test: runs-on: ubuntu-latest From fbb8b018c003ec439717817ec5431996a073df91 Mon Sep 17 00:00:00 2001 From: Tony Stark Date: Sun, 6 Oct 2024 13:45:51 -0500 Subject: [PATCH 4/5] retry build --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 66effab9..a1c63a49 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -33,7 +33,7 @@ jobs: - name: Run cairo-lint run: | scarb cairo-lint > lint_output.txt - if grep -q "warning:" lint_output.txt; then + if grep -i "warning:" lint_output.txt; then echo "Linting failed due to warnings" exit 1 fi From 2e5291e233ae554bcf8309b298779feaae390d37 Mon Sep 17 00:00:00 2001 From: Tony Stark Date: Sun, 6 Oct 2024 13:56:33 -0500 Subject: [PATCH 5/5] retry --- .github/workflows/check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a1c63a49..c6ccfaef 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -30,10 +30,10 @@ jobs: run: cargo install scarb-cairo-lint --git https://github.com/keep-starknet-strange/cairo-lint - uses: asdf-vm/actions/install@v3 - - name: Run cairo-lint + - name: Run cairo-lint and check for warnings run: | - scarb cairo-lint > lint_output.txt - if grep -i "warning:" lint_output.txt; then + scarb cairo-lint > lint_output.txt 2>&1 + if grep -qi "warning:" lint_output.txt; then echo "Linting failed due to warnings" exit 1 fi