From 996f818b1a96f7e827c03c84f1f3312a93f7de54 Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Tue, 4 Apr 2023 09:49:07 -0500 Subject: [PATCH] CI updates (#1835 * Add jobs for testing missing 8.x branches * Drop references to acceptance tests They were removed in 1a227459f096951032b881acce18a01352901096 * Add myself as a contributor :sunglasses: * Clean up shellcheck warnings --- .ci/jobs/elastic+elasticsearch-js+8.3.yml | 15 +++++++++++++++ .ci/jobs/elastic+elasticsearch-js+8.4.yml | 15 +++++++++++++++ .ci/jobs/elastic+elasticsearch-js+8.5.yml | 15 +++++++++++++++ .ci/jobs/elastic+elasticsearch-js+8.6.yml | 15 +++++++++++++++ .ci/jobs/elastic+elasticsearch-js+8.7.yml | 15 +++++++++++++++ .ci/run-repository.sh | 12 ++++++------ .ci/run-tests | 8 ++++---- package.json | 23 ++++++++++++++--------- 8 files changed, 99 insertions(+), 19 deletions(-) create mode 100644 .ci/jobs/elastic+elasticsearch-js+8.3.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+8.4.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+8.5.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+8.6.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+8.7.yml diff --git a/.ci/jobs/elastic+elasticsearch-js+8.3.yml b/.ci/jobs/elastic+elasticsearch-js+8.3.yml new file mode 100644 index 000000000..43362fc3c --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+8.3.yml @@ -0,0 +1,15 @@ +--- +- job: + name: elastic+elasticsearch-js+8.3 + display-name: 'elastic / elasticsearch-js # 8.3' + description: Testing the elasticsearch-js 8.3 branch. + junit_results: "*-junit.xml" + parameters: + - string: + name: branch_specifier + default: refs/heads/8.3 + description: the Git branch specifier to build (<branchName>, <tagName>, + <commitId>, etc.) + triggers: + - github + - timed: 'H */12 * * *' diff --git a/.ci/jobs/elastic+elasticsearch-js+8.4.yml b/.ci/jobs/elastic+elasticsearch-js+8.4.yml new file mode 100644 index 000000000..aa83ef601 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+8.4.yml @@ -0,0 +1,15 @@ +--- +- job: + name: elastic+elasticsearch-js+8.4 + display-name: 'elastic / elasticsearch-js # 8.3' + description: Testing the elasticsearch-js 8.4 branch. + junit_results: "*-junit.xml" + parameters: + - string: + name: branch_specifier + default: refs/heads/8.4 + description: the Git branch specifier to build (<branchName>, <tagName>, + <commitId>, etc.) + triggers: + - github + - timed: 'H */12 * * *' diff --git a/.ci/jobs/elastic+elasticsearch-js+8.5.yml b/.ci/jobs/elastic+elasticsearch-js+8.5.yml new file mode 100644 index 000000000..def3ba64c --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+8.5.yml @@ -0,0 +1,15 @@ +--- +- job: + name: elastic+elasticsearch-js+8.5 + display-name: 'elastic / elasticsearch-js # 8.5' + description: Testing the elasticsearch-js 8.5 branch. + junit_results: "*-junit.xml" + parameters: + - string: + name: branch_specifier + default: refs/heads/8.5 + description: the Git branch specifier to build (<branchName>, <tagName>, + <commitId>, etc.) + triggers: + - github + - timed: 'H */12 * * *' diff --git a/.ci/jobs/elastic+elasticsearch-js+8.6.yml b/.ci/jobs/elastic+elasticsearch-js+8.6.yml new file mode 100644 index 000000000..b9d63be7d --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+8.6.yml @@ -0,0 +1,15 @@ +--- +- job: + name: elastic+elasticsearch-js+8.6 + display-name: 'elastic / elasticsearch-js # 8.6' + description: Testing the elasticsearch-js 8.6 branch. + junit_results: "*-junit.xml" + parameters: + - string: + name: branch_specifier + default: refs/heads/8.6 + description: the Git branch specifier to build (<branchName>, <tagName>, + <commitId>, etc.) + triggers: + - github + - timed: 'H */12 * * *' diff --git a/.ci/jobs/elastic+elasticsearch-js+8.7.yml b/.ci/jobs/elastic+elasticsearch-js+8.7.yml new file mode 100644 index 000000000..fb6425583 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+8.7.yml @@ -0,0 +1,15 @@ +--- +- job: + name: elastic+elasticsearch-js+8.7 + display-name: 'elastic / elasticsearch-js # 8.7' + description: Testing the elasticsearch-js 8.7 branch. + junit_results: "*-junit.xml" + parameters: + - string: + name: branch_specifier + default: refs/heads/8.7 + description: the Git branch specifier to build (<branchName>, <tagName>, + <commitId>, etc.) + triggers: + - github + - timed: 'H */12 * * *' diff --git a/.ci/run-repository.sh b/.ci/run-repository.sh index 9ba13f5df..380d1d899 100755 --- a/.ci/run-repository.sh +++ b/.ci/run-repository.sh @@ -5,8 +5,8 @@ # TEST_SUITE -- which test suite to run: free or platinum # ELASTICSEARCH_URL -- The url at which elasticsearch is reachable, a default is composed based on STACK_VERSION and TEST_SUITE # NODE_JS_VERSION -- node js version (defined in test-matrix.yml, a default is hardcoded here) -script_path=$(dirname $(realpath -s $0)) -source $script_path/functions/imports.sh +script_path=$(dirname "$(realpath -s "$0")") +source "$script_path/functions/imports.sh" set -euo pipefail NODE_JS_VERSION=${NODE_JS_VERSION-16} @@ -24,18 +24,18 @@ echo -e "\033[1m>>>>> Build docker container >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0 docker build \ --file .ci/Dockerfile \ --tag elastic/elasticsearch-js \ - --build-arg NODE_JS_VERSION=${NODE_JS_VERSION} \ + --build-arg NODE_JS_VERSION="${NODE_JS_VERSION}" \ . echo -e "\033[1m>>>>> NPM run test:integration >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" -repo=$(realpath $(dirname $(realpath -s $0))/../) +repo=$(realpath "$(dirname "$(realpath -s "$0")")"/../) docker run \ - --network=${network_name} \ + --network="${network_name}" \ --env "TEST_ES_SERVER=${ELASTICSEARCH_URL}" \ --env "TEST_SUITE=${TEST_SUITE}" \ - --volume $repo:/usr/src/app \ + --volume "$repo:/usr/src/app" \ --volume /usr/src/app/node_modules \ --name elasticsearch-js \ --rm \ diff --git a/.ci/run-tests b/.ci/run-tests index 76bb055a3..a43400f61 100755 --- a/.ci/run-tests +++ b/.ci/run-tests @@ -1,10 +1,10 @@ #!/usr/bin/env bash # # Version 1.1 -# - Moved to .ci folder and seperated out `run-repository.sh` +# - Moved to .ci folder and separated out `run-repository.sh` # - Add `$RUNSCRIPTS` env var for running Elasticsearch dependent products -script_path=$(dirname $(realpath -s $0)) -source $script_path/functions/imports.sh +script_path=$(dirname "$(realpath -s "$0")") +source "$script_path/functions/imports.sh" set -euo pipefail echo -e "\033[1m>>>>> Start [$STACK_VERSION container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" @@ -15,7 +15,7 @@ if [[ -n "$RUNSCRIPTS" ]]; then echo -e "\033[1m>>>>> Running run-$RUNSCRIPT.sh >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" CONTAINER_NAME=${RUNSCRIPT} \ DETACH=true \ - bash .ci/run-${RUNSCRIPT}.sh + bash ".ci/run-${RUNSCRIPT}.sh" done fi diff --git a/package.json b/package.json index 49ced928f..16dc2c8fb 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,11 @@ "main": "index.js", "types": "index.d.ts", "scripts": { - "test": "npm run build && npm run lint && tap test/{unit,acceptance}/{*,**/*}.test.ts", + "test": "npm run build && npm run lint && tap test/unit/{*,**/*}.test.ts", "test:unit": "npm run build && tap test/unit/{*,**/*}.test.ts", - "test:acceptance": "npm run build && tap test/acceptance/*.test.ts", - "test:coverage-100": "npm run build && tap test/{unit,acceptance}/{*,**/*}.test.ts --coverage --100", - "test:coverage-report": "npm run build && tap test/{unit,acceptance}/{*,**/*}.test.ts --coverage && nyc report --reporter=text-lcov > coverage.lcov", - "test:coverage-ui": "npm run build && tap test/{unit,acceptance}/{*,**/*}.test.ts --coverage --coverage-report=html", + "test:coverage-100": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --100", + "test:coverage-report": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage && nyc report --reporter=text-lcov > coverage.lcov", + "test:coverage-ui": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --coverage-report=html", "test:integration": "tsc && node test/integration/index.js", "lint": "ts-standard src", "lint:fix": "ts-standard --fix src", @@ -31,10 +30,16 @@ "client", "index" ], - "author": { - "name": "Tomas Della Vedova", - "company": "Elastic BV" - }, + "contributors": [ + { + "name": "Tomas Della Vedova", + "company": "Elastic BV" + }, + { + "name": "Josh Mock", + "company": "Elastic BV" + } + ], "license": "Apache-2.0", "repository": { "type": "git",