From 50a3c0d4f7ec78e13efb7e93076bcf2e93126597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Thu, 7 Mar 2024 19:14:59 +0200 Subject: [PATCH] Smoke tests. --- .github/workflows/build_and_test.yml | 10 +++++----- .github/workflows/create_release.yml | 28 +++++++++++++++++++++------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 3654925446f..1c97f1997d3 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -39,11 +39,11 @@ jobs: - name: Smoke test the binaries run: | - ${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 + ${GITHUB_WORKSPACE}/cmd/node/node --version + ${GITHUB_WORKSPACE}/cmd/seednode/seednode --version + ${GITHUB_WORKSPACE}/cmd/keygenerator/keygenerator --version + ${GITHUB_WORKSPACE}/cmd/logviewer/logviewer --version + ${GITHUB_WORKSPACE}/cmd/termui/termui --version # On GitHub, we only run the short tests, and we only run them for some OS/ARCH combinations. - name: Run tests diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 4a72868d29f..82a05e5927a 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -1,6 +1,7 @@ name: Create release on: + pull_request: push: branches: - master @@ -45,7 +46,7 @@ jobs: GOOS=$(go env GOOS) GOARCH=$(go env GOARCH) GOPATH=$(go env GOPATH) - ARCHIVE="multiversx_""$APP_VER_SHORT""_""$GOOS""_""$GOARCH"".tgz" + ARCHIVE="multiversx_""$APP_VER_SHORT""_""$GOOS""_""$GOARCH"".zip" BUILD_DIR=${GITHUB_WORKSPACE}/build 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} @@ -107,15 +108,28 @@ jobs: otool -L ${BUILD_DIR}/seednode fi - cd ${BUILD_DIR} - tar czvf "${GITHUB_WORKSPACE}/${ARCHIVE}" * - stat ${GITHUB_WORKSPACE}/${ARCHIVE} + - name: Smoke test + run: | + # Remove all downloaded Go packages, so that we can test the binary's independence from them (think of Wasmer libraries). + sudo rm -rf ${GOPATH}/pkg/mod + + # Test the binary in different current directories. + cd ${BUILD_DIR} && ./node --version + cd ${GITHUB_WORKSPACE} && ${BUILD_DIR}/node --version + cd / && ${BUILD_DIR}/node --version + + - name: Package build output + run: | + sudo chown -R $USER: ${BUILD_DIR} + chmod -R 755 ${BUILD_DIR} + ls -al ${BUILD_DIR} + zip -r -j ${ARCHIVE} ${BUILD_DIR} - name: Save artifacts uses: actions/upload-artifact@v3 with: - name: ${{ env.ARCHIVE }} - path: ${{ github.workspace }}/${{ env.ARCHIVE }} + name: build-output + path: ${{ env.ARCHIVE }} if-no-files-found: error # release: @@ -142,6 +156,6 @@ jobs: # run: | # gh release create --draft --notes="Release draft from Github Actions" vNext # sleep 10 - # for i in $(find ./assets -name '*.tgz' -type f); do + # for i in $(find ./assets -name '*.zip' -type f); do # gh release upload vNext ${i} # done