Skip to content

Commit

Permalink
Refactor Linux build workflow for ARM64 only
Browse files Browse the repository at this point in the history
  • Loading branch information
Liz Jeong authored and Liz Jeong committed Jul 18, 2024
1 parent 4db28da commit ddc7b9f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 48 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/build-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,12 @@ on:
jobs:
build-linux-amd64:
uses: ./.github/workflows/build-linux-amd64.yml
with:
arch: amd64
secrets: inherit

build-linux-arm64:
uses: ./.github/workflows/build-linux-arm64.yml
with:
arch: arm64
secrets: inherit

build-darwin-amd64:
uses: ./.github/workflows/build-darwin-amd64.yml
# with:
# arch: amd64
secrets: inherit

build-darwin-arm64:
uses: ./.github/workflows/build-darwin-arm64.yml
# with:
# arch: arm64
secrets: inherit
uses: ./.github/workflows/build-darwin-arm64.yml
6 changes: 2 additions & 4 deletions .github/workflows/build-darwin-amd64.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Build Darwin AMD64

on:
workflow_call:
# inputs:
# arch:
# required: true
# type: string

jobs:
build:
runs-on: macos-13
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/build-darwin-arm64.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Build Darwin ARM64

on:
workflow_call:
# inputs:
# arch:
# required: true
# type: string

jobs:
build:
runs-on: macos-latest
Expand All @@ -21,8 +19,6 @@ jobs:
run: |
L1_NETWORK_NAME="initiation-1"
echo "L1_NETWORK_NAME=${L1_NETWORK_NAME}" >> $GITHUB_ENV
# Read MOVEVM_VERSION from config file
# MOVEVM_VERSION=$(grep MOVEVM_VERSION $GITHUB_WORKSPACE/.github/workflows/config | cut -d '=' -f2)
MOVEVM_VERSION=$(go list -m github.com/initia-labs/movevm | awk '{print $2}')
echo "MOVEVM_VERSION=${MOVEVM_VERSION}" >> $GITHUB_ENV
echo "GOARCH=arm64" >> $GITHUB_ENV
Expand Down
16 changes: 3 additions & 13 deletions .github/workflows/build-linux-amd64.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Build Linux AMD64

on:
workflow_call:
inputs:
arch:
required: true
type: string
workflow_call

jobs:
build:
Expand All @@ -21,21 +17,15 @@ jobs:

- name: Set environment variables
run: |
echo "GOARCH=${{ inputs.arch }}" >> $GITHUB_ENV
echo "GOARCH=amd64" >> $GITHUB_ENV
echo "GOOS=linux" >> $GITHUB_ENV
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION="v0.0.0-${GITHUB_SHA::8}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
if [ "${{ inputs.arch }}" == "amd64" ]; then
echo "ARCH_NAME=x86_64" >> $GITHUB_ENV
elif [ "${{ inputs.arch }}" == "arm64" ]; then
echo "ARCH_NAME=aarch64" >> $GITHUB_ENV
else
echo "ARCH_NAME=${{ inputs.arch }}" >> $GITHUB_ENV
fi
echo "ARCH_NAME=x86_64" >> $GITHUB_ENV
- name: Print environment variables
run: |
Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/build-linux-arm64.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Build Linux ARM64

on:
workflow_call:
inputs:
arch:
required: true
type: string

jobs:
build:
Expand All @@ -25,21 +22,15 @@ jobs:

- name: Set environment variables
run: |
echo "GOARCH=${{ inputs.arch }}" >> $GITHUB_ENV
echo "GOARCH=arm64" >> $GITHUB_ENV
echo "GOOS=linux" >> $GITHUB_ENV
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION="v0.0.0-${GITHUB_SHA::8}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
if [ "${{ inputs.arch }}" == "amd64" ]; then
echo "ARCH_NAME=x86_64" >> $GITHUB_ENV
elif [ "${{ inputs.arch }}" == "arm64" ]; then
echo "ARCH_NAME=aarch64" >> $GITHUB_ENV
else
echo "ARCH_NAME=${{ inputs.arch }}" >> $GITHUB_ENV
fi
echo "ARCH_NAME=aarch64" >> $GITHUB_ENV
- name: Build for ARM64
env:
Expand Down

0 comments on commit ddc7b9f

Please sign in to comment.