Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/actions/frontend-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ inputs:
default: 'false'
node-version:
description: 'Node.js version to use'
required: false
default: '23'
required: true

runs:
using: 'composite'
Expand Down
18 changes: 18 additions & 0 deletions .github/actions/load-versions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ outputs:
ocaml-version:
description: "OCaml version"
value: ${{ steps.load.outputs.ocaml-version }}
node-version:
description: "Node.js version"
value: ${{ steps.load.outputs.node-version }}

runs:
using: composite
Expand All @@ -25,18 +28,33 @@ runs:
RUST_STABLE=$(yq eval '.rust.stable' "$VERSIONS_FILE")
RUST_NIGHTLY=$(yq eval '.rust.nightly' "$VERSIONS_FILE")
OCAML_VERSION=$(yq eval '.ocaml.version' "$VERSIONS_FILE")
NODE_VERSION_YAML=$(yq eval '.node.version' "$VERSIONS_FILE")

# Read node version from .nvmrc
NODE_VERSION_NVMRC=$(cat .nvmrc)

# Verify that the versions match
if [ "$NODE_VERSION_YAML" != "$NODE_VERSION_NVMRC" ]; then
echo "Error: Node.js version mismatch!"
echo " .github/config/versions.yaml: $NODE_VERSION_YAML"
echo " .nvmrc: $NODE_VERSION_NVMRC"
exit 1
fi

# Set outputs
echo "rust-stable=$RUST_STABLE" >> $GITHUB_OUTPUT
echo "rust-nightly=$RUST_NIGHTLY" >> $GITHUB_OUTPUT
echo "ocaml-version=$OCAML_VERSION" >> $GITHUB_OUTPUT
echo "node-version=$NODE_VERSION_YAML" >> $GITHUB_OUTPUT

# Also set as environment variables for convenience
echo "RUST_STABLE_VERSION=$RUST_STABLE" >> $GITHUB_ENV
echo "RUST_NIGHTLY_VERSION=$RUST_NIGHTLY" >> $GITHUB_ENV
echo "OCAML_VERSION=$OCAML_VERSION" >> $GITHUB_ENV
echo "NODE_VERSION=$NODE_VERSION_YAML" >> $GITHUB_ENV

echo "Loaded versions:"
echo " Rust stable: $RUST_STABLE"
echo " Rust nightly: $RUST_NIGHTLY"
echo " OCaml: $OCAML_VERSION"
echo " Node.js: $NODE_VERSION_YAML"
3 changes: 3 additions & 0 deletions .github/config/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ rust:

ocaml:
version: "4.14.2"

node:
version: "24.11.0"
18 changes: 12 additions & 6 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
pull_request:
workflow_dispatch:

env:
NODE_VERSION: '20'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand All @@ -25,10 +22,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ steps.versions.outputs.node-version }}
cache: 'npm'
cache-dependency-path: website/package-lock.json

Expand Down Expand Up @@ -109,10 +109,13 @@ jobs:
- name: Setup Pages
uses: actions/configure-pages@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ steps.versions.outputs.node-version }}
cache: 'npm'
cache-dependency-path: website/package-lock.json

Expand Down Expand Up @@ -158,10 +161,13 @@ jobs:
with:
fetch-depth: 0

- id: versions
uses: ./.github/actions/load-versions

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ steps.versions.outputs.node-version }}
cache: 'npm'
cache-dependency-path: website/package-lock.json

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/frontend-macos-13.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
- name: Git checkout
uses: actions/checkout@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Frontend build
uses: ./.github/actions/frontend-build
with:
node-version: ${{ steps.versions.outputs.node-version }}
test-build-commands: 'true'
4 changes: 4 additions & 0 deletions .github/workflows/frontend-macos-14.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
- name: Git checkout
uses: actions/checkout@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Frontend build
uses: ./.github/actions/frontend-build
with:
node-version: ${{ steps.versions.outputs.node-version }}
test-build-commands: 'true'
4 changes: 4 additions & 0 deletions .github/workflows/frontend-macos-15.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
- name: Git checkout
uses: actions/checkout@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Frontend build
uses: ./.github/actions/frontend-build
with:
node-version: ${{ steps.versions.outputs.node-version }}
test-build-commands: 'true'
4 changes: 4 additions & 0 deletions .github/workflows/frontend-macos-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
- name: Git checkout
uses: actions/checkout@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Frontend build
uses: ./.github/actions/frontend-build
with:
node-version: ${{ steps.versions.outputs.node-version }}
test-build-commands: 'true'
4 changes: 4 additions & 0 deletions .github/workflows/frontend-ubuntu-22-04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
- name: Git checkout
uses: actions/checkout@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Frontend build
uses: ./.github/actions/frontend-build
with:
node-version: ${{ steps.versions.outputs.node-version }}
test-build-commands: 'true'
4 changes: 4 additions & 0 deletions .github/workflows/frontend-ubuntu-24-04-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
- name: Git checkout
uses: actions/checkout@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Frontend build
uses: ./.github/actions/frontend-build
with:
node-version: ${{ steps.versions.outputs.node-version }}
test-build-commands: 'true'
4 changes: 4 additions & 0 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ jobs:
- name: Git checkout
uses: actions/checkout@v5

- id: versions
uses: ./.github/actions/load-versions

- name: Frontend build and test
uses: ./.github/actions/frontend-build
with:
node-version: ${{ steps.versions.outputs.node-version }}
run-prettier-check: 'true'
run-tests: 'true'
test-build-commands: 'false'
43 changes: 9 additions & 34 deletions .github/workflows/test-docs-scripts-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,19 @@ jobs:
run: |
chmod +x website/docs/developers/scripts/frontend/*.sh

- name: Install Node.js on Linux
if: runner.os == 'Linux'
run: |
bash website/docs/developers/scripts/frontend/install-nodejs-linux.sh
# Set up nvm environment for future steps
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- name: Load versions
id: versions
uses: ./.github/actions/load-versions

- name: Install Node.js on macOS
if: runner.os == 'macOS'
run: |
bash website/docs/developers/scripts/frontend/install-nodejs-macos.sh
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ steps.versions.outputs.node-version }}
cache: 'npm'
cache-dependency-path: website/package-lock.json

- name: Install Angular CLI using documentation script
run: |
# Source nvm if available (Linux)
if [ -n "$NVM_DIR" ] && [ -s "$NVM_DIR/nvm.sh" ]; then
\. "$NVM_DIR/nvm.sh"
fi
bash website/docs/developers/scripts/frontend/install-angular-cli.sh

- name: Install gtimeout on macOS
Expand All @@ -63,42 +58,22 @@ jobs:

- name: Test install dependencies script
run: |
# Source nvm if available (Linux)
if [ -n "$NVM_DIR" ] && [ -s "$NVM_DIR/nvm.sh" ]; then
\. "$NVM_DIR/nvm.sh"
fi
bash website/docs/developers/scripts/frontend/install-dependencies.sh

- name: Test build production script
run: |
# Source nvm if available (Linux)
if [ -n "$NVM_DIR" ] && [ -s "$NVM_DIR/nvm.sh" ]; then
\. "$NVM_DIR/nvm.sh"
fi
bash website/docs/developers/scripts/frontend/build-production.sh

- name: Test format code script
run: |
# Source nvm if available (Linux)
if [ -n "$NVM_DIR" ] && [ -s "$NVM_DIR/nvm.sh" ]; then
\. "$NVM_DIR/nvm.sh"
fi
bash website/docs/developers/scripts/frontend/format-code.sh

- name: Test build leaderboard script
run: |
# Source nvm if available (Linux)
if [ -n "$NVM_DIR" ] && [ -s "$NVM_DIR/nvm.sh" ]; then
\. "$NVM_DIR/nvm.sh"
fi
bash website/docs/developers/scripts/frontend/build-leaderboard.sh

- name: Test build webnode script
run: |
# Source nvm if available (Linux)
if [ -n "$NVM_DIR" ] && [ -s "$NVM_DIR/nvm.sh" ]; then
\. "$NVM_DIR/nvm.sh"
fi
bash website/docs/developers/scripts/frontend/build-webnode.sh

- name: Prepare for Cypress tests (Ubuntu 22.04)
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.11.0
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# - ./github/workflows/fmt.yaml
# - ./github/workflows/lint.yaml
NIGHTLY_RUST_VERSION = "nightly"
NODE_VERSION := $(shell cat .nvmrc)

# WebAssembly
WASM_BINDGEN_CLI_VERSION = "0.2.99"
Expand Down Expand Up @@ -394,6 +395,7 @@ docker-build-frontend: ## Build frontend Docker image
esac; \
echo "Building for platform: $$PLATFORM"; \
docker buildx build \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--platform $$PLATFORM \
--tag $(DOCKER_ORG)/mina-rust-frontend:$(GIT_COMMIT) \
--file ./frontend/Dockerfile \
Expand Down
30 changes: 22 additions & 8 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ COPY --from=build_wasm /workspace/pkg ./
# Final stage - Apache with source code and build capability
FROM httpd:2.4 AS final

# Set environment variables for Node.js version
ARG NODE_VERSION
ENV NODE_VERSION=${NODE_VERSION}

# Install system dependencies required for Node.js and build tools
# hadolint ignore=DL3008
RUN apt-get update && \
Expand All @@ -96,18 +100,28 @@ RUN apt-get update && \
ca-certificates \
gnupg \
make \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy documentation scripts for Node.js setup
COPY ./website/docs/developers/scripts/frontend/install-nodejs-linux.sh ./scripts/install-nodejs-linux.sh
COPY ./website/docs/developers/scripts/frontend/install-angular-cli.sh ./scripts/install-angular-cli.sh
# Add NodeSource GPG key and repository and install Node.js
RUN bash -c " \
export NODE_MAJOR=$(echo ${NODE_VERSION} | cut -d. -f1); \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
echo \"deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$${NODE_MAJOR}.x nodistro main\" | tee /etc/apt/sources.list.d/nodesource.list; \
apt-get update; \
apt-get install -y nodejs; \
"

# Install Node.js and Angular CLI using documentation scripts
RUN chmod +x ./scripts/*.sh && \
bash ./scripts/install-nodejs-linux.sh && \
bash -c 'source "$HOME/.nvm/nvm.sh" && bash ./scripts/install-angular-cli.sh'
# Add Node.js to PATH
ENV PATH="/usr/local/bin:${PATH}"

# Install Angular CLI
COPY ./website/docs/developers/scripts/frontend/install-angular-cli.sh ./scripts/install-angular-cli.sh
RUN chmod +x ./scripts/install-angular-cli.sh && \
./scripts/install-angular-cli.sh

# Copy entire frontend source code and Makefile
COPY frontend/ ./frontend/
Expand All @@ -130,7 +144,7 @@ RUN chmod +x /usr/local/bin/startup.sh && \

# Install frontend dependencies using Makefile
WORKDIR /app/frontend
RUN bash -c 'source "$HOME/.nvm/nvm.sh" && make install-deps'
RUN make install-deps

WORKDIR /app

Expand Down
3 changes: 3 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"tests:headless": "make test-headless"
},
"private": true,
"engines": {
"node": "^24.0.0"
},
"dependencies": {
"@angular/animations": "^19.2.14",
"@angular/cdk": "^19.2.19",
Expand Down
Loading
Loading