|
| 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 }} |
0 commit comments