Skip to content

Commit

Permalink
Adjust "create release" flow to include wasmer2, as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Mar 7, 2024
1 parent 5b2b4ca commit 343340f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and smoke test

on:
pull_request:
Expand Down Expand Up @@ -39,11 +39,11 @@ jobs:
- name: Smoke test the binaries
run: |
${GITHUB_WORKSPACE}/cmd/node --help
${GITHUB_WORKSPACE}/cmd/seednode --help
${GITHUB_WORKSPACE}/cmd/keygenerator --help
${GITHUB_WORKSPACE}/cmd/logviewer --help
${GITHUB_WORKSPACE}/cmd/termui --help
${GITHUB_WORKSPACE}/cmd/node/node --help
${GITHUB_WORKSPACE}/cmd/seednode/seednode --help
${GITHUB_WORKSPACE}/cmd/keygenerator/keygenerator --help
${GITHUB_WORKSPACE}/cmd/logviewer/logviewer --help
${GITHUB_WORKSPACE}/cmd/termui/termui --help
# On GitHub, we only run the short tests, and we only run them for some OS/ARCH combinations.
- name: Run tests
Expand Down
42 changes: 35 additions & 7 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build:
strategy:
matrix:
runs-on: [ubuntu-latest] # TODO add macos-latest when builds are possible on macs
runs-on: [ubuntu-latest, macos-latest, macos-13-xlarge]
runs-on: ${{ matrix.runs-on }}
name: Build
steps:
Expand Down Expand Up @@ -47,14 +47,15 @@ jobs:
GOPATH=$(go env GOPATH)
ARCHIVE="multiversx_""$APP_VER_SHORT""_""$GOOS""_""$GOARCH"".tgz"
BUILD_DIR=${GITHUB_WORKSPACE}/build
WASM_VERSION=$(cat go.mod | grep mx-chain-vm-v | sort -n | tail -n -1| awk -F '/' '{print$3}'| sed 's/ /@/g')
WASMER_DIR=${GOPATH}/pkg/mod/github.com/multiversx/${WASM_VERSION}/wasmer
VM_GO_VERSION=$(cat go.mod | grep mx-chain-vm-go | sort -n | tail -n -1| awk -F '/' '{print$3}'| sed 's/ /@/g')
VM_GO_DIR=${GOPATH}/pkg/mod/github.com/multiversx/${VM_GO_VERSION}
echo "GOOS=${GOOS}" >> $GITHUB_ENV
echo "GOARCH=${GOARCH}" >> $GITHUB_ENV
echo "ARCHIVE=${ARCHIVE}" >> $GITHUB_ENV
echo "BUILD_DIR=${BUILD_DIR}" >> $GITHUB_ENV
echo "WASMER_DIR=${WASMER_DIR}" >> $GITHUB_ENV
echo "VM_GO_VERSION=${VM_GO_VERSION}" >> $GITHUB_ENV
echo "VM_GO_DIR=${VM_GO_DIR}" >> $GITHUB_ENV
- name: Build
run: |
Expand All @@ -69,13 +70,40 @@ jobs:
cd ${GITHUB_WORKSPACE}
if [[ "$GOOS" == linux && "$GOARCH" == amd64 ]]; then
cp -f ${WASMER_DIR}/libwasmer_linux_amd64.so ${BUILD_DIR};
cp --verbose --no-preserve=mode,ownership ${VM_GO_DIR}/wasmer2/libvmexeccapi.so ${BUILD_DIR}/libvmexeccapi.so
cp --verbose --no-preserve=mode,ownership ${VM_GO_DIR}/wasmer/libwasmer_linux_amd64.so ${BUILD_DIR}/libwasmer_linux_amd64.so
fi
# Actually, there's no runner for this combination (as of March 2024).
if [[ "$GOOS" == linux && "$GOARCH" == arm64 ]]; then
cp -f ${WASMER_DIR}/libwasmer_linux_arm64.so ${BUILD_DIR};
cp --verbose --no-preserve=mode,ownership ${VM_GO_DIR}/wasmer2/libvmexeccapi_arm.so ${BUILD_DIR}/libvmexeccapi_arm.so
cp --verbose --no-preserve=mode,ownership ${VM_GO_DIR}/wasmer/libwasmer_linux_arm64_shim.so ${BUILD_DIR}/libwasmer_linux_arm64_shim.so
fi
if [[ "$GOOS" == darwin && "$GOARCH" == amd64 ]]; then
cp -f ${WASMER_DIR}/libwasmer_darwin_amd64.dylib ${BUILD_DIR};
cp -v ${VM_GO_DIR}/wasmer2/libvmexeccapi.dylib ${BUILD_DIR}/libvmexeccapi.dylib
cp -v ${VM_GO_DIR}/wasmer/libwasmer_darwin_amd64.dylib ${BUILD_DIR}/libwasmer_darwin_amd64.dylib
fi
if [[ "$GOOS" == darwin && "$GOARCH" == arm64 ]]; then
cp -v ${VM_GO_DIR}/wasmer2/libvmexeccapi_arm.dylib ${BUILD_DIR}/libvmexeccapi_arm.dylib
cp -v ${VM_GO_DIR}/wasmer/libwasmer_darwin_arm64_shim.dylib ${BUILD_DIR}/libwasmer_darwin_arm64_shim.dylib
fi
if [[ "$GOOS" == linux ]]; then
patchelf --set-rpath "\$ORIGIN" ${BUILD_DIR}/node
patchelf --set-rpath "\$ORIGIN" ${BUILD_DIR}/seednode
ldd ${BUILD_DIR}/node
ldd ${BUILD_DIR}/seednode
fi
if [[ "$GOOS" == darwin ]]; then
install_name_tool -add_rpath "@loader_path" ${BUILD_DIR}/node
install_name_tool -add_rpath "@loader_path" ${BUILD_DIR}/seednode
otool -L ${BUILD_DIR}/node
otool -L ${BUILD_DIR}/seednode
fi
cd ${BUILD_DIR}
Expand Down

0 comments on commit 343340f

Please sign in to comment.