diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml index 23227a8400..c6a0db5f33 100644 --- a/.github/actions/cache/action.yml +++ b/.github/actions/cache/action.yml @@ -16,35 +16,35 @@ runs: uses: actions/cache@v2 with: path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-search/dist - key: ${{ runner.os }}-js-client-search-${{ hashFiles('yarn.lock') }} + key: ${{ runner.os }}-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/client-search/**') }} - name: Restore built JavaScript recommend client if: ${{ inputs.job == 'cts' }} uses: actions/cache@v2 with: path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/recommend/dist - key: ${{ runner.os }}-js-client-recommend-${{ hashFiles('yarn.lock') }} + key: ${{ runner.os }}-js-client-recommend-${{ hashFiles('clients/algoliasearch-client-javascript/recommend/**') }} - name: Restore built JavaScript personalization client if: ${{ inputs.job == 'cts' }} uses: actions/cache@v2 with: path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-personalization/dist - key: ${{ runner.os }}-js-client-personalization-${{ hashFiles('yarn.lock') }} + key: ${{ runner.os }}-js-client-personalization-${{ hashFiles('clients/algoliasearch-client-javascript/client-personalization/**') }} - name: Restore built JavaScript analytics client if: ${{ inputs.job == 'cts' }} uses: actions/cache@v2 with: path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-analytics/dist - key: ${{ runner.os }}-js-client-analytics-${{ hashFiles('yarn.lock') }} + key: ${{ runner.os }}-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/client-analytics/**') }} - name: Restore built Java client if: ${{ inputs.job == 'cts' }} uses: actions/cache@v2 with: path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-java-2/target - key: ${{ runner.os }}-java-client-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-java-client-${{ hashFiles('clients/algoliasearch-client-java-2/**') }} # setup yarn - name: Get yarn cache directory path diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index e5686cc817..58dc08e778 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -97,4 +97,4 @@ outputs: # cts variables RUN_CTS: description: 'Determine if the `cts` job should run' - value: ${{ github.ref_name == 'main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SPECS_CHANGED > 0 || steps.diff.outputs.CTS_CHANGED > 0 || steps.diff.outputs.JS_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 || steps.diff.outputs.JAVA_CLIENT_CHANGED > 0 || steps.diff.outputs.JAVA_TEMPLATE_CHANGED > 0 }} + value: ${{ github.ref_name == 'main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SPECS_CHANGED > 0 || steps.diff.outputs.TESTS_CHANGED > 0 || steps.diff.outputs.JS_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 || steps.diff.outputs.JAVA_CLIENT_CHANGED > 0 || steps.diff.outputs.JAVA_TEMPLATE_CHANGED > 0 }} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a2ee8194f2..83cecf9a00 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -102,18 +102,21 @@ jobs: - name: Restore cache uses: ./.github/actions/cache + - name: Cache search client + id: cache + uses: actions/cache@v2 + with: + path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-search/dist + key: ${{ runner.os }}-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/client-search/**') }} + - name: Generate search client + if: steps.cache.outputs.cache-hit != 'true' run: yarn generate javascript search - name: Build search client + if: steps.cache.outputs.cache-hit != 'true' run: yarn build:clients javascript search - - name: Cache search client - uses: actions/cache@v2 - with: - path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-search/dist - key: ${{ runner.os }}-js-client-search-${{ hashFiles('yarn.lock') }} - client_javascript_recommend: runs-on: ubuntu-20.04 needs: [specs_recommend] @@ -124,18 +127,21 @@ jobs: - name: Restore cache uses: ./.github/actions/cache + - name: Cache recommend client + id: cache + uses: actions/cache@v2 + with: + path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/recommend/dist + key: ${{ runner.os }}-js-client-recommend-${{ hashFiles('clients/algoliasearch-client-javascript/recommend/**') }} + - name: Generate recommend client + if: steps.cache.outputs.cache-hit != 'true' run: yarn generate javascript recommend - name: Build recommend client + if: steps.cache.outputs.cache-hit != 'true' run: yarn build:clients javascript recommend - - name: Cache recommend client - uses: actions/cache@v2 - with: - path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/recommend/dist - key: ${{ runner.os }}-js-client-recommend-${{ hashFiles('yarn.lock') }} - client_javascript_perso: runs-on: ubuntu-20.04 needs: [specs_perso] @@ -146,18 +152,21 @@ jobs: - name: Restore cache uses: ./.github/actions/cache + - name: Cache personalization client + id: cache + uses: actions/cache@v2 + with: + path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-personalization/dist + key: ${{ runner.os }}-js-client-personalization-${{ hashFiles('clients/algoliasearch-client-javascript/client-personalization/**') }} + - name: Generate personalization client + if: steps.cache.outputs.cache-hit != 'true' run: yarn generate javascript personalization - name: Build personalization client + if: steps.cache.outputs.cache-hit != 'true' run: yarn build:clients javascript personalization - - name: Cache personalization client - uses: actions/cache@v2 - with: - path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-personalization/dist - key: ${{ runner.os }}-js-client-personalization-${{ hashFiles('yarn.lock') }} - client_javascript_analytics: runs-on: ubuntu-20.04 needs: [specs_analytics] @@ -168,18 +177,21 @@ jobs: - name: Restore cache uses: ./.github/actions/cache + - name: Cache analytics client + id: cache + uses: actions/cache@v2 + with: + path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-analytics/dist + key: ${{ runner.os }}-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/client-analytics/**') }} + - name: Generate analytics client + if: steps.cache.outputs.cache-hit != 'true' run: yarn generate javascript analytics - name: Build analytics client + if: steps.cache.outputs.cache-hit != 'true' run: yarn build:clients javascript analytics - - name: Cache analytics client - uses: actions/cache@v2 - with: - path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-analytics/dist - key: ${{ runner.os }}-js-client-analytics-${{ hashFiles('yarn.lock') }} - client_java_search: runs-on: ubuntu-20.04 needs: [specs_search] @@ -192,18 +204,21 @@ jobs: with: job: java + - name: Cache built clients + id: cache + uses: actions/cache@v2 + with: + path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-java-2/target + key: ${{ runner.os }}-java-client-${{ hashFiles('clients/algoliasearch-client-java-2/**') }} + - name: Generate search client + if: steps.cache.outputs.cache-hit != 'true' run: yarn generate java search - name: Build search client + if: steps.cache.outputs.cache-hit != 'true' run: yarn build:clients java search - - name: Cache built clients - uses: actions/cache@v2 - with: - path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-java-2/target - key: ${{ runner.os }}-java-client-${{ hashFiles('**/pom.xml') }} - cts: runs-on: ubuntu-20.04 needs: