Skip to content

Commit

Permalink
Remove build flag (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
marco6 authored Jul 9, 2024
1 parent e31d7e7 commit 69db51f
Show file tree
Hide file tree
Showing 28 changed files with 855 additions and 926 deletions.
44 changes: 3 additions & 41 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
- name: go vet
run: make go.vet

tests-sqlite:
name: Test sqlite
tests:
name: Run Tests
runs-on: ubuntu-latest

steps:
Expand All @@ -57,27 +57,8 @@ jobs:
- name: Run tests
run: make go.test

tests-dqlite:
name: Test dqlite
runs-on: ubuntu-latest

steps:
- name: Check out Code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: go mod download
run: go mod download

- name: Run tests
run: make go.test.dqlite

benchmarks:
name: Benchmark sqlite
name: Run Benchmarks
runs-on: ubuntu-latest

steps:
Expand All @@ -95,25 +76,6 @@ jobs:
- name: Run benchmarks
run: make go.bench

benchmarks-dqlite:
name: Benchmark dqlite
runs-on: ubuntu-latest

steps:
- name: Check out Code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: go mod download
run: go mod download

- name: Run benchmarks
run: make go.bench.dqlite

build:
name: Build k8s-dqlite
runs-on: ubuntu-latest
Expand Down
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ go.vet:
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-vet.sh ./...

go.test:
go test -v -p 1 ./...

go.test.dqlite:
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-test.sh -v ./...
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-test.sh -v -p 1 ./...

go.bench:
go test -tags=libsqlite3 -v ./... -run "^$$" -bench "Benchmark" -benchmem

go.bench.dqlite:
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-test.sh -v ./... -run "^$$" -bench "Benchmark" -benchmem
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-test.sh -v -p 1 ./... -run "^$$" -bench "Benchmark" -benchmem

## Static Builds
static: bin/static/k8s-dqlite bin/static/dqlite
Expand Down
2 changes: 0 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build dqlite

package cmd

import (
Expand Down
9 changes: 0 additions & 9 deletions cmd/version_no_dqlite.go

This file was deleted.

2 changes: 1 addition & 1 deletion hack/dynamic-go-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ DIR="$(realpath `dirname "${0}"`)"
. "${DIR}/dynamic-dqlite.sh"

go build \
-tags dqlite,libsqlite3 \
-tags libsqlite3 \
-ldflags '-s -w -extldflags "-Wl,-rpath,$ORIGIN/lib -Wl,-rpath,$ORIGIN/../lib"' \
"${@}"
2 changes: 1 addition & 1 deletion hack/dynamic-go-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ DIR="$(realpath `dirname "${0}"`)"
. "${DIR}/dynamic-dqlite.sh"

go install \
-tags dqlite,libsqlite3 \
-tags libsqlite3 \
-ldflags '-s -w -extldflags "-Wl,-rpath,$ORIGIN/lib -Wl,-rpath,$ORIGIN/../lib"' \
"${@}"
2 changes: 1 addition & 1 deletion hack/dynamic-go-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ DIR="$(realpath `dirname "${0}"`)"
. "${DIR}/dynamic-dqlite.sh"

go test \
-tags dqlite,libsqlite3 \
-tags libsqlite3 \
"${@}"
2 changes: 1 addition & 1 deletion hack/dynamic-go-vet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ DIR="$(realpath `dirname "${0}"`)"
. "${DIR}/static-dqlite.sh"

go vet \
-tags dqlite,libsqlite3 \
-tags libsqlite3 \
"${@}"
2 changes: 1 addition & 1 deletion hack/static-go-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ DIR="$(realpath `dirname "${0}"`)"
. "${DIR}/static-dqlite.sh"

go build \
-tags dqlite,libsqlite3 \
-tags libsqlite3 \
-ldflags '-s -w -linkmode "external" -extldflags "-static"' \
"${@}"
2 changes: 1 addition & 1 deletion hack/static-go-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ DIR="$(realpath `dirname "${0}"`)"
. "${DIR}/static-dqlite.sh"

go install \
-tags dqlite,libsqlite3 \
-tags libsqlite3 \
-ldflags '-s -w -linkmode "external" -extldflags "-static"' \
"${@}"
2 changes: 1 addition & 1 deletion hack/static-go-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ DIR="$(realpath `dirname "${0}"`)"
. "${DIR}/static-dqlite.sh"

go test \
-tags dqlite,libsqlite3 \
-tags libsqlite3 \
-ldflags '-linkmode "external" -extldflags "-static"' \
"${@}"
2 changes: 1 addition & 1 deletion hack/static-go-vet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ DIR="$(realpath `dirname "${0}"`)"
. "${DIR}/static-dqlite.sh"

go vet \
-tags dqlite,libsqlite3 \
-tags libsqlite3 \
"${@}"
2 changes: 0 additions & 2 deletions pkg/kine/drivers/dqlite/dqlite.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build dqlite

package dqlite

import (
Expand Down
15 changes: 0 additions & 15 deletions pkg/kine/drivers/dqlite/no_dqlite.go

This file was deleted.

6 changes: 2 additions & 4 deletions pkg/kine/drivers/dqlite_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build dqlite

package drivers_test

import (
Expand Down Expand Up @@ -31,10 +29,10 @@ func newDqliteBackend(ctx context.Context, tb testing.TB) (server.Backend, *gene
dir := tb.TempDir()
app, err := app.New(dir, app.WithAddress(fmt.Sprintf("127.0.0.1:%d", 59090+nextIdx)))
if err != nil {
panic(fmt.Errorf("failed to create dqlite app: %w", err))
tb.Fatal(fmt.Errorf("failed to create dqlite app: %w", err))
}
if err := app.Ready(ctx); err != nil {
panic(fmt.Errorf("failed to initialize dqlite: %w", err))
tb.Fatal(fmt.Errorf("failed to initialize dqlite: %w", err))
}
tb.Cleanup(func() {
app.Close()
Expand Down
2 changes: 0 additions & 2 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build dqlite

package server

import (
Expand Down
39 changes: 0 additions & 39 deletions pkg/server/server_no_dqlite.go

This file was deleted.

Loading

0 comments on commit 69db51f

Please sign in to comment.