Because this package uses internal
packages, all fork development has to happen under $GOPATH/src/github.com/ably/ably-go
to prevent use of internal package not allowed
errors.
- Fork
github.com/ably/ably-go
- go to the
ably-go
directory:cd $GOPATH/src/github.com/ably/ably-go
- add your fork as a remote:
git remote add fork [email protected]:your-username/ably-go
- create your feature branch:
git checkout -b my-new-feature
- commit your changes (
git commit -am 'Add some feature'
) - ensure you have added suitable tests and the test suite is passing for both JSON and MessagePack protocols (see the Running Tests section below for more details about tests including the commands to run them).
- push to the branch:
git push fork my-new-feature
- create a new Pull Request.
- Install godoc globally via
go get
and run at root
godoc -http=:8000
- Open the link http://localhost:8000/ for viewing the documentation.
- Export
godoc
using latest version of gopages
gopages -brand-description "Go client library for Ably realtime messaging service." -brand-title "Ably Go SDK"
godoc html
is exported todist
and can be served usingpython3 http.server
cd dist
py -m http.server 8000
- Open the link http://localhost:8000/ for viewing the documentation.
This project contains two types of test. Test which use the ablytest
package and tests which dont.
At each stage of the CI pipeline, test results are uploaded to a test observability server
The tests which don't make use of the ablytest
package are considered unit tests. These tests exist in files which are suffixed _test.go
. They run in the CI pipeline at the step Unit Tests
. They can be run locally with the command:
go test -v -tags=unit ./...
When adding new unit tests, the following build tag must be included at the top of the file to exclude these tests from running in CI as part of the Integration test step.
//go:build !integration
// +build !integration
The tests which use the package ablytest
are considered integration tests. These tests take longer to run than the unit tests and are mostly run in a sandbox environment. They are dependent on the sandbox environment being available and will fail if the environment is experiencing issues. There are some known issues for random failures in a few of the tests, so some of these tests may fail unexpectedly from time to time.
Please note that these tests are not true integration tests as rather than using the public API, they rely on export_test.go
to expose private functionality so that it can be tested. These tests exist in files which are suffixed _integration_test.go
. They run twice in the CI pipeline at the steps Integration Tests with JSON Protocol
and Integration Tests with MessagePack Protocol
. To run these tests locally, they have a dependency on a git submodule being present, so it is necessary clone the project with:
git clone [email protected]:ably/ably-go.git --recurse-submodules
The tests can be run with the commands:
export ABLY_PROTOCOL="application/json" && go test -tags=integration -p 1 -race -v -timeout 120m ./...
export ABLY_PROTOCOL="application/x-msgpack" && go test -tags=integration -p 1 -race -v -timeout 120m ./...
Depending on which protocol they are to be run for. It is also necessary to clean the test cache in between runs of these tests which can be done with the command:
go clean -testcache
When adding new integration tests, the following build tag must be included at the top of the file to exclude these tests for running in CI as part of the Unit test step.
//go:build !unit
// +build !unit
Starting with release 1.2, this library uses semantic versioning. For each release, the following needs to be done:
- Create a branch for the release, named like
release/1.2.3
(where1.2.3
is the new version number) - Replace all references of the current version number with the new version number and commit the changes
- Run
github_changelog_generator
to automate the update of the CHANGELOG. This may require some manual intervention, both in terms of how the command is run and how the change log file is modified. Your mileage may vary:
- The command you will need to run will look something like this:
github_changelog_generator -u ably -p ably-go --since-tag v1.2.3 --output delta.md --token $GITHUB_TOKEN_WITH_REPO_ACCESS
. Generate token here. - Using the command above,
--output delta.md
writes changes made after--since-tag
to a new file - The contents of that new file (
delta.md
) then need to be manually inserted at the top of theCHANGELOG.md
, changing the "Unreleased" heading and linking with the current version numbers - Also ensure that the "Full Changelog" link points to the new version tag instead of the
HEAD
- Commit this change:
git add CHANGELOG.md && git commit -m "Update change log."
- Make a PR against
main
- Once the PR is approved, merge it into
main
- Add a tag to the new
main
head commit and push to origin such asgit tag v1.2.3 && git push origin v1.2.3
- Create the release on Github, from the new tag, including populating the release notes
- Create the entry on the Ably Changelog (via headwayapp)