-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go: use internal version string (#649)
**Public-Facing Changes** None. **Description** With context from golang/go#29228, the result of runtime/debug.BuildInfo.Main.Version is not well defined. Here we use an internally-defined Version as our library version in all contexts. We also add a test when using a go library release tag `go/mcap/v1.2.3` that the Version string is correct. This PR also changes the behaviour of `Writer` to only append the existing library version if it's different from the current version. This removes the awkward behaviour of `mcap filter` where the resulting mcap Library would be `mcap go #(devel); mcap go #(devel); mcap go #(devel)...`. Fixes #591
- Loading branch information
Showing
8 changed files
with
120 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,6 +323,11 @@ jobs: | |
run: go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
- run: make lint | ||
- run: make test | ||
- name: Check library version | ||
if: | | ||
!github.event.pull_request.head.repo.fork && | ||
startsWith(github.ref, 'refs/tags/go/mcap/v') | ||
run: make -C cli/mcap build && ./check_tag.sh cli/mcap/bin/mcap | ||
|
||
go-release-cli: | ||
permissions: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
# Used in go CI on tagged workflows. | ||
# Checks that the current commit is tagged with the correct MCAP library version. | ||
set -eo pipefail | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "Usage: $0 <path-to-mcap-binary>" | ||
exit 1 | ||
fi | ||
|
||
expected_tag="go/mcap/$($1 version --library)" | ||
read -ra all_tags <<< "$(git tag --points-at HEAD)" | ||
found="false" | ||
for tag in "${all_tags[@]}"; do | ||
if [ "$tag" = "$expected_tag" ]; then | ||
found="true" | ||
fi | ||
done | ||
|
||
if [ "$found" != "true" ]; then | ||
echo "failed: expected tag $expected_tag in found tags: [${all_tags[*]}]" | ||
exit 1 | ||
else | ||
echo "success" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package mcap | ||
|
||
// Version of the MCAP library. | ||
var Version = "v0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters