Skip to content

Commit

Permalink
build: Inject rclone version tag when testing
Browse files Browse the repository at this point in the history
This enables gitannex end-to-end tests to run on CI. Otherwise, the
version would not match and tests that check the rclone version would
fail like so:

```
=== RUN   TestEndToEnd
    e2e_test.go:199: Skipping due to rclone version: expected version "v1.67.0-DEV", but got "v1.67.0-beta.7905.220bbe24d.merge"
--- SKIP: TestEndToEnd (0.07s)
```

Issue #7625
  • Loading branch information
dmcardle committed Apr 17, 2024
1 parent 6c6a1de commit d57500d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ ifdef GOTAGS
BUILDTAGS=-tags "$(GOTAGS)"
LINTTAGS=--build-tags "$(GOTAGS)"
endif
LDFLAGS=--ldflags "-s -X github.com/rclone/rclone/fs.Version=$(TAG)"

.PHONY: rclone test_all vars version

rclone:
ifeq ($(GO_OS),windows)
go run bin/resource_windows.go -version $(TAG) -syso resource_windows_`go env GOARCH`.syso
endif
go build -v --ldflags "-s -X github.com/rclone/rclone/fs.Version=$(TAG)" $(BUILDTAGS) $(BUILD_ARGS)
go build -v $(LDFLAGS) $(BUILDTAGS) $(BUILD_ARGS)
ifeq ($(GO_OS),windows)
rm resource_windows_`go env GOARCH`.syso
endif
Expand All @@ -59,7 +60,7 @@ endif
mv -v `go env GOPATH`/bin/rclone`go env GOEXE`.new `go env GOPATH`/bin/rclone`go env GOEXE`

test_all:
go install --ldflags "-s -X github.com/rclone/rclone/fs.Version=$(TAG)" $(BUILDTAGS) $(BUILD_ARGS) github.com/rclone/rclone/fstest/test_all
go install $(LDFLAGS) $(BUILDTAGS) $(BUILD_ARGS) github.com/rclone/rclone/fstest/test_all

vars:
@echo SHELL="'$(SHELL)'"
Expand Down Expand Up @@ -87,13 +88,13 @@ test: rclone test_all

# Quick test
quicktest:
RCLONE_CONFIG="/notfound" go test -v $(BUILDTAGS) ./...
RCLONE_CONFIG="/notfound" go test -v $(LDFLAGS) $(BUILDTAGS) ./cmd/gitannex/...

racequicktest:
RCLONE_CONFIG="/notfound" go test -v $(BUILDTAGS) -cpu=2 -race ./...
RCLONE_CONFIG="/notfound" go test -v $(LDFLAGS) $(BUILDTAGS) -cpu=2 -race ./...

compiletest:
RCLONE_CONFIG="/notfound" go test -v $(BUILDTAGS) -run XXX ./...
RCLONE_CONFIG="/notfound" go test -v $(LDFLAGS) $(BUILDTAGS) -run XXX ./...

# Do source code quality checks
check: rclone
Expand Down

0 comments on commit d57500d

Please sign in to comment.