Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
go:
name: go vet + test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: go vet
run: go vet ./...
- name: go test
run: go test ./...

compat:
name: compat (CONTRACT machine-attestation)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: resolve compat dependency
# The compat module lives at github.com/quantcli/common/compat
# under a subpath. `go mod tidy` materializes go.sum for it on
# first run; subsequent runs are cache-served.
run: go mod tidy
- name: build crono-export
run: go build -o /tmp/crono-export .
- name: run compat suite
env:
# Path the compat-tagged test reads from os.Getenv.
CRONO_EXPORT_BIN: /tmp/crono-export
run: go test -tags=compat -run TestContractDates ./...
41 changes: 41 additions & 0 deletions compat_contract_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//go:build compat

// Compat-test entry point for crono-export-cli.
//
// This file is only compiled under the `compat` build tag, so it does
// not affect the default `go test ./...` run. CI invokes it as
// `go test -tags=compat ./...` after building the export binary and
// exposing its path through CRONO_EXPORT_BIN.
//
// The actual assertions live in github.com/quantcli/common/compat.
// Drift between this CLI and CONTRACT.md surfaces as a failure here.
package main_test

import (
"os"
"testing"

"github.com/quantcli/common/compat"
"github.com/quantcli/common/compat/dates"
)

func TestContractDates(t *testing.T) {
bin := os.Getenv("CRONO_EXPORT_BIN")
if bin == "" {
t.Skip("CRONO_EXPORT_BIN not set; skipping compat suite")
}
// crono is cobra-based: --since/--until live on each data-producing
// subcommand, not the root binary. The compat suite dispatches per
// subcommand under a `subcommand=NAME/...` subtree so any single
// regression surfaces as a named subtest failure.
dates.RunContract(t, compat.Runner{
Binary: bin,
Subcommands: []string{
"biometrics",
"exercises",
"nutrition",
"servings",
"notes",
},
})
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.25.5

require (
github.com/jrmycanady/gocronometer v1.5.1
github.com/quantcli/common/compat v0.0.0-20260510225630-4c588c19cd1b
github.com/spf13/cobra v1.10.2
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jrmycanady/gocronometer v1.5.1 h1:m2J31jEuLlL4RRdQLY33IFs4TAwmfevvJYl2SZxBSQ0=
github.com/jrmycanady/gocronometer v1.5.1/go.mod h1:swnvYB6twU20LDzNpAz8JOX5mCHktTW06zlSXmmyZWc=
github.com/quantcli/common/compat v0.0.0-20260510225630-4c588c19cd1b h1:fO7EfkEqzLRC8Ev22jIq05fPs+JwAB7bCDy6FA+GA5k=
github.com/quantcli/common/compat v0.0.0-20260510225630-4c588c19cd1b/go.mod h1:VBC/zEphSZgCZS1rhWsR3A8EWYSbTkP/MwqWHL7266s=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
Expand Down
Loading