ci: add reusable run-tests action and support custom test image/tag#3671
Open
Peter-Sh wants to merge 1 commit intoredis:mainfrom
Open
ci: add reusable run-tests action and support custom test image/tag#3671Peter-Sh wants to merge 1 commit intoredis:mainfrom
Peter-Sh wants to merge 1 commit intoredis:mainfrom
Conversation
These changes are to enable running nightly tests against Redis unstable builds and custom builds. The PR follows the same idea as in Jedis: redis/jedis#4425 Main changes * Created a new reusable action `.github/actions/run-tests/action.yml` that is intended to be run by workflows in this and external repositories. * Moved all the steps from `integration.yml` to the new action, with modifications allowing the use of a custom image tag instead of a baked-in version. What was changed in `integration.yml`: * Uses the run-tests action to run the tests * Allows running tests against a custom image tag (this is indicated in the run-name, if used) Docker Compose * Added the `CLIENT_LIBS_TEST_IMAGE_TAG` variable to Docker Compose. I'm using a separate `CLIENT_LIBS_TEST_IMAGE_TAG` variable to clearly separate regular versions set with REDIS_VERSION from image tags. * Added the `CLIENT_LIBS_TEST_IMAGE` variable, it's not directly used in Makefile or workflows, but is supported in run-tests action. Added it for consitency with Jedis which originally has the ability to use different image url. Changes to `Makefile` * Added direct setting of `domainsocket` and `sentineldomainsocket` properties when invoking maven because `TestSettings.java` didn't respect REDIS_ENV_WORK_DIR value and always tried to open sockets using relative paths * If `CLIENT_LIBS_TEST_IMAGE_TAG` is present, then the `version` argument is ignored. Changes to the workflow logic * `CLIENT_LIBS_TEST_IMAGE_TAG`, along with `CLIENT_LIBS_TEST_IMAGE`, is passed to `make start` if any or both are present. Then Docker Compose gets them from the environment. ``` make start CLIENT_LIBS_TEST_IMAGE=redislabsdev/client-libs-test CLIENT_LIBS_TEST_IMAGE_TAG=custom-1235-debian-amd64 ``` run-tests action allows setting a different image name using `CLIENT_LIBS_TEST_IMAGE` (not used in `integration.yml`). setup-maven action was updated from `1.8.0` to `1.19.0` to allow disabling secondary checkout using `checkout-enabled` option and avoid incorrect chekouts when using run-tests externally Minor changes * Docker Compose is started with `--quiet-pull` to reduce noise. * Docker Compose is started with the `--wait` option, which is a more correct way to wait for readiness. * `make stop` is used instead `docker-compose stop` for consistency with `make start` and to enable any tear-down logic inluded in Makefile
e8ab748 to
f1baab1
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes are to enable running nightly tests against Redis unstable builds and custom builds.
The PR follows the same idea as in Jedis: redis/jedis#4425
Main changes
.github/actions/run-tests/action.ymlthat is intended to be run by workflows in this and external repositories.integration.ymlto the new action, with modifications allowing the use of a custom image tag instead of a baked-in version.What was changed in
integration.yml:Docker Compose
CLIENT_LIBS_TEST_IMAGE_TAGvariable to Docker Compose. I'm using a separateCLIENT_LIBS_TEST_IMAGE_TAGvariable to clearly separate regular versions set withREDIS_VERSIONfrom image tags.CLIENT_LIBS_TEST_IMAGEvariable, it's not directly used in Makefile or workflows, but is supported in run-tests action. Added it for consitency with Jedis which originally has the ability to use different image url.Changes to
Makefiledomainsocketandsentineldomainsocketproperties when invoking maven becauseTestSettings.javadidn't respectREDIS_ENV_WORK_DIRvalue and always tried to open sockets using relative pathsIf
CLIENT_LIBS_TEST_IMAGE_TAGis present, then theversionargument is ignored.Changes to the workflow logic
CLIENT_LIBS_TEST_IMAGE_TAG, along withCLIENT_LIBS_TEST_IMAGE, is passed tomake startif any or both are present. Then Docker Compose gets them from the environment.run-tests action allows setting a different image name using
CLIENT_LIBS_TEST_IMAGE(not used inintegration.yml).1.8.0to1.19.0to allow disabling secondary checkout usingcheckout-enabledoption and avoid incorrect checkouts when using run-tests externally, seems to work fine.Minor changes
--quiet-pullto reduce noise.--waitoption, which is a more correct way to wait for readiness.make stopis used insteaddocker-compose stopfor consistency withmake startand to enable any tear-down logic inluded in MakefileMake sure that:
mvn formatter:formattarget. Don’t submit any formatting related changes.