1+ name : Reusable Build Workflow
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ os :
7+ required : true
8+ type : string
9+ description : " Operating system to build on"
10+ ocaml_version :
11+ required : false
12+ type : string
13+ default : " 4.14.2"
14+ description : " OCaml version to use"
15+ cache-prefix :
16+ required : false
17+ type : string
18+ default : " "
19+ description : " Cache prefix for the build"
20+ build-wasm :
21+ required : false
22+ type : boolean
23+ default : false
24+ description : " Whether to build WASM targets"
25+
26+ env :
27+ CARGO_TERM_COLOR : always
28+ RUST_BACKTRACE : full
29+ MINA_PANIC_ON_BUG : true
30+ CARGO_INCREMENTAL : 1
31+ RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off -C link-args=-Wl,-undefined,dynamic_lookup"
32+
33+ jobs :
34+ build :
35+ timeout-minutes : 60
36+ runs-on : ${{ inputs.os }}
37+ steps :
38+ - name : Git checkout
39+ uses : actions/checkout@v5
40+
41+ - name : Setup build dependencies
42+ uses : ./.github/actions/setup-build-deps
43+
44+ - name : Use shared OCaml setting up steps
45+ uses : ./.github/actions/setup-ocaml
46+ with :
47+ ocaml_version : ${{ inputs.ocaml_version }}
48+
49+ - name : Setup Rust
50+ uses : ./.github/actions/setup-rust
51+ with :
52+ toolchain : 1.84
53+ cache-prefix : build-${{ inputs.os }}-${{ inputs.cache-prefix }}v0
54+
55+ - name : Release build
56+ run : make build-release
57+
58+ - name : Verify build-info command
59+ run : |
60+ echo "Testing build-info command..."
61+ ./target/release/mina build-info
62+
63+ # Verify required fields are present
64+ ./target/release/mina build-info | grep -E "Version:|Build time:|Commit SHA:|Commit branch:|Rustc version:"
65+
66+ # Verify version format (should be a short commit hash)
67+ VERSION=$(./target/release/mina build-info | grep "Version:" | awk '{print $2}')
68+ if [[ ! "$VERSION" =~ ^[0-9a-f]{7}$ ]]; then
69+ echo "Error: Version should be a 7-character commit hash, got: $VERSION"
70+ exit 1
71+ fi
72+
73+ echo "Build info verification passed!"
74+
75+ build-tests :
76+ timeout-minutes : 60
77+ runs-on : ${{ inputs.os }}
78+ steps :
79+ - name : Git checkout
80+ uses : actions/checkout@v5
81+
82+ - name : Setup build dependencies
83+ uses : ./.github/actions/setup-build-deps
84+
85+ - name : Use shared OCaml setting up steps
86+ uses : ./.github/actions/setup-ocaml
87+ with :
88+ ocaml_version : ${{ inputs.ocaml_version }}
89+
90+ - name : Setup Rust
91+ uses : ./.github/actions/setup-rust
92+ with :
93+ toolchain : 1.84
94+ cache-prefix : build-tests-${{ inputs.os }}-${{ inputs.cache-prefix }}v0
95+
96+ - name : Build tests
97+ run : make build-tests
98+
99+ build-tests-webrtc :
100+ timeout-minutes : 60
101+ runs-on : ${{ inputs.os }}
102+ steps :
103+ - name : Git checkout
104+ uses : actions/checkout@v5
105+
106+ - name : Setup build dependencies
107+ uses : ./.github/actions/setup-build-deps
108+
109+ - name : Use shared OCaml setting up steps
110+ uses : ./.github/actions/setup-ocaml
111+ with :
112+ ocaml_version : ${{ inputs.ocaml_version }}
113+
114+ - name : Setup Rust
115+ uses : ./.github/actions/setup-rust
116+ with :
117+ toolchain : 1.84
118+ cache-prefix : build-tests-webrtc-${{ inputs.os }}-${{ inputs.cache-prefix }}v0
119+
120+ - name : Build tests
121+ run : make build-tests-webrtc
122+
123+ build-wasm :
124+ if : ${{ inputs.build-wasm }}
125+ timeout-minutes : 60
126+ runs-on : ${{ inputs.os }}
127+ steps :
128+ - name : Git checkout
129+ uses : actions/checkout@v5
130+
131+ - name : Setup build dependencies
132+ uses : ./.github/actions/setup-build-deps
133+
134+ - name : Use shared OCaml setting up steps
135+ uses : ./.github/actions/setup-ocaml
136+ with :
137+ ocaml_version : ${{ inputs.ocaml_version }}
138+
139+ - name : Setup WebAssembly environment
140+ uses : ./.github/actions/setup-wasm
141+ with :
142+ cache-prefix : wasm-${{ inputs.os }}-${{ inputs.cache-prefix }}v0
143+
144+ - name : Release build
145+ run : make build-wasm
146+ env :
147+ RUSTFLAGS : " "
0 commit comments