Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(localstorage): pull pro storage layer at build time #106

Merged
merged 3 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
fetch-depth: 0

- name: Test
run: go test -mod=vendor -short ./...
run: go test -short ./...
44 changes: 0 additions & 44 deletions .github/workflows/release-dev-pro.yml

This file was deleted.

94 changes: 76 additions & 18 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,91 @@ permissions:
contents: write

jobs:
create_a_dev_release:
name: create a dev release
runs-on: ubuntu-latest
build:
strategy:
matrix:
targets:
- name: linux-amd64
runner: ubuntu-latest
tags: pro
goos: linux
goarch: amd64
- name: linux-arm64
runner: ubuntu-latest
goos: linux
goarch: arm64
goenvs: CC=aarch64-linux-gnu-gcc CXX=x86_64-linux-gnu-g++
preinstall: sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: darwin-amd64
runner: macos-latest
tags: pro
goos: darwin
goarch: amd64
- name: darwin-arm64
runner: macos-latest
tags: pro
goos: darwin
goarch: arm64
name: ${{ matrix.targets.name }}
runs-on: ${{ matrix.targets.runner }}
env:
GOPRIVATE: "github.com/humanlogio/humanlog-pro"
GH_ACCESS_TOKEN_FOR_HUMANLOGPRO: ${{ secrets.GH_ACCESS_TOKEN_FOR_HUMANLOGPRO }}
CGO_ENABLED: 1
GOBIN: /usr/local/bin/
steps:
- name: Set up Go 1
uses: actions/setup-go@v5
with:
go-version: stable
cache: true
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
- if: ${{ matrix.targets.preinstall != '' }}
run: ${{ matrix.targets.preinstall }}
- run: echo "${HOME}/.humanlog/bin" >> $GITHUB_PATH
- run: curl https://humanlog.io/install_apictl.sh | bash
- run: git config --global --add safe.directory '*'
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- run: go install github.com/goware/modvendor@latest
- run: go mod vendor
- run: modvendor -copy="**/*.a **/*.h" -v
- run: mkdir -p dist/${{ matrix.targets.goos }}-${{ matrix.targets.goarch }}
- run: ${{ matrix.targets.goenvs }} ./script/build.sh
env:
HUMANLOG_GOTAGS: ${{ matrix.targets.tags }}
GOOS: ${{ matrix.targets.goos }}
GOARCH: ${{ matrix.targets.goarch }}
- uses: actions/upload-artifact@v4
with:
go-version: ">=1.23"
cache: true
name: humanlog-bins-${{ matrix.targets.goos }}-${{ matrix.targets.goarch }}
path: dist/*

publish:
name: "publish"
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: echo "${HOME}/.humanlog/bin" >> $GITHUB_PATH
- run: curl https://humanlog.dev/install_apictl.sh | bash
- uses: goreleaser/goreleaser-action@v6
- run: curl https://humanlog.io/install_apictl.sh | bash
- uses: actions/upload-artifact/merge@v4
with:
distribution: goreleaser
version: v2
args: release --clean --draft --skip validate --config .goreleaser-dev.yaml
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.S3_BINARIES_BUCKET_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_BINARIES_BUCKET_ACCESS_KEY }}
- run: ./script/create_version_artifacts.sh
name: humanlog-bins
pattern: humanlog-bins-*
separate-directories: true
delete-merged: true
- uses: actions/download-artifact@v4
with:
name: humanlog-bins
- run: ./script/publish.sh
env:
CHANNEL: "dev"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API_URL: "https://api.humanlog.dev"
HMAC_KEY_ID: ${{ secrets.DEV_HMAC_KEY_ID }}
HMAC_PRIVATE_KEY: ${{ secrets.DEV_HMAC_PRIVATE_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.S3_BINARIES_BUCKET_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_BINARIES_BUCKET_ACCESS_KEY }}
103 changes: 99 additions & 4 deletions .goreleaser-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,115 @@ before:
- go generate ./...
- mkdir -p dist-extra
- script/write_version_info.sh "{{.Major}}" "{{.Minor}}" "{{.Patch}}" "next.{{ .CommitTimestamp }}" "{{.ShortCommit}}" "https://humanlog-binaries.sfo3.cdn.digitaloceanspaces.com/humanlog-binaries/{{ .ProjectName }}/dev/{{ .CommitTimestamp }}/{{ .ShortCommit }}"
# builds:
# - main: ./cmd/humanlog/
# binary: humanlog
# env:
# - CGO_ENABLED=1
# tags:
# - pro
#
# ldflags:
# - -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev
# goos:
# # - windows
# - darwin
# - linux
# goarch:
# - amd64
# - arm64

builds:
- main: ./cmd/humanlog/
- id: humanlog-darwin-amd64
binary: humanlog
main: ./cmd/humanlog
tags:
- pro
goarch:
- amd64
goos:
- darwin
env:
- CGO_ENABLED=0
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
flags:
- -trimpath
ldflags:
- -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev

- id: humanlog-darwin-arm64
binary: humanlog
main: ./cmd/humanlog
tags:
- pro
goarch:
- arm64
goos:
# - windows
- darwin
- linux
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
flags:
- -trimpath
ldflags:
- -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev

- id: humanlog-linux-amd64
binary: humanlog
main: ./cmd/humanlog
tags:
- pro
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
goarch:
- amd64
goos:
- linux
flags:
- -trimpath
ldflags:
- -extldflags "-lc -lrt -lpthread --static" -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev

- id: humanlog-linux-arm64
binary: humanlog
main: ./cmd/humanlog
tags:
- pro
goarch:
- arm64
goos:
- linux
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
flags:
- -trimpath
ldflags:
- -extldflags "-lc -lrt -lpthread --static" -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev

# - id: humanlog-windows-amd64
# binary: humanlog
# main: ./cmd/humanlog
# tags:
# - pro
# goarch:
# - amd64
# goos:
# - windows
# env:
# - CC=x86_64-w64-mingw32-gcc
# - CXX=x86_64-w64-mingw32-g++
# flags:
# - -trimpath
# - -buildmode=exe
# ldflags:
# - -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev

release:
disable: true
blobs:
Expand Down
3 changes: 2 additions & 1 deletion cmd/humanlog/localhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import (
"golang.org/x/net/http2/h2c"
"golang.org/x/sys/unix"

// imported for side-effect
// imported for side-effect of `init()` registration
_ "github.com/humanlogio/humanlog/internal/diskstorage"
_ "github.com/humanlogio/humanlog/internal/memstorage"
)

Expand Down
25 changes: 18 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/humanlogio/humanlog

go 1.22.0

toolchain go1.23.2
go 1.23.2

require (
connectrpc.com/connect v1.16.2
Expand All @@ -23,6 +21,7 @@ require (
github.com/go-logfmt/logfmt v0.5.1
github.com/google/uuid v1.6.0
github.com/humanlogio/api/go v0.0.0-20241027163319-aa04487ea614
github.com/humanlogio/humanlog-pro v0.0.0-20241029032705-0ce172ecfc87
github.com/kr/logfmt v0.0.0-20210122060352-19f9bcb100e6
github.com/lrstanley/bubblezone v0.0.0-20240914071701-b48c55a5e78e
github.com/matoous/go-nanoid v1.5.0
Expand All @@ -33,16 +32,17 @@ require (
github.com/stretchr/testify v1.9.0
github.com/teivah/broadcast v0.1.0
github.com/urfave/cli v1.22.14
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/net v0.23.0
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
golang.org/x/net v0.26.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.25.0
gonum.org/v1/gonum v0.15.1
google.golang.org/protobuf v1.33.0
google.golang.org/protobuf v1.34.2
)

require (
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/apache/arrow/go/v17 v17.0.0 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/catppuccin/go v0.2.0 // indirect
Expand All @@ -55,23 +55,34 @@ require (
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/marcboeker/go-duckdb v1.8.2 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
golang.org/x/term v0.18.0 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading