Skip to content

Commit

Permalink
maint: update go version and docs (#223)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?

- preparation for release

## Short description of the changes

- (try to update licenses, apparently no licenses needed updates for
this release but since it took these changes to find that out I figured
they were worth keeping)
- add Makefile based on Refinery's Makefile for easier license updates
(and easier testing 😄 )
- update version in `.go-version` to match #222 
- update releasing file to use new make targets and add more detail to
process
- add verify-licenses to test step in ci 

## How to verify that this has the expected result

run the make targets and it should all work
  • Loading branch information
JamieDanielson authored Oct 16, 2024
1 parent ea8e3ac commit 550ff37
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 8 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
- run:
name: go_test
command: go test -v ./...
- run: make verify-licenses

build:
executor: linuxgo
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.3
1.23.2
56 changes: 56 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables

GOTESTCMD = $(if $(shell command -v gotestsum),gotestsum --junitfile ./test_results/$(1).xml --format testname --,go test)

.PHONY: test
#: run all tests
test: test_with_race test_all

.PHONY: test_with_race
#: run only tests tagged with potential race conditions
test_with_race: test_results
@echo
@echo "+++ testing - race conditions?"
@echo
$(call GOTESTCMD,$@) -tags race --race --timeout 60s -v ./...

.PHONY: test_all
#: run all tests, but with no race condition detection
test_all: test_results
@echo
@echo "+++ testing - all the tests"
@echo
$(call GOTESTCMD,$@) -tags all --timeout 60s -v ./...

test_results:
@mkdir -p test_results

.PHONY: install-tools
install-tools:
go install github.com/google/go-licenses/[email protected]

.PHONY: update-licenses
update-licenses: install-tools
rm -rf LICENSES; \
#: We ignore the standard library (go list std) as a workaround for \
"https://github.com/google/go-licenses/issues/244." The awk script converts the output \
of `go list std` (line separated modules) to the input that `--ignore` expects (comma separated modules).
go-licenses save --save_path LICENSES --ignore "github.com/honeycombio/buildevents" \
--ignore $(shell go list std | awk 'NR > 1 { printf(",") } { printf("%s",$$0) } END { print "" }') ./;


.PHONY: verify-licenses
verify-licenses: install-tools
go-licenses save --save_path temp --ignore "github.com/honeycombio/buildevents" \
--ignore $(shell go list std | awk 'NR > 1 { printf(",") } { printf("%s",$$0) } END { print "" }') ./; \
chmod +r temp; \
if diff temp LICENSES; then \
echo "Passed"; \
rm -rf temp; \
else \
echo "LICENSES directory must be updated. Run make update-licenses"; \
rm -rf temp; \
exit 1; \
fi; \
32 changes: 25 additions & 7 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
# Releasing

- Use [go-licenses](https://github.com/google/go-licenses) to ensure all project dependency licenses are correctly represented in this repository:
- Install go-licenses (if not already installed) `go install github.com/google/go-licenses@latest`
- Run and save licenses `go-licenses save github.com/honeycombio/buildevents --save_path="./LICENSES"`
- If there are any changes, submit a separate PR to update licenses.
- Check that licenses are current with `make verify-licenses`
- If there are any changes, submit a separate PR to update licenses using `make update-licenses`.
- Prep update PR for the [orb](https://github.com/honeycombio/buildevents-orb) with the new version of buildevents.
- Update `CHANGELOG.md` with the changes since the last release. Consider automating with a command such as these two:
- `git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline > new-in-this-release.log`
- `git log --pretty='%C(green)%d%Creset- %s | [%an](https://github.com/)'`
- Update `CHANGELOG.md` with the changes since the last release.
- Use below command to get a list of all commits since last release

```sh
git log <last-release-tag>..HEAD --pretty='%Creset- %s | [%an](https://github.com/%an)'
```

- Copy the output from the command above into the top of [changelog](./CHANGELOG.md)
- fix each `https://github.com/<author-name>` to point to the correct github username
(the `git log` command can't do this automatically)
- organize each commit based on their prefix into below three categories:
```sh
### Features
- <a-commit-with-feat-prefix>
### Fixes
- <a-commit-with-fix-prefix>
### Maintenance
- <a-commit-with-maintenance-prefix>
```
- Commit changes, push, and open a release preparation pull request for review.
- Once the pull request is merged, fetch the updated `main` branch.
- Apply a tag for the new version on the merged commit (e.g. `git tag -a v2.3.1 -m "v2.3.1"`)
Expand Down

0 comments on commit 550ff37

Please sign in to comment.