update github action (#294)

* update github action

Co-authored-by: sophoah <sophoah@gmail.com>
dependabot/go_modules/golang.org/x/crypto-0.1.0
Soph 2 years ago committed by GitHub
parent 6de63a336d
commit 5d91d48bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 160
      .github/workflows/hmybuild.yml
  2. 86
      .github/workflows/test-build.yml

@ -5,66 +5,48 @@ on:
tags:
- v*
jobs:
env:
GOPATH: ${{ github.workspace }}
GOBIN: ${{ github.workspace }}/bin
build-x8664:
name: Build hmy binary for Linux x8664
jobs:
build-x86_64:
name: Build hmy binary for x86_64
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-18.04 ]
os: [ ubuntu-18.04, macos-latest ]
steps:
- name: Set up Go 1.16.5
uses: actions/setup-go@v2
with:
go-version: 1.16.5
- name: Checkout hmy code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: go/src/github.com/harmony-one/go-sdk
path: go-sdk
- name: Debug
run: |
pwd
echo ${HOME}
echo ${GITHUB_WORKSPACE}
echo ${GOPATH}
echo ${GOROOT}
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go-sdk/go.mod
- name: Checkout dependence repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: harmony-one/mcl
path: go/src/github.com/harmony-one/mcl
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
path: ${{ github.workspace }}/src/github.com/harmony-one/mcl
- name: Checkout dependence repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: harmony-one/bls
path: go/src/github.com/harmony-one/bls
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
path: ${{ github.workspace }}/src/github.com/harmony-one/bls
- name: Checkout dependence code
uses: actions/checkout@v2
with:
repository: harmony-one/harmony
path: go/src/github.com/harmony-one/harmony
path: ${{ github.workspace }}/src/github.com/harmony-one/harmony
ref: main
fetch-depth: 0
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
- name: Get latest version and release
run: |
@ -72,26 +54,45 @@ jobs:
RELEASE=$(git describe --long | cut -f2 -d-)
echo "build_version=$VERSION" >> $GITHUB_ENV
echo "build_release=$RELEASE" >> $GITHUB_ENV
working-directory: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
working-directory: go-sdk
- name: Debug
run: |
pwd
echo ${HOME}
echo ${GITHUB_WORKSPACE}
echo ${GOPATH}
echo ${GOROOT}
- name: Build hmy binary for Linux
if: matrix.os == 'ubuntu-18.04'
run: |
make static
working-directory: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
working-directory: go-sdk
- name: Build libs for macos-latest
if: matrix.os == 'macos-latest'
run: |
brew install gmp
brew install openssl
sudo ln -sf /opt/homebrew/opt/openssl@3 /usr/local/opt/openssl
echo "ls -l /usr/local/opt/"; ls -l /usr/local/opt/
make libs
working-directory: ${{ github.workspace }}/src/github.com/harmony-one/harmony
- name: Build hmy binary for macos-latest x86_64
if: matrix.os == 'macos-latest'
run: |
make all
mv dist/hmy dist/hmy-darwin-x86_64
working-directory: go-sdk
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: hmy
path: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk/dist/*
path: ${{ github.workspace }}/go-sdk/dist/*
retention-days: 1
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
# build-arm64:
# name: Build hmy binary
@ -169,9 +170,8 @@ jobs:
release-page:
name: Sign binary and create and publish release page
needs: [ build-x8664 ]
needs: [ build-x86_64 ]
runs-on: ubuntu-18.04
steps:
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3
@ -180,12 +180,9 @@ jobs:
passphrase: ${{ secrets.HMY_GPG_PRIVATE_KEY_PASS }}
- name: Checkout hmy core code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: go/src/github.com/harmony-one/go-sdk
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
path: go-sdk
- name: Get latest version
run: |
@ -195,87 +192,59 @@ jobs:
echo "build_version=$VERSION" >> $GITHUB_ENV
echo "build_version_long=$VERSION_LONG" >> $GITHUB_ENV
echo "build_release=$RELEASE" >> $GITHUB_ENV
working-directory: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
env:
GOPATH: /home/runner/work/go-sdk/go-sdk/go
working-directory: go-sdk
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: hmy
- name: Signed amd64 hmy binary
run: |
gpg --detach-sign hmy
sha256sum hmy >> hmy.sha256
# - name: Download artifact
# uses: actions/download-artifact@v2
# with:
# name: hmy-arm64
# - name: Signed arm64 hmy binary
# run: |
# gpg --detach-sign hmy-arm64
# sha256sum hmy-arm64 >> hmy-arm64.sha256
- name: Display structure of downloaded files
run: ls -R
- name: Signed darwin x86_64 hmy binary
run: |
gpg --detach-sign hmy-darwin-x86_64
sha256sum hmy-darwin-x86_64 >> hmy-darwin-x86_64.sha256
- name: Get tag message
env:
TAG_SHA: ${{ github.event.after }}
GOPATH: /home/runner/work/go-sdk/go
run: |
touch ./tag_message.md
echo -e "$TAG_SHA\n\nThe released version: $build_version_long" >> ./tag_message.md
working-directory: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk
working-directory: go-sdk
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /home/runner/work/go-sdk/go-sdk/go
with:
tag_name: ${{ github.ref }}
release_name: Mainnet Release ${{ env.build_version }}
draft: true
prerelease: false
body_path: /home/runner/work/go-sdk/go-sdk/go/src/github.com/harmony-one/go-sdk/tag_message.md
body_path: ${{ github.workspace }}/go-sdk/tag_message.md
- name: Upload hmy binary for Linux (amd64)
- name: Upload hmy binary for Linux (x86_64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /home/runner/work/go-sdk/go-sdk/go
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hmy
asset_name: hmy
asset_content_type: application/octet-stream
- name: Upload sha256 signature of hmy amd64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hmy.sha256
asset_name: hmy.sha256
asset_content_type: text/plain
- name: Upload gpg signature of hmy amd64 binary
- name: Upload hmy binary darwin-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hmy.sig
asset_name: hmy.sig
asset_path: ./hmy-darwin-x86_64
asset_name: hmy-darwin-x86_64
asset_content_type: application/octet-stream
@ -309,8 +278,3 @@ jobs:
# asset_path: ./hmy-arm64.sig
# asset_name: hmy-arm64.sig
# asset_content_type: application/octet-stream

@ -0,0 +1,86 @@
name: test build
on:
push:
env:
GOPATH: ${{ github.workspace }}
GOBIN: ${{ github.workspace }}/bin
jobs:
build-x86_64:
name: Build hmy binary for x86_64
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-18.04, macos-latest ]
steps:
- name: Checkout hmy code
uses: actions/checkout@v3
with:
path: go-sdk
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go-sdk/go.mod
- name: Checkout dependence repo
uses: actions/checkout@v3
with:
repository: harmony-one/mcl
path: ${{ github.workspace }}/src/github.com/harmony-one/mcl
- name: Checkout dependence repo
uses: actions/checkout@v3
with:
repository: harmony-one/bls
path: ${{ github.workspace }}/src/github.com/harmony-one/bls
- name: Checkout dependence code
uses: actions/checkout@v2
with:
repository: harmony-one/harmony
path: ${{ github.workspace }}/src/github.com/harmony-one/harmony
ref: main
fetch-depth: 0
- name: Get latest version and release
run: |
VERSION=$(git tag -l --sort=-v:refname | head -n 1 | tr -d v)
RELEASE=$(git describe --long | cut -f2 -d-)
echo "build_version=$VERSION" >> $GITHUB_ENV
echo "build_release=$RELEASE" >> $GITHUB_ENV
working-directory: go-sdk
- name: Debug
run: |
pwd
echo ${HOME}
echo ${GITHUB_WORKSPACE}
echo ${GOPATH}
echo ${GOROOT}
ls ${{ github.workspace }}/src/github.com/harmony-one/
- name: Build hmy binary for linux ubuntu
if: matrix.os == 'ubuntu-18.04'
run: |
make static
working-directory: go-sdk
- name: Build libs for macos-latest
if: matrix.os == 'macos-latest'
run: |
brew install gmp
brew install openssl
sudo ln -sf /opt/homebrew/opt/openssl@3 /usr/local/opt/openssl
echo "ls -l /usr/local/opt/"; ls -l /usr/local/opt/
make libs
working-directory: ${{ github.workspace }}/src/github.com/harmony-one/harmony
- name: Build hmy binary for macos-latest x86_64
if: matrix.os == 'macos-latest'
run: |
make all
working-directory: go-sdk
Loading…
Cancel
Save