diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ae067358b..d3acfd5ce2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,62 @@ env: GITHUB_REF_NAME: "$(echo ${{ github.ref_name }} | tr '//' '-')" jobs: - build-and-test: + build-and-test-single-arch: + runs-on: ubuntu-latest + timeout-minutes: 20 + if: (! startsWith(github.ref, 'refs/tags/')) || (! startsWith(github.ref, 'refs/heads/develop') ) + steps: + - uses: actions/checkout@v3 + + - name: Set CPU Architecture + shell: bash + run: | + if [ "$(uname -m)" == "aarch64" ]; then + echo "CPU_ARCH=arm64" >> $GITHUB_ENV + elif [ "$(uname -m)" == "x86_64" ]; then + echo "CPU_ARCH=amd64" >> $GITHUB_ENV + else + echo "Unsupported architecture" >&2 + exit 1 + fi + + - name: Install Pipeline Dependencies + uses: ./.github/actions/install-dependencies + timeout-minutes: 8 + with: + cpu_architecture: ${{ env.CPU_ARCH }} + skip_python: "true" + skip_aws_cli: "true" + skip_docker_compose: "true" + + - name: setup-git-credentials + uses: de-vri-es/setup-git-credentials@v2.0.8 + with: + credentials: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }} + + - name: Test + run: | + echo "Running Build Tests" + make clean + make test + + - name: Build zetacored and zetaclientd + env: + CGO_ENABLED: 1 + GOOS: linux + GOARCH: ${{ env.CPU_ARCH }} + run: | + make install-testnet + cp "$HOME"/go/bin/* ./ + chmod a+x ./zetacored + ./zetacored version + + - name: Clean Up Workspace + if: always() + shell: bash + run: rm -rf * + + build-and-test-multi-arch: strategy: matrix: runs-on: @@ -40,6 +95,7 @@ jobs: runs-on: ${{matrix.runs-on}} timeout-minutes: 30 + if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop') steps: - uses: actions/checkout@v3 @@ -79,23 +135,24 @@ jobs: # restore-keys: | # ${{ matrix.runs-on }}-go- + - name: Test + run: | + echo "Running Build Tests" + make clean + make test + - name: Build zetacored and zetaclientd env: CGO_ENABLED: 1 GOOS: linux GOARCH: ${{ env.CPU_ARCH }} run: | - make clean make install-testnet cp "$HOME"/go/bin/* ./ - - - name: Test - run: | - echo "Running Build Tests" - make test chmod a+x ./zetacored ./zetacored version + - name: Name Binaries if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop') env: @@ -170,6 +227,13 @@ jobs: with: credentials: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }} + - name: Test + shell: alpine.sh --root {0} + run: | + echo "Running Build Tests" + apk add --no-cache --update + make clean + make test - name: Build zetacored and zetaclientd env: @@ -178,18 +242,12 @@ jobs: GOARCH: ${{ env.CPU_ARCH }} shell: alpine.sh --root {0} run: | - apk add --no-cache --update - make clean + git config --global --add safe.directory '*' go mod tidy - make clean make install-testnet cp "$HOME"/go/bin/* ./ - - name: Test - shell: alpine.sh --root {0} - run: | - echo "Running Build Tests" - make test + - name: Binary Docker Test env: @@ -284,7 +342,7 @@ jobs: timeout-minutes: 15 if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop') needs: - - build-and-test + - build-and-test-multi-arch - smoke-test - build-alpine-and-test steps: @@ -401,7 +459,7 @@ jobs: timeout-minutes: 60 if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release') needs: - - build-and-test + - build-and-test-multi-arch - build-alpine-and-test - upload steps: