feat(supported-version): add all kind (#36)

This commit is contained in:
Damien Retzinger
2022-08-12 08:40:31 -04:00
committed by GitHub
parent 09d4f1e097
commit 26c354d8d4
8 changed files with 24 additions and 7 deletions
+3
View File
@@ -29,6 +29,8 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./supported-version - uses: ./supported-version
with:
kind: all
id: supported-version id: supported-version
- run: echo ${{ steps.supported-version.outputs.matrix }} - run: echo ${{ steps.supported-version.outputs.matrix }}
@@ -36,6 +38,7 @@ jobs:
needs: compute_matrix needs: compute_matrix
strategy: strategy:
matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }} matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -29,6 +29,8 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./supported-version - uses: ./supported-version
with:
kind: all
id: supported-version id: supported-version
- run: echo ${{ steps.supported-version.outputs.matrix }} - run: echo ${{ steps.supported-version.outputs.matrix }}
integration-workflow: integration-workflow:
@@ -39,3 +41,4 @@ jobs:
source_folder: $GITHUB_WORKSPACE/_test/demo-package source_folder: $GITHUB_WORKSPACE/_test/demo-package
matrix: ${{ needs.compute_matrix.outputs.matrix }} matrix: ${{ needs.compute_matrix.outputs.matrix }}
test_command: ../../../vendor/bin/phpunit ../../../vendor/graycore/magento2-demo-package/Test/Integration test_command: ../../../vendor/bin/phpunit ../../../vendor/graycore/magento2-demo-package/Test/Integration
fail-fast: false
+1 -1
View File
@@ -13,7 +13,7 @@ See the [action.yml](./action.yml)
| Input | Description | Required | Default | | Input | Description | Required | Default |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ----------- | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| kind | The "kind" of support you're targeting for your package. Allowed values are `currently-supported`, `latest` and `custom` | false | 'currently-supported' | | kind | The "kind" of support you're targeting for your package. Allowed values are `currently-supported`, `latest`, `custom`, and `all` | false | 'currently-supported' |
| custom_versions | The versions you want to support, as a comma-separated string, i.e. 'magento/project-community-edition:2.3.7-p3, magento/project-community-edition:2.4.2-p2' | false | '' | | custom_versions | The versions you want to support, as a comma-separated string, i.e. 'magento/project-community-edition:2.3.7-p3, magento/project-community-edition:2.4.2-p2' | false | '' |
## Usage ## Usage
+1 -1
View File
@@ -5,7 +5,7 @@ description: "A Github Action that computes the Github Actions matrix for the ch
inputs: inputs:
kind: kind:
required: false required: false
description: "The kind of versions you want to return. Allowed values are `currently-supported, latest, custom`" description: "The kind of versions you want to return. Allowed values are `currently-supported, latest, custom, all`"
default: "currently-supported" default: "currently-supported"
custom_versions: custom_versions:
required: false required: false
+5 -5
View File
File diff suppressed because one or more lines are too long
@@ -5,6 +5,7 @@ export const KNOWN_KINDS = {
'currently-supported': true, 'currently-supported': true,
'latest': true, 'latest': true,
'custom': true, 'custom': true,
'all': true,
} }
export const isValidKind = (kind: string): boolean => { export const isValidKind = (kind: string): boolean => {
@@ -15,6 +15,13 @@ describe('getMatrixForKind', () => {
expect(result.include).toBeDefined(); expect(result.include).toBeDefined();
}); });
it('returns a matrix for `all`', () => {
const result = getMatrixForKind("all");
expect(result.magento).toBeDefined();
expect(result.include).toBeDefined();
});
it('returns a matrix for valid `custom`', () => { it('returns a matrix for valid `custom`', () => {
const result = getMatrixForKind("custom", "magento/project-community-edition:2.3.7-p3"); const result = getMatrixForKind("custom", "magento/project-community-edition:2.3.7-p3");
@@ -2,6 +2,7 @@ import { getMatrixForVersions } from "./get-matrix-for-versions";
import latestJson from '../kind/latest.json'; import latestJson from '../kind/latest.json';
import currentlySupportedJson from '../kind/currently-supported.json'; import currentlySupportedJson from '../kind/currently-supported.json';
import allVersions from '../versions/individual.json';
export const getMatrixForKind = (kind: string, versions: string = "") => { export const getMatrixForKind = (kind: string, versions: string = "") => {
switch(kind){ switch(kind){
@@ -9,6 +10,8 @@ export const getMatrixForKind = (kind: string, versions: string = "") => {
return getMatrixForVersions(latestJson); return getMatrixForVersions(latestJson);
case 'currently-supported': case 'currently-supported':
return getMatrixForVersions(currentlySupportedJson); return getMatrixForVersions(currentlySupportedJson);
case 'all':
return getMatrixForVersions(Object.keys(allVersions));
case 'custom': case 'custom':
return getMatrixForVersions(versions.split(",")) return getMatrixForVersions(versions.split(","))
default: default: