diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml new file mode 100644 index 00000000000..39edb3ad1f2 --- /dev/null +++ b/.github/actions/cache/action.yml @@ -0,0 +1,24 @@ +name: Cache + +description: Restore cached dependencies. + +runs: + using: 'composite' + steps: + - name: Get yarn cache directory path + shell: bash + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Restore yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + + - name: Restore node_modules + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000000..01c7e786ce3 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,32 @@ +name: Setup + +description: Setup CI environment. + +runs: + using: 'composite' + steps: + - name: Restore cache + uses: ./.github/actions/cache + + - name: Update apt packages + shell: bash + run: sudo apt update + + - name: Install Java + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '11.0.4' + + - name: Install Node + uses: actions/setup-node@v2 + with: + node-version-file: '.nvmrc' + + - name: Install JavaScript Dependencies + shell: bash + run: yarn install + + - name: Install spec linter + shell: bash + run: sudo apt-get -y install yamllint diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 00000000000..da5f08bb0b8 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,81 @@ +name: Checks + +on: [push] + +jobs: + setup: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Setup + uses: ./.github/actions/setup + + specs: + runs-on: ubuntu-20.04 + needs: setup + steps: + - uses: actions/checkout@v2 + + - name: Restore cache + uses: ./.github/actions/cache + + - name: Build + run: yarn build:spec + + - name: Validate + run: yarn validate + + - name: Lint + run: yamllint specs + + client_javascript: + runs-on: ubuntu-20.04 + needs: [setup, specs] + steps: + - uses: actions/checkout@v2 + + - name: Restore cache + uses: ./.github/actions/cache + + - name: Generate search client + run: yarn generate:js:search + + - name: Build search client + run: yarn client:build-js:search + + - name: Generate recommend client + run: yarn generate:js:recommend + + - name: Build recommend client + run: yarn client:build-js:recommend + + - name: Generate personalization client + run: yarn generate:js:personalization + + - name: Build personalization client + run: yarn client:build-js:personalization + + - name: Lint + run: yarn lint + + cts: + runs-on: ubuntu-20.04 + needs: [setup, specs, client_javascript] + steps: + - uses: actions/checkout@v2 + + - name: Restore cache + uses: ./.github/actions/cache + + - name: Generate clients + run: yarn generate + + - name: Build client + run: yarn client:build + + - name: Generate CTS + run: yarn cts:generate + + - name: Run CTS + run: yarn cts:test diff --git a/.github/workflows/client_javascript.yml b/.github/workflows/client_javascript.yml deleted file mode 100644 index d10b13ff9da..00000000000 --- a/.github/workflows/client_javascript.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: client_javascript - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-java@v2 - with: - distribution: 'zulu' - java-version: '11' - - - uses: actions/setup-node@v2 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - cache-dependency-path: 'yarn.lock' - - - name: Install Dependencies - run: yarn install - - - name: Generate search client - run: yarn generate:js:search - - - name: Build search client - run: yarn client:build-js:search - - - name: Generate recommend client - run: yarn generate:js:recommend - - - name: Build recommend client - run: yarn client:build-js:recommend - - - name: Generate personalization client - run: yarn generate:js:personalization - - - name: Build personalization client - run: yarn client:build-js:personalization - - name: Lint - run: yarn lint diff --git a/.github/workflows/cts.yml b/.github/workflows/cts.yml deleted file mode 100644 index ce512506f28..00000000000 --- a/.github/workflows/cts.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: cts - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-node@v2 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - cache-dependency-path: 'yarn.lock' - - - name: Install Dependencies - run: yarn install - - - name: Generate client - run: yarn generate:js - - - name: Build client - run: yarn client:build - - - name: Generate CTS - run: yarn cts:generate - - - name: Run CTS - run: yarn cts:test diff --git a/.github/workflows/specs.yml b/.github/workflows/specs.yml deleted file mode 100644 index 88840a75ec6..00000000000 --- a/.github/workflows/specs.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: specs - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-java@v2 - with: - distribution: 'zulu' - java-version: '11' - - - uses: actions/setup-node@v2 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - cache-dependency-path: 'yarn.lock' - - - name: Install Dependencies - run: yarn install - - - name: Build - run: yarn build:spec - - - name: Validate - run: yarn validate - - - name: Lint - run: yarn prettier --check specs diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000000..936003eef68 --- /dev/null +++ b/.yamllint @@ -0,0 +1,29 @@ +--- +yaml-files: + - '*.yml' + +rules: + line-length: disable + braces: enable + brackets: enable + colons: enable + commas: enable + comments: + level: warning + comments-indentation: + level: warning + document-end: disable + document-start: { present: false } + empty-lines: enable + empty-values: disable + hyphens: enable + indentation: enable + key-duplicates: enable + key-ordering: disable + new-line-at-end-of-file: enable + new-lines: enable + octal-values: disable + quoted-strings: disable + trailing-spaces: enable + truthy: + level: warning diff --git a/specs/analytics/paths/search/getTopFilterAttributes.yml b/specs/analytics/paths/search/getTopFilterAttributes.yml index e012e7acb56..516f9e4a9c5 100644 --- a/specs/analytics/paths/search/getTopFilterAttributes.yml +++ b/specs/analytics/paths/search/getTopFilterAttributes.yml @@ -1,2 +1,2 @@ +# handle /2/filters?search= as well get: -# handle /2/filters?search= as well diff --git a/specs/analytics/spec.yml b/specs/analytics/spec.yml index 871895b8233..fb71e428c57 100644 --- a/specs/analytics/spec.yml +++ b/specs/analytics/spec.yml @@ -13,12 +13,6 @@ security: - appId: [] apiKey: [] paths: - # ######################## - # ### Status Endpoints ### - # ######################## - /2/status: - $ref: './paths/status/getStatus.yml' - # # ################################## # ### Search Analytics Endpoints ### # ################################## @@ -48,7 +42,7 @@ paths: # $ref: './paths/search/getAttributeTopFilters.yml' # /2/countries: # $ref: './paths/search/getTopCountries.yml' - # + # ################################# # ### Click Analytics Endpoints ### # ################################# @@ -60,3 +54,9 @@ paths: # $ref: './paths/click/getClickThroughRate.yml' # /2/conversions/conversionRate: # $ref: './paths/click/getConversionRate.yml' + + # ######################## + # ### Status Endpoints ### + # ######################## + /2/status: + $ref: './paths/status/getStatus.yml' diff --git a/specs/search/spec.yml b/specs/search/spec.yml index 9ca319447a6..e75bddb1848 100644 --- a/specs/search/spec.yml +++ b/specs/search/spec.yml @@ -20,11 +20,11 @@ paths: $ref: './paths/search/search.yml' /1/indexes/*/queries: $ref: './paths/search/multipleQueries.yml' - #/1/indexes/{indexName}/facets/{facetName}/query: + # /1/indexes/{indexName}/facets/{facetName}/query: # $ref: './paths/search/searchForFacetValues.yml' - #/1/indexes/{indexName}/browse: + # /1/indexes/{indexName}/browse: # $ref: './paths/search/browse.yml' - # + # ######################### # ### Objects Endpoints ### # ######################### @@ -46,21 +46,13 @@ paths: # $ref: './paths/objects/multipleGetObjects.yml' # /1/indexes/{indexName}/{objectID}: # $ref: './paths/objects/getObject.yml' - # + # ########################## # ### Settings Endpoints ### # ########################## /1/indexes/{indexName}/settings: $ref: './paths/settings/settings.yml' - # - # ################################ - # ### Manage Indices Endpoints ### - # ################################ - /1/indexes/{indexName}/operation: - $ref: './paths/manage_indices/operationIndex.yml' - /1/indexes: - $ref: './paths/manage_indices/listIndices.yml' - # + # ########################## # ### Synonyms Endpoints ### # ########################## @@ -72,7 +64,7 @@ paths: # $ref: './paths/synonyms/clearAllSynonyms.yml' # /1/indexes/{indexName}/synonyms/search: # $ref: './paths/synonyms/searchSynonyms.yml' - # + # ###################### # ### Keys Endpoints ### # ###################### @@ -82,7 +74,7 @@ paths: # $ref: './paths/keys/key.yml' # /1/keys/{key}/restore: # $ref: './paths/keys/restoreApiKey.yml' - # + # ####################### # ### Rules Endpoints ### # ####################### @@ -94,7 +86,7 @@ paths: # $ref: './paths/rules/clearRules.yml' # /1/indexes/{indexName}/rules/search: # $ref: './paths/rules/searchRules.yml' - # + # ############################## # ### Dictionaries Endpoints ### # ############################## @@ -106,7 +98,7 @@ paths: # $ref: './paths/dictionaries/dictionarySettings.yml' # /1/dictionaries/*/languages: # $ref: './paths/dictionaries/getDictionaryLanguages.yml' - # + # ############################### # ### MultiClusters Endpoints ### # ############################### @@ -124,7 +116,7 @@ paths: # $ref: './paths/multiclusters/searchUserIds.yml' # /1/clusters/mapping/pending: # $ref: './paths/multiclusters/hasPendingMappings.yml' - # + # ####################### # ### Vault Endpoints ### # ####################### @@ -134,7 +126,7 @@ paths: # $ref: './paths/vault/appendSource.yml' # /1/security/sources/{source}: # $ref: './paths/vault/deleteSource.yml' - # + # ########################## # ### Advanced Endpoints ### # ########################## @@ -144,3 +136,11 @@ paths: # $ref: './paths/advanced/getTask.yml' # /1/isalive: # $ref: './paths/advanced/isAlive.yml' + + # ################################ + # ### Manage Indices Endpoints ### + # ################################ + /1/indexes/{indexName}/operation: + $ref: './paths/manage_indices/operationIndex.yml' + /1/indexes: + $ref: './paths/manage_indices/listIndices.yml'