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
43 changes: 0 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ jobs:
echo "$module $version"
[[ $version =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]
done
- name: The previous pins are the versions right before the current ones
run: |
current=$(go list -m -f '{{.Version}}' github.com/batchstream/weir-go)
previous=$(go list -m -versions github.com/batchstream/weir-go | tr ' ' '\n' | grep -B1 -x "$current" | head -n 1)
echo "weir-go $previous then $current"
[[ $previous =~ ^v && $previous != "$current" && $(jq -er .weir_go_previous versions.json) == "$previous" ]]
server=$(jq -er .weir_previous_source versions.json)
echo "server $server then $(jq -er .weir_source versions.json)"
[[ $server =~ ^[0-9a-f]{40}$ && $server != "$(jq -er .weir_source versions.json)" ]]
- name: Tests, vet and formatting
run: |
go mod tidy -diff
Expand All @@ -59,40 +50,6 @@ jobs:
python3 -O -m unittest discover -s scripts -p '*_test.py'
test -z "$(gofmt -l cmd internal tests)"
git diff --exit-code
version-skew:
runs-on: ubuntu-24.04
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
target: [integration-previous-server, integration-previous-sdk]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version-file: go.mod
- name: Install the pinned Weir and mongod
run: |
make prepare prepare-previous
mongod=$(scripts/mongod.sh)
printf 'WEIR_TEST_MONGODB_BINARY=%s\n' "$mongod" >> "$GITHUB_ENV"
- name: Real multi-node integration, one side a version behind
run: make ${{ matrix.target }}
- name: Upload fixture logs
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: ${{ matrix.target }}-${{ github.sha }}
path: |
/tmp/weir-tests-*/manifest.json
/tmp/weir-tests-*/cleanup.json
/tmp/weir-tests-*/*config.json
/tmp/weir-tests-*/*process.log
/tmp/weir-tests-*/docker-engine.json
retention-days: 14
blackbox:
runs-on: ubuntu-24.04
timeout-minutes: 20
Expand Down
20 changes: 1 addition & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,16 @@
.PHONY: prepare prepare-previous test integration integration-previous-server integration-previous-sdk benchmark diagnostic
.PHONY: prepare test integration benchmark diagnostic

prepare:
revision=$$(jq -er .weir_source versions.json) && \
GOBIN="$(CURDIR)/.tools" go install -ldflags "-X main.revision=$$revision" github.com/batchstream/weir/cmd/weir@$$revision

prepare-previous:
revision=$$(jq -er .weir_previous_source versions.json) && \
GOBIN="$(CURDIR)/.tools/previous" go install -ldflags "-X main.revision=$$revision" github.com/batchstream/weir/cmd/weir@$$revision

test:
go test -race -count=1 ./...
python3 -m unittest discover -s scripts -p '*_test.py'

integration:
WEIR_TEST_BINARY="$(CURDIR)/.tools/weir" go test -race -tags=integration -count=1 -timeout=10m -v ./tests/integration

integration-previous-server:
WEIR_TEST_BINARY="$(CURDIR)/.tools/previous/weir" go test -race -tags=integration,previous -count=1 -timeout=10m -v ./tests/integration

# GOFLAGS, not a flag of go test, so that any binary a test builds uses the same SDK.
# The SDK brings the protocol version it was released with, as it does for a caller.
integration-previous-sdk:
mkdir -p .tools
cp go.mod .tools/previous-sdk.mod
cp go.sum .tools/previous-sdk.sum
version=$$(jq -er .weir_go_previous versions.json) && \
protocol=$$(go mod download -json github.com/batchstream/weir-go@$$version | jq -er .GoMod | xargs awk '$$1 == "github.com/batchstream/weir-protocol" {print $$2}') && \
go get -modfile=.tools/previous-sdk.mod github.com/batchstream/weir-go@$$version github.com/batchstream/weir-protocol@$$protocol
GOFLAGS=-modfile="$(CURDIR)/.tools/previous-sdk.mod" WEIR_TEST_BINARY="$(CURDIR)/.tools/weir" go test -race -tags=integration,previous -count=1 -timeout=10m -v ./tests/integration

benchmark:
go run ./cmd/weir-lab -mode saturation -weir "$(CURDIR)/.tools/weir" -backend all -database-cpus 1 -client-processes 4 -concurrency-levels 4,8,32,128,256 -batch-sizes 1 -records 8192 -write-percent 0 -rounds 3 -warmup-duration 10s -duration 20s -output results/local/benchmark

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ python3 -m unittest discover -s scripts -p '*_test.py'
```

[versions.json](versions.json) pins the Weir server and database images. `go.mod`
pins the SDK and protocol. See [CI and output](docs/ci.md) before changing a pin.
pins the SDK and protocol. See [CI and output](docs/ci.md) for what CI runs.

- Contributing: [CONTRIBUTING.md](CONTRIBUTING.md)
- Security reports: [SECURITY.md](SECURITY.md)
Expand Down
18 changes: 3 additions & 15 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,14 @@ What CI runs, which versions it pins and where output goes.

The Weir server commit and the database images are pinned in
[versions.json](../versions.json) by full commit; `go.mod` pins released SDK and
protocol versions without replacements. `versions.json` also names the previous
server and SDK, which CI tests against the current other side. The tests depend
on no server module or package.
protocol versions without replacements. The tests depend on no server module or
package.

## CI

CI runs unit, race, vet and module-boundary checks, real multi-node integration,
and verified ordinary and Lua comparison smoke tests on both databases, and
uploads results and fixture logs as a workflow artifact. It also runs the
integration tests with each side one version behind, since a server and its
clients are not upgraded together. After `make prepare prepare-previous`, `make
integration-previous-server` uses the current SDK with the `weir_previous_source`
server and `make integration-previous-sdk` uses the current server with the
`weir_go_previous` SDK and the protocol version it was released with. When pinning
a new server or SDK, move that side's previous pin to the version it replaces; CI
checks that each differs from the current one and that the SDK's is the release
right before it. Both runs set the `previous` build tag: a test or helper that
only the current versions can pass goes in a file with a `!previous` build
constraint so that the rest keeps running, until the previous pin has that
behaviour too.
uploads results and fixture logs as a workflow artifact.

## Output

Expand Down
2 changes: 0 additions & 2 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"weir_source": "5107986b882da60751403c7e05bbbebdb12b3cdb",
"weir_previous_source": "3717479d2820c8e99927d4e91f7c32298e0c32b1",
"weir_go_previous": "v0.24.0",
"mongodb_version": "8.0.32",
"mongodb_image": "mongo@sha256:d0d926f94df099bff534b7ee5b5986458131a22489dfff8664509af0c1e2ca9c",
"elasticsearch_version": "8.19.22",
Expand Down
Loading