Skip to content
Merged
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"
6 changes: 6 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ jobs:
- name: Git checkout
uses: actions/checkout@v5

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

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand All @@ -108,6 +112,8 @@ jobs:
context: ./
file: ./frontend/Dockerfile
platforms: ${{ matrix.arch.platform }}
build-args: |
NODE_VERSION=${{ steps.versions.outputs.node-version }}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,name=${{ env.REGISTRY_FRONTEND_IMAGE }},push-by-digest=true,name-canonical=true,push=true
Expand Down
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'
39 changes: 9 additions & 30 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,34 +58,18 @@ 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 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
36 changes: 28 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,34 @@ 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
# Fail the build if any command in a pipe fails
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Download and install Node.js with checksum verification
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then ARCH="x64"; fi && \
if [ "$ARCH" = "aarch64" ]; then ARCH="arm64"; fi && \
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" -o node.tar.xz && \
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt" -o SHASUMS256.txt && \
grep "node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" SHASUMS256.txt | awk '{print $1 " node.tar.xz"}' | sha256sum -c - && \
tar -xJf node.tar.xz && \
cp -r "node-v${NODE_VERSION}-linux-${ARCH}"/* /usr/local/ && \
rm node.tar.xz && \
rm -r "node-v${NODE_VERSION}-linux-${ARCH}" && \
rm SHASUMS256.txt

# 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

# 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'
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 +150,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
2 changes: 1 addition & 1 deletion frontend/docker/generate-docker-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ echo "- Message: $GIT_COMMIT_MESSAGE"
echo "- Build Time: $BUILD_TIMESTAMP"
echo "- Rust Channel: $RUSTC_CHANNEL"
echo "- Rust Version: $RUSTC_SEMVER"
echo "- Target: $CARGO_TARGET_TRIPLE"
echo "- Target: $CARGO_TARGET_TRIPLE"
3 changes: 3 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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