Skip to content

Commit

Permalink
Releases for runtime (#846)
Browse files Browse the repository at this point in the history
* Include Rill SQL in runtime binary

* Cross-platform runtime build

* Fix binary extension for windows

* Fix typo in windows binary extension

* Run runtime builds on macos

* Fix bad path in runtime release ci

* Move darwin builds off Zig

* Use runtime service account
  • Loading branch information
begelundmuller authored Sep 5, 2022
1 parent 2d95efd commit 104ee91
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/runtime-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Release runtime binaries
on:
push:
branches: ["main"]
paths:
- ".github/workflows/runtime-release.yml"
- "runtime/**"
jobs:
release:
strategy:
matrix:
include:
- os: linux
arch: amd64
name: linux-amd64
ext: ""
- os: windows
arch: amd64
name: windows-amd64
ext: ".exe"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go
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: Authenticate GCS
uses: google-github-actions/auth@v0
with:
credentials_json: "${{ secrets.RILL_RUNTIME_SA }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v0"
- name: Build and upload ${{ matrix.name }}
shell: bash
run: |
cd runtime
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/
release_macos:
# NOTE: Currently, darwin builds must run on macOS. See Makefile for details.
strategy:
matrix:
include:
- os: darwin
arch: amd64
name: macos-amd64
ext: ""
- os: darwin
arch: arm64
name: macos-arm64
ext: ""
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.19"
- name: Authenticate GCS
uses: google-github-actions/auth@v0
with:
credentials_json: "${{ secrets.RILL_SQL_SA }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v0"
- name: Build and upload ${{ matrix.name }}
shell: bash
run: |
cd runtime
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/
1 change: 1 addition & 0 deletions runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sql/deps
release
36 changes: 36 additions & 0 deletions runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
RUNTIME_VERSION = $(shell cat version.txt | tr -d "[:space:]")

.PHONY: build
build:
./scripts/setup_sql.sh -f
Expand All @@ -16,3 +18,37 @@ test:
.PHONY: clean
clean:
rm -rf sql/deps
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:
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

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

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=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
1 change: 1 addition & 0 deletions runtime/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/rilldata/rill/runtime"
"github.com/rilldata/rill/runtime/metadata"
"github.com/rilldata/rill/runtime/pkg/graceful"
_ "github.com/rilldata/rill/runtime/sql"

_ "github.com/rilldata/rill/runtime/infra/duckdb"
_ "github.com/rilldata/rill/runtime/metadata/sqlite"
Expand Down

0 comments on commit 104ee91

Please sign in to comment.