Skip to content

Commit

Permalink
Fix CI/CD workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
Liz Jeong authored and Liz Jeong committed Jul 19, 2024
1 parent 935e98b commit 0de4599
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 31 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/build-darwin-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,48 @@ jobs:
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "ARCH_NAME=x86_64" >> $GITHUB_ENV
MOVEVM_VERSION=$(go list -m github.com/initia-labs/movevm | awk '{print $2}')
echo "MOVEVM_VERSION=${MOVEVM_VERSION}" >> $GITHUB_ENV
WASMVM_VERSION=$(go list -m github.com/initia-labs/movevm | awk '{print $2}')
echo "WASMVM_VERSION=${WASMVM_VERSION}" >> $GITHUB_ENV
- name: Ensure dependencies
run: |
go mod tidy
go get github.com/initia-labs/movevm@${MOVEVM_VERSION}
go get github.com/initia-labs/movevm@${WASMVM_VERSION}
- name: Print environment variables
run: |
echo "GOARCH=${GOARCH}"
echo "GOOS=${GOOS}"
echo "VERSION=${VERSION}"
echo "ARCH_NAME=${ARCH_NAME}"
echo "MOVEVM_VERSION=${MOVEVM_VERSION}"
echo "WASMVM_VERSION=${WASMVM_VERSION}"
echo "MINIWASM_NETWORK_NAME=${MINIWASM_NETWORK_NAME}"
- name: Build and Package for Darwin ADM64
# - name: Build and Package for Darwin ADM64
# run: |
# cd ../miniwasm \
# && make build \
# && cd ./build \
# && cp ~/go/pkg/mod/github.com/initia-labs/movevm@${WASMVM_VERSION}/api/libmovevm.dylib ./ \
# && cp ~/go/pkg/mod/github.com/initia-labs/movevm@${WASMVM_VERSION}/api/libcompiler.dylib ./ \
# && tar -czvf miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz minitiad libmovevm.dylib libcompiler.dylib \
# && mv ./miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz $GITHUB_WORKSPACE/ \
# && rm -rf ./libmovevm.dylib ./libcompiler.dylib ./minitiad

- name: Build and Package for Darwin ADM642
run: |
cd ../miniwasm \
&& make build \
&& cd ./build \
&& cp ~/go/pkg/mod/github.com/initia-labs/movevm@${MOVEVM_VERSION}/api/libmovevm.dylib ./ \
&& cp ~/go/pkg/mod/github.com/initia-labs/movevm@${MOVEVM_VERSION}/api/libcompiler.dylib ./ \
&& tar -czvf miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz minitiad libmovevm.dylib libcompiler.dylib \
&& mv ./miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz $GITHUB_WORKSPACE/ \
&& rm -rf ./libmovevm.dylib ./libcompiler.dylib ./minitiad
&& cp ~/go/pkg/mod/github.com/\!cosm\!wasm/wasmvm@"$WASMVM_VERSION"/internal/api/libwasmvm.dylib ./ \
&& tar -czvf miniwasm_"$MINIWASM_VERSION"_Darwin_"$ARCH".tar.gz ./minitiad libwasmvm.dylib \
&& mv ./miniwasm_"$MINIWASM_VERSION"_Darwin_"$ARCH".tar.gz $GITHUB_WORKSPACE/ \
&& rm -rf ./libwasmvm.dylib ./minitiad
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
miniwasm_${{ env.VERSION }}_Darwin_${{ env.ARCH_NAME }}.tar.gz
28 changes: 19 additions & 9 deletions .github/workflows/build-darwin-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
run: |
MINIWASM_NETWORK_NAME="miniwasm-1"
echo "MINIWASM_NETWORK_NAME=${MINIWASM_NETWORK_NAME}" >> $GITHUB_ENV
MOVEVM_VERSION=$(go list -m github.com/initia-labs/movevm | awk '{print $2}')
echo "MOVEVM_VERSION=${MOVEVM_VERSION}" >> $GITHUB_ENV
WASMVM_VERSION=$(go list -m github.com/initia-labs/movevm | awk '{print $2}')
echo "WASMVM_VERSION=${WASMVM_VERSION}" >> $GITHUB_ENV
echo "GOARCH=arm64" >> $GITHUB_ENV
echo "GOOS=darwin" >> $GITHUB_ENV
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Ensure dependencies
run: |
go mod tidy
go get github.com/initia-labs/movevm@${MOVEVM_VERSION}
go get github.com/initia-labs/movevm@${WASMVM_VERSION}
- name: Print environment variables
run: |
Expand All @@ -45,16 +45,26 @@ jobs:
echo "ARCH_NAME=${ARCH_NAME}"
echo "MINIWASM_NETWORK_NAME=${MINIWASM_NETWORK_NAME}"
- name: Build and Package for Darwin ARM64
# - name: Build and Package for Darwin ARM64
# run: |
# cd ../miniwasm \
# && make build \
# && cd ./build \
# && cp ~/go/pkg/mod/github.com/initia-labs/movevm@${WASMVM_VERSION}/api/libmovevm.dylib ./ \
# && cp ~/go/pkg/mod/github.com/initia-labs/movevm@${WASMVM_VERSION}/api/libcompiler.dylib ./ \
# && tar -czvf miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz minitiad libmovevm.dylib libcompiler.dylib \
# && mv ./miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz $GITHUB_WORKSPACE/ \
# && rm -rf ./libmovevm.dylib ./libcompiler.dylib ./minitiad

- name: Build and Package for Darwin ADM642
run: |
cd ../miniwasm \
&& make build \
&& cd ./build \
&& cp ~/go/pkg/mod/github.com/initia-labs/movevm@${MOVEVM_VERSION}/api/libmovevm.dylib ./ \
&& cp ~/go/pkg/mod/github.com/initia-labs/movevm@${MOVEVM_VERSION}/api/libcompiler.dylib ./ \
&& tar -czvf miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz minitiad libmovevm.dylib libcompiler.dylib \
&& mv ./miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz $GITHUB_WORKSPACE/ \
&& rm -rf ./libmovevm.dylib ./libcompiler.dylib ./minitiad
&& cp ~/go/pkg/mod/github.com/\!cosm\!wasm/wasmvm@"$WASMVM_VERSION"/internal/api/libwasmvm.dylib ./ \
&& tar -czvf miniwasm_"$MINIWASM_VERSION"_Darwin_"$ARCH".tar.gz ./minitiad libwasmvm.dylib \
&& mv ./miniwasm_"$MINIWASM_VERSION"_Darwin_"$ARCH".tar.gz $GITHUB_WORKSPACE/ \
&& rm -rf ./libwasmvm.dylib ./minitiad
- name: Release
uses: softprops/action-gh-release@v2
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build-linux-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ jobs:
make build-linux-with-shared-library
cd ./build
mkdir -p miniwasm_${VERSION}
mv libmovevm.so miniwasm_${VERSION}/libmovevm.${ARCH_NAME}.so
mv libcompiler.so miniwasm_${VERSION}/libcompiler.${ARCH_NAME}.so
mv libwasmvm.so miniwasm_${VERSION}/libwasmvm.${ARCH_NAME}.so
mv minitiad miniwasm_${VERSION}/
tar -czvf miniwasm_${VERSION}_Linux_${ARCH_NAME}.tar.gz miniwasm_${VERSION}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build-linux-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,14 @@ jobs:
mkdir -p ./build
docker create --name temp minitia/minitiad-shared:arm64
docker cp temp:/usr/local/bin/minitiad ./build/
docker cp temp:/lib/libmovevm.so ./build/
docker cp temp:/lib/libcompiler.so ./build/
docker cp temp:/lib/libwasmvm.so ./build/
docker rm temp
# 결과물 패키징
cd ./build
mkdir -p miniwasm_${VERSION}
mv minitiad miniwasm_${VERSION}/
mv libmovevm.so miniwasm_${VERSION}/libmovevm.${ARCH_NAME}.so
mv libcompiler.so miniwasm_${VERSION}/libcompiler.${ARCH_NAME}.so
mv libwasmvm.so miniwasm_${VERSION}/libwasmvm.${ARCH_NAME}.so
tar -czvf miniwasm_${VERSION}_Linux_${ARCH_NAME}.tar.gz miniwasm_${VERSION}
mv miniwasm_${VERSION}_Linux_${ARCH_NAME}.tar.gz ../
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@

FROM arm64v8/golang:1.22-bullseye AS go-builder

# Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apt update
RUN apt install -y curl git build-essential
# debug: for live editing in the image
# debug: for live editting in the image
RUN apt install -y vim

WORKDIR /code
COPY . /code/

RUN LEDGER_ENABLED=false make build

RUN cp /go/pkg/mod/github.com/initia\-labs/movevm@v*/api/libmovevm.`uname -m`.so /lib/libmovevm.so
RUN cp /go/pkg/mod/github.com/initia\-labs/movevm@v*/api/libcompiler.`uname -m`.so /lib/libcompiler.so
RUN cp /go/pkg/mod/github.com/\!cosm\!wasm/wasmvm@v*/internal/api/libwasmvm.`uname -m`.so /lib/libwasmvm.so

FROM arm64v8/ubuntu:20.04

WORKDIR /root

COPY --from=go-builder /code/build/minitiad /usr/local/bin/minitiad
COPY --from=go-builder /lib/libmovevm.so /lib/libmovevm.so
COPY --from=go-builder /lib/libcompiler.so /lib/libcompiler.so
COPY --from=go-builder /lib/libwasmvm.so /lib/libwasmvm.so

# for new-metric setup
COPY --from=go-builder /code/contrib /root/contrib

# rest server
EXPOSE 1317
Expand Down

0 comments on commit 0de4599

Please sign in to comment.