Skip to content

workflow: added github workflow automated linux-arm64 builds via native arm runners #16093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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
83 changes: 83 additions & 0 deletions .github/workflows/build-linux-arm64-solc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build Solidity ARM64 Binary
run-name: Build solc-linux-arm64-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || 'develop' }}

on:
workflow_dispatch:
inputs:
version:
description: 'Solidity version to build (e.g., v0.8.24)'
required: false
default: 'v0.8.24'
type: string
# push:
# branches: [ develop ]
# pull_request:
# branches: [ develop ]

jobs:
build-arm64:
runs-on: ubuntu-24.04-arm # Native ARM runner

steps:
- name: Determine version to build
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="develop"
fi
echo "Building version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT

# Extract clean version for filename (remove 'v' prefix if present)
CLEAN_VERSION=$(echo "$VERSION" | sed 's/^v//')
echo "clean_version=$CLEAN_VERSION" >> $GITHUB_OUTPUT

- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ steps.version.outputs.version }}

# No QEMU needed - we're on native ARM!

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Apply cross-compilation patches
run: |
echo "Patching missing includes for cross-compilation..."
sed -i '/#include <string>/a #include <cstdint>' liblangutil/Token.h

- name: Build ARM64 binary
run: |
# Build directly on ARM - no platform specification needed
docker build \
-t solc-arm64:latest \
-f scripts/Dockerfile \
.

- name: Extract and rename binary
run: |
# Create container and extract binary
docker create --name temp-container solc-arm64:latest
docker cp temp-container:/usr/bin/solc ./solc-temp
docker rm temp-container

# Rename binary with version
BINARY_NAME="solc-linux-arm64-v${{ steps.version.outputs.clean_version }}"
mv ./solc-temp "./$BINARY_NAME"

# Make it executable
chmod +x "./$BINARY_NAME"

# Display file info
echo "Binary created: $BINARY_NAME"
ls -la "./$BINARY_NAME"
file "./$BINARY_NAME"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: solc-linux-arm64-v${{ steps.version.outputs.clean_version }}
path: solc-linux-arm64-v${{ steps.version.outputs.clean_version }}
85 changes: 85 additions & 0 deletions .github/workflows/build-qemu-linux-arm64-solc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build Solidity ARM64 Binary (QEMU + x86 runners)
run-name: Build solc-linux-arm64-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || 'develop' }}

on:
workflow_dispatch:
inputs:
version:
description: 'Solidity version to build (e.g., v0.8.24)'
required: false
default: 'v0.8.24'
type: string
# push:
# branches: [ develop ]
# pull_request:
# branches: [ develop ]

jobs:
build-arm64:
runs-on: ubuntu-latest

steps:
- name: Determine version to build
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="develop"
fi
echo "Building version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT

# Extract clean version for filename (remove 'v' prefix if present)
CLEAN_VERSION=$(echo "$VERSION" | sed 's/^v//')
echo "clean_version=$CLEAN_VERSION" >> $GITHUB_OUTPUT

- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ steps.version.outputs.version }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Apply cross-compilation patches
run: |
echo "Patching missing includes for cross-compilation..."
sed -i '/#include <string>/a #include <cstdint>' liblangutil/Token.h

- name: Build ARM64 binary
run: |
docker buildx build \
--platform linux/arm64 \
--load \
-t solc-arm64:latest \
-f scripts/Dockerfile \
.

- name: Extract and rename binary
run: |
# Create container and extract binary
docker create --name temp-container solc-arm64:latest
docker cp temp-container:/usr/bin/solc ./solc-temp
docker rm temp-container

# Rename binary with version
BINARY_NAME="solc-linux-arm64-v${{ steps.version.outputs.clean_version }}"
mv ./solc-temp "./$BINARY_NAME"

# Make it executable
chmod +x "./$BINARY_NAME"

# Display file info
echo "Binary created: $BINARY_NAME"
ls -la "./$BINARY_NAME"
file "./$BINARY_NAME"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: solc-linux-arm64-v${{ steps.version.outputs.clean_version }}
path: solc-linux-arm64-v${{ steps.version.outputs.clean_version }}