File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 71
71
override : true
72
72
- name : check rust versions
73
73
run : ./scripts/check-rust-version.sh
74
+
75
+ kernel_errors :
76
+ name : kernel errors check
77
+ runs-on : ubuntu-latest
78
+ steps :
79
+ - uses : actions/checkout@main
80
+ - name : Rustup
81
+ run : rustup update --no-self-update
82
+ - uses : Swatinem/rust-cache@v2
83
+ with :
84
+ save-if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
85
+ - name : Rebuild kernel errors
86
+ run : BUILD_KERNEL_ERRORS=1 cargo check -p miden-tx
87
+ - name : Diff check
88
+ run : git diff --exit-code
Original file line number Diff line number Diff line change 9
9
WARNINGS=RUSTDOCFLAGS ="-D warnings"
10
10
DEBUG_ASSERTIONS=RUSTFLAGS ="-C debug-assertions"
11
11
ALL_FEATURES_BUT_ASYNC =--features concurrent,testing
12
+ BUILD_KERNEL_ERRORS=BUILD_KERNEL_ERRORS =1
12
13
13
14
# -- linting --------------------------------------------------------------------------------------
14
15
@@ -70,18 +71,18 @@ test: test-default test-prove ## Run all tests
70
71
71
72
.PHONY : check
72
73
check : # # Check all targets and features for errors without code generation
73
- cargo check --all-targets $(ALL_FEATURES_BUT_ASYNC )
74
+ ${BUILD_KERNEL_ERRORS} cargo check --all-targets $(ALL_FEATURES_BUT_ASYNC )
74
75
75
76
# --- building ------------------------------------------------------------------------------------
76
77
77
78
.PHONY : build
78
79
build : # # By default we should build in release mode
79
- cargo build --release
80
+ ${BUILD_KERNEL_ERRORS} cargo build --release
80
81
81
82
82
83
.PHONY : build-no-std
83
84
build-no-std : # # Build without the standard library
84
- cargo build --no-default-features --target wasm32-unknown-unknown --workspace --lib
85
+ ${BUILD_KERNEL_ERRORS} cargo build --no-default-features --target wasm32-unknown-unknown --workspace --lib
85
86
86
87
87
88
.PHONY : build-no-std-testing
@@ -91,7 +92,7 @@ build-no-std-testing: ## Build without the standard library. Includes the `testi
91
92
92
93
.PHONY : build-async
93
94
build-async : # # Build with the `async` feature enabled (only libraries)
94
- cargo build --lib --release --features async
95
+ ${BUILD_KERNEL_ERRORS} cargo build --lib --release --features async
95
96
96
97
97
98
# --- benchmarking --------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -11,10 +11,20 @@ const ASM_DIR: &str = "../miden-lib/asm";
11
11
const KERNEL_ERRORS_FILE : & str = "src/errors/tx_kernel_errors.rs" ;
12
12
const MASM_FILE_EXTENSION : & str = "masm" ;
13
13
14
+ /// Generates error mappings for transaction kernel errors.
15
+ ///
16
+ /// This is done only if BUILD_KERNEL_ERRORS environment variable is set to `1` to avoid running
17
+ /// the script on crates.io where MASM files from miden-lib are not available.
14
18
fn main ( ) -> Result < ( ) > {
15
19
// re-build when the MASM code changes
16
20
println ! ( "cargo:rerun-if-changed={ASM_DIR}" ) ;
17
21
println ! ( "cargo:rerun-if-changed={KERNEL_ERRORS_FILE}" ) ;
22
+ println ! ( "cargo::rerun-if-env-changed=BUILD_KERNEL_ERRORS" ) ;
23
+
24
+ // Skip this build script in BUILD_KERNEL_ERRORS environment variable is not set to `1`.
25
+ if env:: var ( "BUILD_KERNEL_ERRORS" ) . unwrap_or ( "0" . to_string ( ) ) == "0" {
26
+ return Ok ( ( ) ) ;
27
+ }
18
28
19
29
// Copies the MASM code to the build directory
20
30
let crate_dir = env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments