diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f0dd70a2..d701d631a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,22 +20,32 @@ jobs: strategy: matrix: go-arch: ["amd64"] + go-os: ["linux"] + env: + GOARCH: ${{ matrix.go-arch }} + GOOS: ${{ matrix.go-os }} + LEDGER_ENABLED: false steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: "^1.21" - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff + - name: Non-static Build + run: | + make build + mv ./build/cantod ./build/cantod-nonstatic-${{ matrix.go-os }}-${{ matrix.go-arch }} + - name: Install musl-tools + run: sudo apt-get update && sudo apt-get install -y musl-tools + - name: Static Build + env: + CC: musl-gcc + LDFLAGS: "-extldflags -static" + run: | + rm -r build + make build + mv build/cantod ./build/cantod-${{ matrix.go-os }}-${{ matrix.go-arch }} + - name: Upload cantod Binary (Static) + uses: actions/upload-artifact@v4 with: - PATTERNS: | - **/*.go - go.mod - go.sum - **/go.mod - **/go.sum - **/Makefile - Makefile - - name: Build - if: env.GIT_DIFF - run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build + name: cantod-${{ matrix.go-os }}-${{ matrix.go-arch }} + path: ./build/cantod-${{ matrix.go-os }}-${{ matrix.go-arch }}