-
Notifications
You must be signed in to change notification settings - Fork 6
fix: resolve compiler warnings and add CI warning detection #76
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -362,8 +362,14 @@ jobs: | |||||||||||||||||||||
| - name: Warm snforge plugin cache | ||||||||||||||||||||||
| run: snforge --version | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Verify workspace compiles | ||||||||||||||||||||||
| run: scarb build --workspace | ||||||||||||||||||||||
| - name: Verify workspace compiles (no warnings) | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| scarb build --workspace 2>&1 | tee /tmp/build.log | ||||||||||||||||||||||
| if grep -qE '^ --> .*\.cairo:[0-9]+:[0-9]+' /tmp/build.log; then | ||||||||||||||||||||||
| echo "::error::Build produced compiler warnings. Fix all warnings before merging." | ||||||||||||||||||||||
| grep -B1 -E '^ --> .*\.cairo:[0-9]+:[0-9]+' /tmp/build.log | ||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| test: | ||||||||||||||||||||||
| name: test (${{ matrix.module }}) | ||||||||||||||||||||||
|
|
@@ -434,9 +440,18 @@ jobs: | |||||||||||||||||||||
| - name: Run tests with coverage | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| if [ "${{ matrix.package }}" = "game_components_${{ matrix.module }}" ]; then | ||||||||||||||||||||||
| snforge test -p ${{ matrix.package }} --fuzzer-runs ${{ matrix.fuzzer_runs }} --coverage | ||||||||||||||||||||||
| snforge test -p ${{ matrix.package }} --fuzzer-runs ${{ matrix.fuzzer_runs }} --coverage 2>&1 | tee /tmp/test.log | ||||||||||||||||||||||
| else | ||||||||||||||||||||||
| snforge test -p ${{ matrix.package }} "::${{ matrix.module }}::" --fuzzer-runs ${{ matrix.fuzzer_runs }} --coverage | ||||||||||||||||||||||
| snforge test -p ${{ matrix.package }} "::${{ matrix.module }}::" --fuzzer-runs ${{ matrix.fuzzer_runs }} --coverage 2>&1 | tee /tmp/test.log | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Check for compiler warnings | ||||||||||||||||||||||
| if: always() && steps.cache-tools.outcome != 'failure' | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| if [ -f /tmp/test.log ] && grep -qE '^ --> .*\.cairo:[0-9]+:[0-9]+' /tmp/test.log; then | ||||||||||||||||||||||
| echo "::error::Test compilation produced warnings. Fix all warnings before merging." | ||||||||||||||||||||||
| grep -B1 -E '^ --> .*\.cairo:[0-9]+:[0-9]+' /tmp/test.log | ||||||||||||||||||||||
|
Comment on lines
+449
to
+453
|
||||||||||||||||||||||
| if: always() && steps.cache-tools.outcome != 'failure' | |
| run: | | |
| if [ -f /tmp/test.log ] && grep -qE '^ --> .*\.cairo:[0-9]+:[0-9]+' /tmp/test.log; then | |
| echo "::error::Test compilation produced warnings. Fix all warnings before merging." | |
| grep -B1 -E '^ --> .*\.cairo:[0-9]+:[0-9]+' /tmp/test.log | |
| if: success() && steps.cache-tools.outcome != 'failure' | |
| run: | | |
| if [ -f /tmp/test.log ] && grep -q '^warning:' /tmp/test.log; then | |
| echo "::error::Test compilation produced warnings. Fix all warnings before merging." | |
| grep -A1 -E '^warning:' /tmp/test.log |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ pub mod EntryFeeMock { | |
|
|
||
| #[external(v0)] | ||
| fn set_entry_fee(ref self: ContractState, context_id: u64, entry_fee: EntryFee) { | ||
| self.entry_fee.set_entry_fee(context_id, entry_fee); | ||
| let _ = self.entry_fee.set_entry_fee(context_id, entry_fee); | ||
| } | ||
|
Comment on lines
39
to
42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While By modifying the function to return this value, the mock becomes more transparent and robust. You'll also need to add |
||
|
|
||
| #[external(v0)] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warning detector is keyed only on source-location lines (
--> *.cairo:line:col), which are also emitted for compilation errors. Because this step runs withif: always(), a compile failure can be misreported as “warnings” (and potentially add noise on top of the real failure). Consider narrowing the grep to actual warning headers (e.g., matchwarning:and then include the following location lines), or gate this step to only run when the test command succeeded.