Update build.yaml #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Prebuilt | |
| on: [push, pull_request] | |
| jobs: | |
| Build-Linux: | |
| runs-on: ubuntu-20.04 | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: 'Install Build Deps' | |
| run: | | |
| sudo apt-get install -y build-essential make cmake git pkg-config | |
| - name: 'Build' | |
| run: | | |
| export BUILD_DATETIME=$(date '+%Y-%m-%d %H:%M:%S.%3N %Z' --date='TZ="Asia/Shanghai" now') | |
| export BUILD_GIT_TAG=$GITHUB_SHA | |
| mkdir prebuilt | |
| go env | |
| GOTOOLCHAIN=go1.20 CGO_CFLAGS="-I$(pwd)/vm_libvix/include" CGO_LDFLAGS="-L$(pwd)/vm_libvix/libs/linux64 -lvixAllProducts -ldl -lpthread" go build -ldflags "-X 'main.dateTime=$BUILD_DATETIME' -X 'main.gitTag=$BUILD_GIT_TAG' " -o prebuilt/openvm-api cmd/server/main.go | |
| - name: 'Copy RUNTIME' | |
| run: | | |
| # prebuilt/start.sh | |
| echo '#!/bin/bash' > prebuilt/start.sh | |
| echo 'SCRIPT_DIR=$(dirname "$(readlink -f "$0")")' >> prebuilt/start.sh | |
| echo 'LD_LIBRARY_PATH=$SCRIPT_DIR $SCRIPT_DIR/openvm-api' >> prebuilt/start.sh | |
| chmod +x prebuilt/start.sh | |
| # prebuilt/libvixAllProducts.so | |
| cp $(pwd)/vm_libvix/libs/linux64/libvixAllProducts.so prebuilt/ | |
| - name: 'Upload artifact' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openvm-api_prebuilt_linux_amd64 | |
| path: prebuilt | |
| Build-Windows: | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| cache: false | |
| go-version: '1.20.0' | |
| - name: 'Setup MSYS2' | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| cache: false | |
| path-type: 'inherit' | |
| install: >- | |
| git | |
| zip | |
| mingw-w64-x86_64-toolchain | |
| mingw-w64-x86_64-gcc-libs | |
| - name: 'Build' | |
| run: | | |
| export BUILD_DATETIME=$(date '+%Y-%m-%d %H:%M:%S.%3N %Z' --date='TZ="Asia/Shanghai" now') | |
| export BUILD_GIT_TAG=$GITHUB_SHA | |
| mkdir prebuilt | |
| go env | |
| CGO_CFLAGS="-I$(pwd)/vm_libvix/include" CGO_LDFLAGS="-L$(pwd)/vm_libvix/libs/win64 -lvixAllProducts -lpthread" go build -ldflags "-X 'main.dateTime=$BUILD_DATETIME' -X 'main.gitTag=$BUILD_GIT_TAG' " -o prebuilt/openvm-api.exe cmd/server/main.go | |
| - name: 'Copy RUNTIME' | |
| run: | | |
| cp /mingw64/bin/libgcc_s_seh-1.dll prebuilt/ | |
| cp /mingw64/bin/libwinpthread-1.dll prebuilt/ | |
| cp $(pwd)/vm_libvix/libs/win64/vixAllProducts.dll prebuilt/ | |
| - name: 'Upload artifact' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openvm-api_prebuilt_win_amd64 | |
| path: prebuilt |