Skip to content

Commit

Permalink
Clean up runtime releases (rilldata#912)
Browse files Browse the repository at this point in the history
* Test release on macOS

* Test on macOS 2

* Test linux build without zig

* Build Linux using native tools

* Tidy up runtime releases
  • Loading branch information
begelundmuller authored Sep 12, 2022
1 parent 94f3d01 commit 68b61dd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 39 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/runtime-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "runtime/**"
jobs:
release:
# NOTE: linux builds must currently run on Linux. See Makefile for details.
strategy:
matrix:
include:
Expand All @@ -25,10 +26,10 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: "1.19"
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v1
with:
version: "0.9.1"
# - name: Setup Zig
# uses: goto-bus-stop/setup-zig@v1
# with:
# version: "0.9.1"
- name: Authenticate GCS
uses: google-github-actions/auth@v0
with:
Expand All @@ -42,10 +43,9 @@ jobs:
make release/${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
mv release/${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }} release/runtime${{ matrix.ext }}
zip -j release/runtime-${{ matrix.name }}.zip release/runtime${{ matrix.ext }}
RUNTIME_VERSION=$(cat version.txt | tr -d "[:space:]")
gsutil cp release/runtime-${{ matrix.name }}.zip gs://pkg.rilldata.com/runtime/releases/v$RUNTIME_VERSION/
gsutil cp release/runtime-${{ matrix.name }}.zip gs://pkg.rilldata.com/runtime/releases/${{ github.sha }}/
release_macos:
# NOTE: Currently, darwin builds must run on macOS. See Makefile for details.
# NOTE: darwin builds must currently run on macOS. See Makefile for details.
strategy:
matrix:
include:
Expand All @@ -67,7 +67,7 @@ jobs:
- name: Authenticate GCS
uses: google-github-actions/auth@v0
with:
credentials_json: "${{ secrets.RILL_SQL_SA }}"
credentials_json: "${{ secrets.RILL_RUNTIME_SA }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v0"
- name: Build and upload ${{ matrix.name }}
Expand All @@ -77,5 +77,4 @@ jobs:
make release/${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
mv release/${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }} release/runtime${{ matrix.ext }}
zip -j release/runtime-${{ matrix.name }}.zip release/runtime${{ matrix.ext }}
RUNTIME_VERSION=$(cat version.txt | tr -d "[:space:]")
gsutil cp release/runtime-${{ matrix.name }}.zip gs://pkg.rilldata.com/runtime/releases/v$RUNTIME_VERSION/
gsutil cp release/runtime-${{ matrix.name }}.zip gs://pkg.rilldata.com/runtime/releases/${{ github.sha }}/
49 changes: 25 additions & 24 deletions runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
RUNTIME_VERSION = $(shell cat version.txt | tr -d "[:space:]")

.PHONY: build
build:
./scripts/setup_sql.sh -f
Expand All @@ -21,34 +19,37 @@ clean:
rm -f main
rm -rf release

release/linux-amd64:
mkdir -p release
GOOS=linux GOARCH=amd64 ./scripts/setup_sql.sh -f
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
CC="zig cc -target x86_64-linux-musl" \
CXX="zig c++ -target x86_64-linux-musl" \
go build -ldflags "-X 'github.com/rilldata/rill/runtime.Version=${RUNTIME_VERSION}'" -trimpath -o release/linux-amd64 ./cmd

release/windows-amd64.exe:
release/darwin-amd64:
if [ "$(shell uname -s | tr '[:upper:]' '[:lower:]')" != "darwin" ]; then echo "Error: must run build on darwin"; false; fi
mkdir -p release
GOOS=windows GOARCH=amd64 ./scripts/setup_sql.sh -f
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 \
CC="zig cc -target x86_64-windows-gnu" \
CXX="zig c++ -target x86_64-windows-gnu" \
go build -ldflags "-X 'github.com/rilldata/rill/runtime.Version=${RUNTIME_VERSION}'" -trimpath -o release/windows-amd64.exe ./cmd

# NOTE: Move darwin builds to to Zig (for fully cross-platform builds) when the issues mentioned here have been solved: https://github.com/rilldata/rill-developer/pull/846
GOOS=darwin GOARCH=amd64 ./scripts/setup_sql.sh -f
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
go build -trimpath -o release/darwin-amd64 ./cmd

release/darwin-arm64:
if [ "$(shell uname -s | tr '[:upper:]' '[:lower:]')" != "darwin" ]; then echo "Error: must run build on darwin"; false; fi
mkdir -p release
GOOS=darwin GOARCH=arm64 ./scripts/setup_sql.sh -f
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 \
go build -ldflags "-X 'github.com/rilldata/rill/runtime.Version=${RUNTIME_VERSION}'" -trimpath -o release/darwin-arm64 ./cmd
go build -trimpath -o release/darwin-arm64 ./cmd

release/darwin-amd64:
if [ "$(shell uname -s | tr '[:upper:]' '[:lower:]')" != "darwin" ]; then echo "Error: must run build on darwin"; false; fi
release/linux-amd64:
if [ "$(shell uname -s | tr '[:upper:]' '[:lower:]')" != "linux" ]; then echo "Error: must run build on linux"; false; fi
mkdir -p release
GOOS=darwin GOARCH=amd64 ./scripts/setup_sql.sh -f
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
go build -ldflags "-X 'github.com/rilldata/rill/runtime.Version=${RUNTIME_VERSION}'" -trimpath -o release/darwin-amd64 ./cmd
GOOS=linux GOARCH=amd64 ./scripts/setup_sql.sh -f
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
go build -trimpath -o release/linux-amd64 ./cmd

# release/windows-amd64.exe:
# mkdir -p release
# GOOS=windows GOARCH=amd64 ./scripts/setup_sql.sh -f
# CGO_ENABLED=1 GOOS=windows GOARCH=amd64 \
# CC="zig cc -target x86_64-windows-gnu" \
# CXX="zig c++ -target x86_64-windows-gnu" \
# go build -trimpath -o release/windows-amd64.exe ./cmd

# NOTE: A previous version of this Makefile also used Zig for cross-platform macOS and Linux builds.
# It might be worth doing that again in the future. The status is:
# - for darwin, the zig issues linked here need to be solved: https://github.com/rilldata/rill-developer/pull/846
# - for linux, there was a problem with linking to libstdc++ when using the precompiled static libraries in `go-duckdb` (probably an easy fix)
# - for windows, the Zig build appears to work
4 changes: 0 additions & 4 deletions runtime/version.go

This file was deleted.

1 change: 0 additions & 1 deletion runtime/version.txt

This file was deleted.

0 comments on commit 68b61dd

Please sign in to comment.