Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/_internal-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./supported-version
with:
kind: all
id: supported-version
- run: echo ${{ steps.supported-version.outputs.matrix }}

install-test:
needs: compute_matrix
strategy:
matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/_internal-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./supported-version
with:
kind: all
id: supported-version
- run: echo ${{ steps.supported-version.outputs.matrix }}
integration-workflow:
Expand All @@ -39,3 +41,4 @@ jobs:
source_folder: $GITHUB_WORKSPACE/_test/demo-package
matrix: ${{ needs.compute_matrix.outputs.matrix }}
test_command: ../../../vendor/bin/phpunit ../../../vendor/graycore/magento2-demo-package/Test/Integration
fail-fast: false
2 changes: 1 addition & 1 deletion supported-version/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See the [action.yml](./action.yml)

| 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 | '' |

## Usage
Expand Down
2 changes: 1 addition & 1 deletion supported-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "A Github Action that computes the Github Actions matrix for the ch
inputs:
kind:
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"
custom_versions:
required: false
Expand Down
10 changes: 5 additions & 5 deletions supported-version/dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions supported-version/src/kind/compute-kind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const KNOWN_KINDS = {
'currently-supported': true,
'latest': true,
'custom': true,
'all': true,
}

export const isValidKind = (kind: string): boolean => {
Expand Down
7 changes: 7 additions & 0 deletions supported-version/src/matrix/get-matrix-for-kind.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ describe('getMatrixForKind', () => {
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`', () => {
const result = getMatrixForKind("custom", "magento/project-community-edition:2.3.7-p3");

Expand Down
3 changes: 3 additions & 0 deletions supported-version/src/matrix/get-matrix-for-kind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { getMatrixForVersions } from "./get-matrix-for-versions";

import latestJson from '../kind/latest.json';
import currentlySupportedJson from '../kind/currently-supported.json';
import allVersions from '../versions/individual.json';

export const getMatrixForKind = (kind: string, versions: string = "") => {
switch(kind){
case 'latest':
return getMatrixForVersions(latestJson);
case 'currently-supported':
return getMatrixForVersions(currentlySupportedJson);
case 'all':
return getMatrixForVersions(Object.keys(allVersions));
case 'custom':
return getMatrixForVersions(versions.split(","))
default:
Expand Down