Consolidate all "build" workflows #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build CI | ||
Check failure on line 1 in .github/workflows/build-ci.yaml
|
||
on: | ||
push: | ||
branches: [main, develop] | ||
workflow_dispatch: | ||
inputs: | ||
os: | ||
description: 'OS to build on. If empty, builds on all supported OSes.' | ||
required: false | ||
default: '' | ||
type: string | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: full | ||
MINA_PANIC_ON_BUG: true | ||
CARGO_INCREMENTAL: 1 | ||
RUSTFLAGS: "-C overflow-checks=off -C debug-assertions=off" | ||
x-matrix-os: &matrix-os | ||
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-14, macos-15, macos-latest] | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
<<: *matrix-os | ||
if: ${{ github.event.inputs.os == '' || github.event.inputs.os == matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
RUSTFLAGS: "-C overflow-checks=off -C debug-assertions=off ${{ startsWith(matrix.os, 'macos') && '-C link-args=-Wl,-undefined,dynamic_lookup' || '' }}" | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v5 | ||
- name: Setup build dependencies | ||
uses: ./.github/actions/setup-build-deps | ||
- name: Use shared OCaml setting up steps | ||
uses: ./.github/actions/setup-ocaml | ||
with: | ||
ocaml_version: '4.14.2' | ||
- name: Setup Rust | ||
uses: ./.github/actions/setup-rust | ||
with: | ||
toolchain: 1.84 | ||
cache-prefix: build-${{ matrix.os }}-${{ matrix.os }}-v0 | ||
- name: Release build | ||
run: make build-release | ||
- name: Verify build-info command | ||
run: | | ||
echo "Testing build-info command..." | ||
./target/release/mina build-info | ||
# Verify required fields are present | ||
./target/release/mina build-info | grep -E "Version:|Build time:|Commit SHA:|Commit branch:|Rustc version:" | ||
# Verify version format (should be a short commit hash) | ||
VERSION=$(./target/release/mina build-info | grep "Version:" | awk '{print $2}') | ||
if [[ ! "$VERSION" =~ ^[0-9a-f]{7}$ ]]; then | ||
echo "Error: Version should be a 7-character commit hash, got: $VERSION" | ||
exit 1 | ||
fi | ||
echo "Build info verification passed!" | ||
build-tests: | ||
strategy: | ||
matrix: | ||
<<: *matrix-os | ||
if: ${{ github.event.inputs.os == '' || github.event.inputs.os == matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
RUSTFLAGS: "-C overflow-checks=off -C debug-assertions=off ${{ startsWith(matrix.os, 'macos') && '-C link-args=-Wl,-undefined,dynamic_lookup' || '' }}" | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v5 | ||
- name: Setup build dependencies | ||
uses: ./.github/actions/setup-build-deps | ||
- name: Use shared OCaml setting up steps | ||
uses: ./.github/actions/setup-ocaml | ||
with: | ||
ocaml_version: '4.14.2' | ||
- name: Setup Rust | ||
uses: ./.github/actions/setup-rust | ||
with: | ||
toolchain: 1.84 | ||
cache-prefix: build-tests-${{ matrix.os }}-${{ matrix.os }}-v0 | ||
- name: Build tests | ||
run: make build-tests | ||
build-tests-webrtc: | ||
strategy: | ||
matrix: | ||
<<: *matrix-os | ||
if: ${{ github.event.inputs.os == '' || github.event.inputs.os == matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
RUSTFLAGS: "-C overflow-checks=off -C debug-assertions=off ${{ startsWith(matrix.os, 'macos') && '-C link-args=-Wl,-undefined,dynamic_lookup' || '' }}" | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v5 | ||
- name: Setup build dependencies | ||
uses: ./.github/actions/setup-build-deps | ||
- name: Use shared OCaml setting up steps | ||
uses: ./.github/actions/setup-ocaml | ||
with: | ||
ocaml_version: '4.14.2' | ||
- name: Setup Rust | ||
uses: ./.github/actions/setup-rust | ||
with: | ||
toolchain: 1.84 | ||
cache-prefix: build-tests-webrtc-${{ matrix.os }}-${{ matrix.os }}-v0 | ||
- name: Build tests | ||
run: make build-tests-webrtc | ||
build-benches: | ||
needs: [build] | ||
strategy: | ||
matrix: | ||
<<: *matrix-os | ||
if: ${{ github.event.inputs.os == '' || github.event.inputs.os == matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
RUSTFLAGS: "-C overflow-checks=off -C debug-assertions=off ${{ startsWith(matrix.os, 'macos') && '-C link-args=-Wl,-undefined,dynamic_lookup' || '' }}" | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v5 | ||
- name: Setup build dependencies | ||
uses: ./.github/actions/setup-build-deps | ||
- name: Use shared OCaml setting up steps | ||
uses: ./.github/actions/setup-ocaml | ||
with: | ||
ocaml_version: '4.14.2' | ||
- name: Setup Rust | ||
uses: ./.github/actions/setup-rust | ||
with: | ||
toolchain: 1.84 | ||
cache-prefix: build-${{ matrix.os }}-${{ matrix.os }}-v0 | ||
- name: Build benchmarks | ||
run: make build-benches | ||
build-wasm: | ||
strategy: | ||
matrix: | ||
<<: *matrix-os | ||
if: ${{ github.event.inputs.os == '' || github.event.inputs.os == matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v5 | ||
- name: Setup build dependencies | ||
uses: ./.github/actions/setup-build-deps | ||
- name: Use shared OCaml setting up steps | ||
uses: ./.github/actions/setup-ocaml | ||
with: | ||
ocaml_version: '4.14.2' | ||
- name: Setup WebAssembly environment | ||
uses: ./.github/actions/setup-wasm | ||
with: | ||
cache-prefix: wasm-${{ matrix.os }}-${{ matrix.os }}-v0 | ||
- name: Release build | ||
run: make build-wasm | ||
env: | ||
RUSTFLAGS: "" |