diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..aa766c7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,85 @@ +name: CI + +on: + push: + branches: + - main + - nightly + pull_request: + branches: + - main + - nightly + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + go-test: + name: Go tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.24" + cache-dependency-path: core/go.sum + + - name: Vet + working-directory: core + run: go vet ./... + + - name: Test + working-directory: core + run: go test -race -timeout 5m ./... + + sdk-build: + name: SDK typecheck, build, unit tests + runs-on: ubuntu-latest + defaults: + run: + working-directory: sdk + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm typecheck + + - name: Build + run: pnpm build + + - name: Unit tests + run: pnpm vitest run tests/unit + + version-sanity: + name: Verify VERSION ↔ sdk/package.json sync + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Compare versions + run: | + ROOT=$(tr -d '[:space:]' < VERSION) + SDK=$(node -p "require('./sdk/package.json').version") + if [ "$ROOT" != "$SDK" ]; then + echo "::warning::/VERSION ($ROOT) and sdk/package.json ($SDK) differ. Run 'make -C core bump VER=$ROOT' to sync." + else + echo "Versions in sync: $ROOT" + fi diff --git a/.github/workflows/publish-sdk.yml b/.github/workflows/publish-sdk.yml index dc4f305..1c52d58 100644 --- a/.github/workflows/publish-sdk.yml +++ b/.github/workflows/publish-sdk.yml @@ -28,6 +28,20 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Verify VERSION file matches release tag + if: github.event_name == 'release' + working-directory: . + run: | + TAG="${{ github.event.release.tag_name }}" + EXPECTED="${TAG#v}" + EXPECTED="${EXPECTED%-nightly}" + ACTUAL=$(tr -d '[:space:]' < VERSION) + if [ "$EXPECTED" != "$ACTUAL" ]; then + echo "::error::Tag $TAG implies version '$EXPECTED' but /VERSION says '$ACTUAL'." + echo "::error::Run 'make -C core bump VER=$EXPECTED' and commit before tagging." + exit 1 + fi + - name: Set up Node.js uses: actions/setup-node@v4 with: diff --git a/.github/workflows/release-apt.yml b/.github/workflows/release-apt.yml index 2ca5b67..3d92970 100644 --- a/.github/workflows/release-apt.yml +++ b/.github/workflows/release-apt.yml @@ -25,6 +25,19 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Verify VERSION file matches release tag + if: github.event_name == 'release' + run: | + TAG="${{ github.event.release.tag_name }}" + EXPECTED="${TAG#v}" + EXPECTED="${EXPECTED%-nightly}" + ACTUAL=$(tr -d '[:space:]' < VERSION) + if [ "$EXPECTED" != "$ACTUAL" ]; then + echo "::error::Tag $TAG implies version '$EXPECTED' but /VERSION says '$ACTUAL'." + echo "::error::Run 'make -C core bump VER=$EXPECTED' and commit before tagging." + exit 1 + fi + - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f949e51..2ad7fd1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,29 +13,42 @@ permissions: jobs: build-release: runs-on: ubuntu-latest - + steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 # Need full history for changelog - + + - name: Verify VERSION file matches release tag + run: | + TAG="${GITHUB_REF_NAME}" + EXPECTED="${TAG#v}" + EXPECTED="${EXPECTED%-nightly}" + ACTUAL=$(tr -d '[:space:]' < VERSION) + if [ "$EXPECTED" != "$ACTUAL" ]; then + echo "::error::Tag $TAG implies version '$EXPECTED' but /VERSION says '$ACTUAL'." + echo "::error::Run 'make -C core bump VER=$EXPECTED' and commit before tagging." + exit 1 + fi + echo "VERSION file matches tag: $ACTUAL" + - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: '1.24' cache-dependency-path: core/go.sum - + - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5 + uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser - version: latest + version: '~> v2' args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} - + - name: Upload artifacts uses: actions/upload-artifact@v4 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b07a341..cba62b2 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,7 +1,8 @@ -# GoReleaser Configuration for DeBros Network -# Builds and releases orama (CLI) and orama-node binaries -# Publishes to: GitHub Releases, Homebrew, and apt (.deb packages) +# GoReleaser v2 Configuration for DeBros Network +# Builds and releases orama (CLI) and orama-node binaries. +# Publishes to: GitHub Releases, Homebrew (stable only), and apt (.deb packages). +version: 2 project_name: orama-network env: @@ -9,7 +10,8 @@ env: before: hooks: - - go -C core mod tidy + - cmd: go mod tidy + dir: core builds: # orama CLI binary @@ -50,9 +52,9 @@ builds: archives: # Tar.gz archives for orama CLI - id: orama-archives - builds: + ids: - orama - format: tar.gz + formats: [tar.gz] name_template: "orama_{{ .Version }}_{{ .Os }}_{{ .Arch }}" files: - README.md @@ -60,9 +62,9 @@ archives: # Tar.gz archives for orama-node - id: orama-node-archives - builds: + ids: - orama-node - format: tar.gz + formats: [tar.gz] name_template: "orama-node_{{ .Version }}_{{ .Os }}_{{ .Arch }}" files: - README.md @@ -73,7 +75,7 @@ nfpms: # orama CLI .deb package - id: orama-deb package_name: orama - builds: + ids: - orama vendor: DeBros homepage: https://github.com/DeBrosDAO/orama @@ -95,7 +97,7 @@ nfpms: # orama-node .deb package - id: orama-node-deb package_name: orama-node - builds: + ids: - orama-node vendor: DeBros homepage: https://github.com/DeBrosDAO/orama @@ -114,7 +116,9 @@ nfpms: lintian_overrides: - statically-linked-binary -# Homebrew tap for macOS (orama CLI only) +# Homebrew tap for macOS (orama CLI only). +# Stable releases only — prereleases (nightly) are skipped so we don't +# pollute the tap or fight a 401 on a missing HOMEBREW_TAP_TOKEN. brews: - name: orama ids: @@ -123,10 +127,11 @@ brews: owner: DeBrosDAO name: homebrew-tap token: "{{ .Env.HOMEBREW_TAP_TOKEN }}" - folder: Formula + directory: Formula homepage: https://github.com/DeBrosDAO/orama description: CLI tool for the Orama decentralized network license: MIT + skip_upload: '{{ if .Prerelease }}true{{ else }}false{{ end }}' install: | bin.install "orama" test: | @@ -137,7 +142,7 @@ checksum: algorithm: sha256 snapshot: - name_template: "{{ incpatch .Version }}-next" + version_template: "{{ incpatch .Version }}-next" changelog: sort: asc diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8afe117 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.122.8 diff --git a/core/Makefile b/core/Makefile index c5a30a7..75d9d38 100644 --- a/core/Makefile +++ b/core/Makefile @@ -61,9 +61,11 @@ test-e2e-quick: # Network - Distributed P2P Database System # Makefile for development and build tasks -.PHONY: build clean test deps tidy fmt vet lint install-hooks push-devnet push-testnet rollout-devnet rollout-testnet release +.PHONY: build clean test deps tidy fmt vet lint install-hooks push-devnet push-testnet rollout-devnet rollout-testnet release bump -VERSION := 0.122.7 +# Single source of truth — repo-root VERSION file. Update with `make bump VER=X.Y.Z` +# or by editing /VERSION directly. Release workflows verify this matches the tag. +VERSION := $(shell cat ../VERSION 2>/dev/null | tr -d '[:space:]' || echo unknown) COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)' @@ -130,6 +132,17 @@ rollout-devnet: rollout-testnet: ./bin/orama node rollout --env testnet --yes +# Bump the repo-root VERSION file and sync sdk/package.json. +# Usage: make bump VER=0.122.9 +bump: + @if [ -z "$(VER)" ]; then \ + echo "Usage: make bump VER=X.Y.Z"; exit 1; \ + fi + @echo "$(VER)" > ../VERSION + @cd ../sdk && npm version $(VER) --no-git-tag-version > /dev/null + @echo "Bumped VERSION and sdk/package.json to $(VER)" + @echo "Next: git add ../VERSION ../sdk/package.json && git commit -m 'release: $(VER)'" + # Interactive release workflow (tag + push) release: @bash scripts/release.sh diff --git a/sdk/package.json b/sdk/package.json index 6f93304..f9eb534 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@debros/orama", - "version": "0.122.3", + "version": "0.122.8", "description": "TypeScript SDK for Orama Network - Database, PubSub, Cache, Storage, Vault, and more", "type": "module", "main": "./dist/index.js",