-
Notifications
You must be signed in to change notification settings - Fork 79
Use cargo make #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Use cargo make #133
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
[config] | ||
default_to_workspace = false | ||
|
||
[env] | ||
# Determines the version of Elasticsearch docker container used | ||
STACK_VERSION = "8.0.0-SNAPSHOT" | ||
# Determines the distribution of docker container used. Either xpack or oss | ||
TEST_SUITE = "xpack" | ||
|
||
[tasks.set-oss-env] | ||
category = "Elasticsearch" | ||
description = "Sets ELASTICSEARCH_URL environment variable for later tasks when oss test suite used" | ||
private = true | ||
condition = { env = { "TEST_SUITE" = "oss" } } | ||
env = { "ELASTICSEARCH_URL" = "http://localhost:9200" } | ||
|
||
[tasks.set-xpack-env] | ||
category = "Elasticsearch" | ||
description = "Sets ELASTICSEARCH_URL environment variable for later tasks when xpack test suite used" | ||
private = true | ||
condition = { env = { "TEST_SUITE" = "xpack" } } | ||
env = { "ELASTICSEARCH_URL" = "https://elastic:changeme@localhost:9200" } | ||
|
||
[tasks.run-yaml-test-runner] | ||
category = "Elasticsearch" | ||
description = ''' | ||
Runs yaml_test_runner crate to generate tests from yaml files for a given Elasticsearch commit. | ||
The commit to use is retrieved from the running Elasticsearch instance | ||
''' | ||
private = true | ||
script = ["cargo run -p yaml_test_runner -- -u ${ELASTICSEARCH_URL}"] | ||
dependencies = ["start-elasticsearch"] | ||
|
||
[tasks.run-yaml-test-runner.windows] | ||
script = ["cargo run -p yaml_test_runner -- -u %ELASTICSEARCH_URL%"] | ||
|
||
[tasks.test-yaml-test-runner] | ||
category = "Elasticsearch" | ||
private = true | ||
condition = { env_set = [ "ELASTICSEARCH_URL" ] } | ||
env = { "ES_TEST_SERVER" = "${ELASTICSEARCH_URL}" } | ||
command = "cargo" | ||
args = ["test", "-p", "yaml_test_runner", "--", "--test-threads=1"] | ||
dependencies = ["generate-yaml-tests"] | ||
|
||
[tasks.test-elasticsearch] | ||
category = "Elasticsearch" | ||
private = true | ||
condition = { env_set = [ "ELASTICSEARCH_URL" ], env = { "TEST_SUITE" = "xpack" } } | ||
env = { "ES_TEST_SERVER" = "${ELASTICSEARCH_URL}" } | ||
command = "cargo" | ||
args = ["test", "-p", "elasticsearch"] | ||
dependencies = ["start-elasticsearch"] | ||
|
||
[tasks.run-api-generator] | ||
category = "Elasticsearch" | ||
private = true | ||
command = "cargo" | ||
args = ["run", "-p", "api_generator"] | ||
|
||
# ============ | ||
# Public tasks | ||
# ============ | ||
|
||
[tasks.start-elasticsearch] | ||
category = "Elasticsearch" | ||
description = "Starts Elasticsearch docker container with the given version and distribution" | ||
condition = { env_set = [ "STACK_VERSION", "TEST_SUITE" ] } | ||
script = ["DETACH=true bash .ci/run-elasticsearch.sh"] | ||
dependencies = ["set-oss-env", "set-xpack-env"] | ||
|
||
[tasks.start-elasticsearch.windows] | ||
script = ["bash -c \"STACK_VERSION=%STACK_VERSION% TEST_SUITE=%TEST_SUITE% DETACH=true bash .ci/run-elasticsearch.sh\""] | ||
|
||
[tasks.stop-elasticsearch] | ||
category = "Elasticsearch" | ||
description = "Stops Elasticsearch docker container, if running" | ||
condition = { env_set = [ "STACK_VERSION", "TEST_SUITE" ] } | ||
script = ["CLEANUP=true bash .ci/run-elasticsearch.sh"] | ||
dependencies = ["set-oss-env", "set-xpack-env"] | ||
|
||
[tasks.stop-elasticsearch.windows] | ||
script = ["bash -c \"STACK_VERSION=%STACK_VERSION% TEST_SUITE=%TEST_SUITE% CLEANUP=true bash .ci/run-elasticsearch.sh\""] | ||
|
||
[tasks.test-yaml] | ||
category = "Elasticsearch" | ||
description = "Generates and runs yaml_test_runner crate xpack/oss tests against a given Elasticsearch version" | ||
condition = { env_set = [ "STACK_VERSION", "TEST_SUITE" ] } | ||
dependencies = ["generate-yaml-tests", "test-yaml-test-runner"] | ||
run_task = "stop-elasticsearch" | ||
|
||
[tasks.test] | ||
category = "Elasticsearch" | ||
clear = true | ||
description = "Runs Elasticsearch crate tests against a given Elasticsearch version" | ||
env = { "TEST_SUITE" = { value = "xpack", condition = { env_set = ["TEST_SUITE"] } } } | ||
dependencies = ["test-elasticsearch"] | ||
run_task = "stop-elasticsearch" | ||
|
||
[tasks.generate-yaml-tests] | ||
category = "Elasticsearch" | ||
description = "Generates Elasticsearch client tests from YAML tests" | ||
dependencies = ["run-yaml-test-runner"] | ||
run_task = "format" | ||
|
||
[tasks.generate-api] | ||
category = "Elasticsearch" | ||
description = "Generates Elasticsearch client from REST API specs" | ||
dependencies = ["run-api-generator"] | ||
run_task = "format" | ||
|
||
|
||
[tasks.default] | ||
clear = true | ||
script = [''' | ||
echo | ||
echo "Main tasks:" | ||
echo "- generate-api: Generates Elasticsearch client from REST API specs" | ||
echo "- start-elasticsearch: Starts Elasticsearch docker container with the given version and distribution" | ||
echo "- stop-elasticsearch: Stops Elasticsearch docker container, if running" | ||
echo "- test-yaml: Generates and runs yaml_test_runner crate xpack/oss tests against a given Elasticsearch version" | ||
echo "- test: Runs Elasticsearch crate tests against a given Elasticsearch version" | ||
echo | ||
echo "Most tasks use these environment variables:" | ||
echo "- STACK_VERSION (default '$STACK_VERSION'): the version of Elasticsearch" | ||
echo "- TEST_SUITE ('oss' or 'xpack', default '$TEST_SUITE'): the distribution of Elasticsearch" | ||
echo | ||
echo "Run 'cargo make --list-all-steps' for a complete list of available tasks." | ||
echo | ||
'''] | ||
|
||
[tasks.default.windows] | ||
script = [''' | ||
@echo off | ||
echo. | ||
echo Main tasks: | ||
echo - generate-api: Generates Elasticsearch client from REST API specs | ||
echo - start-elasticsearch: Starts Elasticsearch docker container with the given version and distribution | ||
echo - stop-elasticsearch: Stops Elasticsearch docker container, if running | ||
echo - test-yaml: Generates and runs yaml_test_runner crate xpack/oss tests against a given Elasticsearch version | ||
echo - test: Runs Elasticsearch crate tests against a given Elasticsearch version | ||
echo. | ||
echo Most tasks use these environment variables: | ||
echo - STACK_VERSION (default '$STACK_VERSION'): the version of Elasticsearch | ||
echo - TEST_SUITE ('oss' or 'xpack', default '$TEST_SUITE'): the distribution of Elasticsearch | ||
echo. | ||
echo Run 'cargo make --list-all-steps' for a complete list of available tasks. | ||
echo. | ||
'''] |
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.