Skip to content

Commit 1d52355

Browse files
committed
Create two workflows for creating solc-linux-arm64 for user-defined solc versions
1 parent b04a46b commit 1d52355

File tree

2 files changed

+168
-0
lines changed

2 files changed

+168
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build Solidity ARM64 Binary
2+
run-name: Build solc-linux-arm64-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || 'develop' }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Solidity version to build (e.g., v0.8.24)'
9+
required: false
10+
default: 'v0.8.24'
11+
type: string
12+
# push:
13+
# branches: [ develop ]
14+
# pull_request:
15+
# branches: [ develop ]
16+
17+
jobs:
18+
build-arm64:
19+
runs-on: ubuntu-24.04-arm # Native ARM runner
20+
21+
steps:
22+
- name: Determine version to build
23+
id: version
24+
run: |
25+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
26+
VERSION="${{ github.event.inputs.version }}"
27+
else
28+
VERSION="develop"
29+
fi
30+
echo "Building version: $VERSION"
31+
echo "version=$VERSION" >> $GITHUB_OUTPUT
32+
33+
# Extract clean version for filename (remove 'v' prefix if present)
34+
CLEAN_VERSION=$(echo "$VERSION" | sed 's/^v//')
35+
echo "clean_version=$CLEAN_VERSION" >> $GITHUB_OUTPUT
36+
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
with:
40+
ref: ${{ steps.version.outputs.version }}
41+
42+
# No QEMU needed - we're on native ARM!
43+
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
47+
- name: Apply cross-compilation patches
48+
run: |
49+
echo "Patching missing includes for cross-compilation..."
50+
sed -i '/#include <string>/a #include <cstdint>' liblangutil/Token.h
51+
52+
- name: Build ARM64 binary
53+
run: |
54+
# Build directly on ARM - no platform specification needed
55+
docker build \
56+
-t solc-arm64:latest \
57+
-f scripts/Dockerfile \
58+
.
59+
60+
- name: Extract and rename binary
61+
run: |
62+
# Create container and extract binary
63+
docker create --name temp-container solc-arm64:latest
64+
docker cp temp-container:/usr/bin/solc ./solc-temp
65+
docker rm temp-container
66+
67+
# Rename binary with version
68+
BINARY_NAME="solc-linux-arm64-v${{ steps.version.outputs.clean_version }}"
69+
mv ./solc-temp "./$BINARY_NAME"
70+
71+
# Make it executable
72+
chmod +x "./$BINARY_NAME"
73+
74+
# Display file info
75+
echo "Binary created: $BINARY_NAME"
76+
ls -la "./$BINARY_NAME"
77+
file "./$BINARY_NAME"
78+
79+
- name: Upload artifact
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: solc-linux-arm64-v${{ steps.version.outputs.clean_version }}
83+
path: solc-linux-arm64-v${{ steps.version.outputs.clean_version }}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build Solidity ARM64 Binary (QEMU + x86 runners)
2+
run-name: Build solc-linux-arm64-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || 'develop' }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Solidity version to build (e.g., v0.8.24)'
9+
required: false
10+
default: 'v0.8.24'
11+
type: string
12+
# push:
13+
# branches: [ develop ]
14+
# pull_request:
15+
# branches: [ develop ]
16+
17+
jobs:
18+
build-arm64:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Determine version to build
23+
id: version
24+
run: |
25+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
26+
VERSION="${{ github.event.inputs.version }}"
27+
else
28+
VERSION="develop"
29+
fi
30+
echo "Building version: $VERSION"
31+
echo "version=$VERSION" >> $GITHUB_OUTPUT
32+
33+
# Extract clean version for filename (remove 'v' prefix if present)
34+
CLEAN_VERSION=$(echo "$VERSION" | sed 's/^v//')
35+
echo "clean_version=$CLEAN_VERSION" >> $GITHUB_OUTPUT
36+
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
with:
40+
ref: ${{ steps.version.outputs.version }}
41+
42+
- name: Set up QEMU
43+
uses: docker/setup-qemu-action@v3
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- name: Apply cross-compilation patches
49+
run: |
50+
echo "Patching missing includes for cross-compilation..."
51+
sed -i '/#include <string>/a #include <cstdint>' liblangutil/Token.h
52+
53+
- name: Build ARM64 binary
54+
run: |
55+
docker buildx build \
56+
--platform linux/arm64 \
57+
--load \
58+
-t solc-arm64:latest \
59+
-f scripts/Dockerfile \
60+
.
61+
62+
- name: Extract and rename binary
63+
run: |
64+
# Create container and extract binary
65+
docker create --name temp-container solc-arm64:latest
66+
docker cp temp-container:/usr/bin/solc ./solc-temp
67+
docker rm temp-container
68+
69+
# Rename binary with version
70+
BINARY_NAME="solc-linux-arm64-v${{ steps.version.outputs.clean_version }}"
71+
mv ./solc-temp "./$BINARY_NAME"
72+
73+
# Make it executable
74+
chmod +x "./$BINARY_NAME"
75+
76+
# Display file info
77+
echo "Binary created: $BINARY_NAME"
78+
ls -la "./$BINARY_NAME"
79+
file "./$BINARY_NAME"
80+
81+
- name: Upload artifact
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: solc-linux-arm64-v${{ steps.version.outputs.clean_version }}
85+
path: solc-linux-arm64-v${{ steps.version.outputs.clean_version }}

0 commit comments

Comments
 (0)