Skip to content

added build for macos arm64 #918

added build for macos arm64

added build for macos arm64 #918

Workflow file for this run

name: build-zbox
on:
push:
branches:
- master
- sprint*
- staging
tags:
- 'v*.*.*'
pull_request:
workflow_dispatch:
jobs:
build-linux:
name: Build-linux
runs-on: [self-hosted, arc-runner]
steps:
- name: Install deps
run: |
sudo apt update
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev containerd docker.io
- name: Checkout
uses: actions/checkout@v4
- name: Setup gopath and gocache
run: |
echo "GOPATH=$HOME/go" >> $GITHUB_ENV
echo "GOCACHE=$GITHUB_WORKSPACE/.gocache" >> $GITHUB_ENV
- name: Setup go 1.21
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install
run: |
lsb_release -a
make install
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: zbox-linux
path: zbox
retention-days: 5
build-windows:
name: Build-windows
runs-on: windows-runner
defaults:
run:
shell: msys2 {0}
strategy:
matrix:
sys: [ MINGW64 ]
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
- name: Install libraries
run: |
echo 'Y'| pacman -S base-devel git gcc make
- name: Install Clang and Go for MINGW64
run: |
echo 'y'| pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-go zip unzip
- name: Set environment variables
run: |
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
export PATH=$PATH:$GOROOT/bin
export PATH=$PATH:/usr/bin/7z
# use clang as a default compiler for CGO
go env -w "CC=/mingw64/bin/clang.exe"
- name: Checkout
uses: actions/checkout@v4
- name: Install
run: make install
- name: Zip release
run: |
# download dll files
wget https://github.com/0chain/zboxcli/files/11840033/windows.dll.s.zip
unzip -o windows.dll.s.zip
cp zbox zbox.exe
zip zbox-windows.zip zbox.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: zbox-windows.zip
path: zbox-windows.zip
retention-days: 5
- name: cleanup workspace
run: |
rm -Recurse ${{github.workspace}}\*
shell: powershell
build-macos-amd64:
name: Build-macos-amd64
runs-on: macos-runner
steps:
- name: Setup go 1.21
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Checkout
uses: actions/checkout@v4
- name: Install
run: make install
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: zbox-macos-amd64
path: zbox
retention-days: 5
- name: cleanup workspace
run: |
rm -rf ./*
build-macos-arm64:
name: Build-macos-arm64
runs-on: macos-runner
env:
SRC_DIR: ${{ github.workspace }}/src
OUTPUT_DIR: ${{ github.workspace }}/output
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: ${{ env.SRC_DIR }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Setup
run : |
mkdir -p ${{ env.OUTPUT_DIR }}/arm64
cp ${{ env.SRC_DIR }}/cmd/config.yaml ${{ env.OUTPUT_DIR }}/arm64/
- name: Build macos for arm64
run: |
cd ${{ env.SRC_DIR }}
CGO_ENABLED=1 CGO_CFLAGS="-mmacosx-version-min=12.0" CGO_LDFLAGS="-mmacosx-version-min=12.0" GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -x -v -tags bn256 -ldflags "-X main.VersionStr=v${{ env.VERSION }}" -o ${{ env.OUTPUT_DIR }}/arm64/macos-arm64 .
- name: Create Zip File for darwin/arm64
run: |
cd ${{ env.OUTPUT_DIR }}/arm64
zip -qq -r macos-arm64-darwin-arm64.zip macos-arm64 config.yaml
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: zbox-macos-arm64
path: ${{ env.OUTPUT_DIR }}/arm64/macos-arm64-darwin-arm64.zip
retention-days: 5
- name: cleanup workspace
run: |
rm -rf ./*