Skip to content

Commit 62238de

Browse files
authored
Merge pull request #1247 from o1-labs/dw/update-instructions-build
Docs: add macOS instructions to developer getting-started guide
2 parents 061df86 + 94e556e commit 62238de

14 files changed

+254
-24
lines changed

.github/workflows/test-docs-scripts.yml

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test Documentation Scripts
1+
name: Documentation Scripts
22

33
# This workflow tests the documentation setup scripts to ensure they work correctly.
44
# It runs nightly and on-demand to avoid slowing down regular development workflow,
@@ -14,7 +14,7 @@ on:
1414
# Allow manual triggering for testing
1515

1616
jobs:
17-
test-system-setup:
17+
ubuntu:
1818
name: Test System Setup Scripts (${{ matrix.os }})
1919
runs-on: ${{ matrix.os }}
2020
# Only run if the event is scheduled, manual, or PR has test-doc-scripts label
@@ -58,11 +58,61 @@ jobs:
5858
source ~/.cargo/env
5959
./website/docs/developers/scripts/setup/format-and-lint.sh
6060
61-
- name: Test run tests
61+
- name: Verify installations
62+
run: |
63+
echo "Verifying installed tools..."
64+
source ~/.cargo/env
65+
rustc --version
66+
cargo --version
67+
node --version
68+
npm --version
69+
protoc --version
70+
sqlite3 --version
71+
wasm-pack --version
72+
73+
macos:
74+
name: Test System Setup Scripts (${{ matrix.os }})
75+
runs-on: ${{ matrix.os }}
76+
# Only run if the event is scheduled, manual, or PR has test-doc-scripts label
77+
# This prevents long-running tests from blocking regular development workflow
78+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'test-doc-scripts')
79+
strategy:
80+
matrix:
81+
os: [macos-latest]
82+
83+
steps:
84+
- name: Checkout repository
85+
uses: actions/checkout@v4
86+
87+
- name: Test system dependencies installation
88+
run: |
89+
./website/docs/developers/scripts/setup/install-system-deps-macos.sh
90+
91+
- name: Test Node.js installation
92+
run: |
93+
./website/docs/developers/scripts/setup/install-nodejs-macos.sh
94+
95+
- name: Test Rust installation
96+
run: |
97+
./website/docs/developers/scripts/setup/install-rust.sh
98+
99+
- name: Test WASM tools installation
62100
run: |
63101
# Source cargo environment first
64102
source ~/.cargo/env
65-
./website/docs/developers/scripts/setup/run-tests.sh
103+
./website/docs/developers/scripts/setup/install-wasm-tools.sh
104+
105+
- name: Test specialised builds
106+
run: |
107+
# Source cargo environment first
108+
source ~/.cargo/env
109+
./website/docs/developers/scripts/setup/build-specialized.sh
110+
111+
- name: Test format and lint
112+
run: |
113+
# Source cargo environment first
114+
source ~/.cargo/env
115+
./website/docs/developers/scripts/setup/format-and-lint.sh
66116
67117
- name: Verify installations
68118
run: |
@@ -76,7 +126,7 @@ jobs:
76126
sqlite3 --version
77127
wasm-pack --version
78128
79-
test-docker-setup:
129+
docker-ubuntu:
80130
name: Test Docker Setup Script (${{ matrix.os }})
81131
runs-on: ${{ matrix.os }}
82132
# Only run if the event is scheduled, manual, or PR has test-doc-scripts label
@@ -98,3 +148,27 @@ jobs:
98148
run: |
99149
sudo docker --version
100150
sudo docker run hello-world
151+
152+
docker-macos:
153+
name: Test Docker Setup Script (${{ matrix.os }})
154+
runs-on: ${{ matrix.os }}
155+
# Only run if the event is scheduled, manual, or PR has test-doc-scripts label
156+
# This prevents long-running tests from blocking regular development workflow
157+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'test-doc-scripts')
158+
strategy:
159+
matrix:
160+
os: [macos-latest]
161+
162+
steps:
163+
- name: Checkout repository
164+
uses: actions/checkout@v4
165+
166+
- name: Test Docker installation
167+
run: |
168+
./website/docs/developers/scripts/setup/install-docker-macos.sh
169+
170+
- name: Verify Docker installation
171+
run: |
172+
# Docker Desktop needs to be started manually on macOS
173+
# We'll just check if it was installed via Homebrew
174+
docker --version || echo "Docker installed but not running (expected on macOS CI)"

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ cargo-build-test.json
1313
tests.tsv
1414

1515
# Generated API docs should not be committed
16-
website/static/api-docs/
16+
website/static/api-docs/
17+
18+
ledger/3.0.0devnet
19+
ledger/3.0.0mainnet
20+
ledger/3.0.1devnet
21+
ledger/berkeley_rc1

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- **Development Tools**: Enhanced formatting infrastructure with MDX file
3333
support and trailing whitespace management
3434
([#1234](https://github.com/o1-labs/openmina/pull/1234))
35+
- **Documentation**: add instructions for developers using MacOS based systems,
36+
and test the installation commands in CI
37+
([#1247](https://github.com/o1-labs/openmina/pull/1234)).
3538

3639
### Changed
3740

CLAUDE.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,55 @@ referencing Claude.
218218
6. **Verify commit message contains no emojis and follows 80-character wrap**
219219
7. Proceed with testing or committing changes
220220

221+
### Documentation Script Testing
222+
223+
When modifying developer setup scripts in `website/docs/developers/scripts/`,
224+
always test them using the documentation testing workflow:
225+
226+
#### Testing Documentation Scripts
227+
228+
The project includes automated testing of developer setup scripts to ensure they
229+
work correctly across different platforms. This prevents developers from
230+
encountering broken installation instructions.
231+
232+
**When to test:**
233+
234+
- After modifying any script in `website/docs/developers/scripts/setup/`
235+
- When adding new dependencies or tools to the setup process
236+
- When changing installation procedures
237+
- When adding support for a new distribution or platform
238+
239+
**How to trigger tests:**
240+
241+
1. **For PRs**: Add the `test-doc-scripts` label to your pull request
242+
2. **Manual testing**: Use GitHub CLI:
243+
`gh pr edit <PR_NUMBER> --add-label test-doc-scripts`
244+
3. **Remove and re-add**: If tests need to be re-run, remove the label first:
245+
```bash
246+
gh pr edit <PR_NUMBER> --remove-label test-doc-scripts
247+
gh pr edit <PR_NUMBER> --add-label test-doc-scripts
248+
```
249+
250+
**What gets tested:**
251+
252+
- System dependencies installation (Ubuntu/macOS)
253+
- Rust toolchain setup (including taplo, wasm-pack, etc.)
254+
- Node.js installation
255+
- Docker installation
256+
- Build processes and formatting tools
257+
- Tool version verification
258+
259+
**Why this matters:**
260+
261+
- Ensures documentation stays current with actual requirements
262+
- Prevents "command not found" errors for new developers
263+
- Tests across multiple platforms (Ubuntu 22.04, 24.04, macOS)
264+
- Catches environment drift and dependency changes
265+
- Runs nightly to detect breaking changes early
266+
267+
The tests are designed to run on-demand via labels to avoid slowing down regular
268+
development workflow, as they can take significant time to complete.
269+
221270
### Critical Pre-Commit Requirements
222271

223272
- **MANDATORY**: Run `make fix-trailing-whitespace` before every commit

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fix-trailing-whitespace: ## Remove trailing whitespaces from all files
103103
-not -path "./website/static/api-docs/*" \
104104
-not -path "./website/.docusaurus/*" \
105105
-not -path "./.git/*" \
106-
-exec sed -i 's/[[:space:]]*$$//' {} + && \
106+
-exec sed -i'' -e "s/[[:space:]]*$$//" {} + && \
107107
echo "Trailing whitespaces removed."
108108

109109
.PHONY: check-trailing-whitespace
@@ -139,7 +139,10 @@ clean: ## Clean build artifacts
139139
download-circuits: ## Download the circuits used by Mina from GitHub
140140
@if [ ! -d "circuit-blobs" ]; then \
141141
git clone --depth 1 https://github.com/openmina/circuit-blobs.git; \
142-
ln -s -b "$$PWD"/circuit-blobs/* ledger/; \
142+
ln -s "$$PWD"/circuit-blobs/3.0.0devnet ledger/; \
143+
ln -s "$$PWD"/circuit-blobs/3.0.0mainnet ledger/; \
144+
ln -s "$$PWD"/circuit-blobs/3.0.1devnet ledger/; \
145+
ln -s "$$PWD"/circuit-blobs/berkeley_rc1 ledger/; \
143146
else \
144147
echo "circuit-blobs already exists, skipping download."; \
145148
fi

website/docs/developers/getting-started.mdx

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ sidebar_position: 1
55
# Getting Started for Developers
66

77
import CodeBlock from "@theme/CodeBlock";
8+
import Tabs from "@theme/Tabs";
9+
import TabItem from "@theme/TabItem";
810
import InstallRustSh from "!!raw-loader!./scripts/setup/install-rust.sh";
911
import InstallSystemDepsSh from "!!raw-loader!./scripts/setup/install-system-deps.sh";
12+
import InstallSystemDepsMacOSSh from "!!raw-loader!./scripts/setup/install-system-deps-macos.sh";
1013
import InstallNodejsSh from "!!raw-loader!./scripts/setup/install-nodejs.sh";
14+
import InstallNodejsMacOSSh from "!!raw-loader!./scripts/setup/install-nodejs-macos.sh";
1115
import InstallDockerSh from "!!raw-loader!./scripts/setup/install-docker.sh";
16+
import InstallDockerMacOSSh from "!!raw-loader!./scripts/setup/install-docker-macos.sh";
1217
import InstallWasmToolsSh from "!!raw-loader!./scripts/setup/install-wasm-tools.sh";
1318
import CloneAndBuildSh from "!!raw-loader!./scripts/setup/clone-and-build.sh";
1419
import BuildSpecializedSh from "!!raw-loader!./scripts/setup/build-specialized.sh";
15-
import RunTestsSh from "!!raw-loader!./scripts/setup/run-tests.sh";
1620
import FormatAndLintSh from "!!raw-loader!./scripts/setup/format-and-lint.sh";
1721

1822
Welcome to OpenMina development! This guide will help you set up your
@@ -22,8 +26,10 @@ development environment and build OpenMina from source.
2226

2327
### System Requirements
2428

25-
- **Operating System**: Ubuntu 20.04+ or Debian 11+ (other Linux distributions
26-
may work but are not officially supported)
29+
- **Operating System**:
30+
- **Linux**: Ubuntu 20.04+ or Debian 11+ (other Linux distributions may work
31+
but are not officially supported)
32+
- **macOS**: macOS 12.0+ (Monterey or later)
2733
- **Memory**: At least 8GB RAM (16GB recommended)
2834
- **Storage**: At least 20GB free space
2935
- **Network**: Stable internet connection for downloading dependencies
@@ -32,24 +38,64 @@ development environment and build OpenMina from source.
3238

3339
#### 1. Rust Toolchain
3440

35-
OpenMina requires both stable and nightly Rust toolchains:
41+
OpenMina requires both stable and nightly Rust toolchains, plus additional tools
42+
for development:
3643

3744
<CodeBlock language="bash">{InstallRustSh}</CodeBlock>
3845

46+
This installs:
47+
48+
- Rust 1.84 (stable) and nightly toolchains
49+
- Required components: `rustfmt`, `clippy`, `rust-src`
50+
- `taplo-cli`: TOML formatter required for `make format`
51+
3952
#### 2. System Dependencies
4053

54+
<Tabs groupId="operating-systems">
55+
<TabItem value="linux" label="Linux (Ubuntu/Debian)">
56+
4157
<CodeBlock language="bash">{InstallSystemDepsSh}</CodeBlock>
4258

59+
</TabItem>
60+
<TabItem value="macos" label="macOS">
61+
62+
<CodeBlock language="bash">{InstallSystemDepsMacOSSh}</CodeBlock>
63+
64+
</TabItem>
65+
</Tabs>
66+
4367
#### 3. Additional Development Tools
4468

4569
**Node.js (for documentation and frontend):**
4670

71+
<Tabs groupId="operating-systems">
72+
<TabItem value="linux" label="Linux (Ubuntu/Debian)">
73+
4774
<CodeBlock language="bash">{InstallNodejsSh}</CodeBlock>
4875

76+
</TabItem>
77+
<TabItem value="macos" label="macOS">
78+
79+
<CodeBlock language="bash">{InstallNodejsMacOSSh}</CodeBlock>
80+
81+
</TabItem>
82+
</Tabs>
83+
4984
**Docker (optional, for containerized builds):**
5085

86+
<Tabs groupId="operating-systems">
87+
<TabItem value="linux" label="Linux (Ubuntu/Debian)">
88+
5189
<CodeBlock language="bash">{InstallDockerSh}</CodeBlock>
5290

91+
</TabItem>
92+
<TabItem value="macos" label="macOS">
93+
94+
<CodeBlock language="bash">{InstallDockerMacOSSh}</CodeBlock>
95+
96+
</TabItem>
97+
</Tabs>
98+
5399
#### 4. WASM Tools (for web node development)
54100

55101
<CodeBlock language="bash">{InstallWasmToolsSh}</CodeBlock>
@@ -69,7 +115,11 @@ components:
69115

70116
### 3. Run Tests
71117

72-
<CodeBlock language="bash">{RunTestsSh}</CodeBlock>
118+
You can run a different set of tests. The command `make help` will give you the
119+
whole set of targets. You can also visit the file
120+
[ci.yaml](https://github.com/o1-labs/openmina/blob/develop/.github/workflows/ci.yaml)
121+
to explore the targets used for testing in our continuous integration
122+
environment.
73123

74124
## Development Workflow
75125

@@ -108,12 +158,24 @@ make clean # Clean build artifacts
108158

109159
### Environment Configuration
110160

111-
Some components require environment variables:
161+
Some components require environment variables and database setup:
162+
163+
#### SQLite Database (Required for `make check`)
164+
165+
The heartbeats processor requires an SQLite database to be initialized before
166+
running `make check`:
112167

113168
```bash
114-
# For SQLx database operations (heartbeats processor)
169+
# Create the SQLite database with required schema
170+
sqlite3 /tmp/heartbeats.db < tools/heartbeats-processor/schema.sql
171+
172+
# Set the database URL environment variable
115173
export DATABASE_URL="sqlite:///tmp/heartbeats.db"
174+
```
116175

176+
#### Additional Environment Variables
177+
178+
```bash
117179
# For archive node development
118180
export OPENMINA_ARCHIVE_ADDRESS="http://localhost:3007"
119181
export PG_USER="openmina"

website/docs/developers/scripts/setup/format-and-lint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Set up SQLite database for heartbeats processor (required for make check/lint)
2+
echo "Setting up SQLite database for heartbeats processor..."
3+
sqlite3 /tmp/heartbeats.db < tools/heartbeats-processor/schema.sql
4+
export DATABASE_URL="sqlite:///tmp/heartbeats.db"
5+
16
# Format code (required before commits)
27
echo "Formatting code..."
38
make format
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Install Docker Desktop for Mac
2+
# Note: This requires manual download and installation
3+
echo "Docker Desktop for Mac needs to be installed manually."
4+
echo "Please download it from: https://www.docker.com/products/docker-desktop/"
5+
echo "Alternatively, you can use Homebrew Cask:"
6+
echo "brew install --cask docker"
7+
8+
# Install Docker via Homebrew Cask (user will need to start Docker Desktop manually)
9+
brew install --cask docker
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Install Node.js (version 18+ recommended) via Homebrew
2+
brew install node@18
3+
4+
# Link Node.js if needed
5+
brew link node@18

website/docs/developers/scripts/setup/install-rust.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ rustup install nightly
1515
rustup component add rustfmt clippy --toolchain 1.84
1616

1717
# Add required components for nightly
18-
rustup component add rustfmt clippy --toolchain nightly
18+
rustup component add rustfmt clippy rust-src --toolchain nightly
19+
20+
# Install taplo (TOML formatter, required for `make format`)
21+
cargo install taplo-cli --locked

0 commit comments

Comments
 (0)