Skip to content

Commit

Permalink
factorize specs cache
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Jan 17, 2022
1 parent 62ffa80 commit ace5839
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 45 deletions.
51 changes: 6 additions & 45 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,20 @@ inputs:
job:
description: The job that requires this composite
required: true
spec:
description: The spec name to restore
required: false

runs:
using: composite
steps:
# restore specs
- name: Restore built abtesting spec
- name: Restore built ${{ inputs.spec }} spec
if: ${{ inputs.job == 'client' || inputs.job == 'java' }}
uses: actions/cache@v2
with:
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/abtesting.yml
key: ${{ runner.os }}-abtesting-spec-${{ hashFiles('specs/abtesting/**') }}

- name: Restore built analytics spec
if: ${{ inputs.job == 'client' || inputs.job == 'java' }}
uses: actions/cache@v2
with:
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/analytics.yml
key: ${{ runner.os }}-analytics-spec-${{ hashFiles('specs/analytics/**') }}

- name: Restore built insights spec
if: ${{ inputs.job == 'client' || inputs.job == 'java' }}
uses: actions/cache@v2
with:
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/insights.yml
key: ${{ runner.os }}-insights-spec-${{ hashFiles('specs/insights/**') }}

- name: Restore built personalization spec
if: ${{ inputs.job == 'client' || inputs.job == 'java' }}
uses: actions/cache@v2
with:
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/personalization.yml
key: ${{ runner.os }}-personalization-spec-${{ hashFiles('specs/personalization/**') }}

- name: Restore built query-suggestions spec
if: ${{ inputs.job == 'client' || inputs.job == 'java' }}
uses: actions/cache@v2
with:
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/query-suggestions.yml
key: ${{ runner.os }}-query-suggestions-spec-${{ hashFiles('specs/query-suggestions/**') }}

- name: Restore built recommend spec
if: ${{ inputs.job == 'client' || inputs.job == 'java' }}
uses: actions/cache@v2
with:
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/recommend.yml
key: ${{ runner.os }}-recommend-spec-${{ hashFiles('specs/recommend/**') }}

- name: Restore built search spec
if: ${{ inputs.job == 'client' || inputs.job == 'java' }}
uses: actions/cache@v2
with:
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/search.yml
key: ${{ runner.os }}-search-spec-${{ hashFiles('specs/search/**') }}
path: /home/runner/work/api-clients-automation/api-clients-automation/specs/dist/${{ inputs.spec }}.yml
key: ${{ runner.os }}-${{ inputs.spec }}-spec-${{ hashFiles('specs/${{ inputs.spec }}/**') }}

# restore clients
- name: Restore built JavaScript search client
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:

- name: Restore cache
uses: ./.github/actions/cache
with:
spec: ${{ matrix.client }}

- name: Cache ${{ matrix.client }} spec
id: cache
Expand Down

0 comments on commit ace5839

Please sign in to comment.