feat: make cache key consistent (and configurable) (#38)

This commit is contained in:
Damien Retzinger
2022-08-13 14:39:00 -04:00
committed by GitHub
parent 841670a97f
commit cbbba628dd
4 changed files with 25 additions and 13 deletions
+11 -10
View File
@@ -6,20 +6,21 @@ A Github Workflow that runs the Integration Tests of a Magento Package
See the [integration.yaml](./integration.yaml) See the [integration.yaml](./integration.yaml)
| Input | Description | Required | Default | | Input | Description | Required | Default |
| ------------------ | ------------------------------------------------------------- | -------- | ----------------------------- | | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------- |
| matrix | JSON string of [version matrix for Magento](./#matrix-format) | true | NULL | | matrix | JSON string of [version matrix for Magento](./#matrix-format) | true | NULL |
| fail-fast | Same as Github's [fail-fast](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast) | false | true | | fail-fast | Same as Github's [fail-fast](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast) | false | true |
| package_name | The name of the package | true | NULL | | package_name | The name of the package | true | NULL |
| source_folder | The source folder of the package | false | $GITHUB_WORKSPACE | | source_folder | The source folder of the package | false | $GITHUB_WORKSPACE |
| magento_directory | The folder where Magento will be installed | false | ../magento2 | | magento_directory | The folder where Magento will be installed | false | ../magento2 |
| magento_repository | Where to install Magento from | false | https://mirror.mage-os.org/ | | magento_repository | Where to install Magento from | false | https://mirror.mage-os.org/ |
| test_command | The integration test command to run | false | "../../../vendor/bin/phpunit" | | test_command | The integration test command to run | false | "../../../vendor/bin/phpunit" |
| composer_cache_key | A key to version the composer cache. Can be incremented if you need to bust the cache. | false | "" |
## Secrets ## Secrets
| Input | Description | Required | Default | | Input | Description | Required | Default |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- | | ------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
| composer_auth | JSON string of [composer credentials]([#./matrix-format](https://devdocs.magento.com/guides/v2.4/install-gde/prereq/connect-auth.html)) | false | NULL | | composer_auth | JSON string of [composer credentials]([#./matrix-format](https://devdocs.magento.com/guides/v2.4/install-gde/prereq/connect-auth.html)) | false | NULL |
### Matrix Format ### Matrix Format
+7 -1
View File
@@ -41,6 +41,12 @@ on:
default: ../../../vendor/bin/phpunit default: ../../../vendor/bin/phpunit
description: "The integration test command to run" description: "The integration test command to run"
composer_cache_key:
type: string
required: false
default: ''
description: A key to version the composer cache. Can be incremented if you need to bust the cache.
secrets: secrets:
composer_auth: composer_auth:
required: false required: false
@@ -117,7 +123,7 @@ jobs:
- name: "Cache Composer Packages" - name: "Cache Composer Packages"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
key: 'composer | v3 | "$(Agent.OS)" | composer.lock | ${{ matrix.composer }} | ${{ matrix.php }} | ${{ matrix.magento }}' key: "composer | v4 | ${{ inputs.composer_cache_key }} | ${{ hashFiles('composer.lock') }} | ${{ matrix.os }} | ${{ matrix.composer }} | ${{ matrix.php }} | ${{ matrix.magento }}"
path: ${{ steps.composer-cache.outputs.dir }} path: ${{ steps.composer-cache.outputs.dir }}
- run: composer config repositories.local path ${{ inputs.source_folder }} - run: composer config repositories.local path ${{ inputs.source_folder }}
+6 -1
View File
@@ -41,6 +41,11 @@ inputs:
required: true required: true
default: "https://mirror.mage-os.org/" default: "https://mirror.mage-os.org/"
description: "Where to install Magento from" description: "Where to install Magento from"
composer_cache_key:
required: false
default: ''
description: A key to version the composer cache. Can be incremented if you need to bust the cache.
composer_auth: composer_auth:
required: false required: false
@@ -74,7 +79,7 @@ runs:
- name: "Cache Composer Packages" - name: "Cache Composer Packages"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
key: 'composer | v3 | "$(Agent.OS)" | composer.lock | ${{ inputs.composer_version }} | ${{ inputs.php_version }} | ${{ inputs.magento_version }}' key: "composer | v4 | ${{ inputs.composer_cache_key }} | ${{ hashFiles('composer.lock') }} | ${{ runner.os }} | ${{ inputs.composer_version }} | ${{ inputs.php_version }} | ${{ inputs.magento_version }}"
path: ${{ steps.composer-cache.outputs.dir }} path: ${{ steps.composer-cache.outputs.dir }}
- run: composer config repositories.local path ${{ inputs.source_folder }} - run: composer config repositories.local path ${{ inputs.source_folder }}
+1 -1
View File
@@ -39,7 +39,7 @@ runs:
- name: "Cache Composer Packages" - name: "Cache Composer Packages"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
key: 'composer | v3 | "$(Agent.OS)" | composer.lock | ${{ inputs.php_version }}' key: "composer | v3 | ${{ hashFiles('composer.lock') }} | ${{ runner.os }} | ${{ inputs.php_version }}"
path: ${{ steps.composer-cache.outputs.dir }} path: ${{ steps.composer-cache.outputs.dir }}
- run: composer install - run: composer install