Skip to content

Commit 7431dcb

Browse files
damienwebdevVinai
andauthored
feat: allow using "next" version on supported version (#58)
This also allows using the action in https://github.com/mage-os/generate-mirror-repo-js where the test module is an external package installed with composer. In this case, no local path repo configuration is needed. Co-authored-by: Vinai Kopp <Vinai@users.noreply.github.com>
1 parent 3e4d3c1 commit 7431dcb

File tree

14 files changed

+119
-10
lines changed

14 files changed

+119
-10
lines changed

.github/workflows/integration.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
on:
22
workflow_call:
33
inputs:
4-
4+
use_local_source:
5+
type: boolean
6+
required: false
7+
default: true
8+
description: "Whether or not you want to test your local package or not."
9+
510
source_folder:
611
type: string
712
required: false
@@ -130,6 +135,7 @@ jobs:
130135
name: Add Github Repo for Testing
131136
working-directory: ${{ inputs.magento_directory }}
132137
shell: bash
138+
if: ${{ inputs.use_local_source == true }}
133139

134140
- run: composer require monolog/monolog:"<2.7.0" --no-update
135141
name: Fixup Monolog (https://github.com/magento/magento2/pull/35596)

installation-test/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ inputs:
1818
default: "2"
1919
description: "The version of composer to use"
2020

21+
use_local_source:
22+
required: false
23+
default: "true"
24+
description: "Whether or not you want to test your local package or not."
25+
2126
source_folder:
2227
required: true
2328
default: $GITHUB_WORKSPACE
@@ -86,6 +91,7 @@ runs:
8691
name: Add Github Repo for Testing
8792
working-directory: ${{ inputs.magento_directory }}
8893
shell: bash
94+
if: ${{ inputs.use_local_source == 'true' }}
8995

9096
- run: |
9197
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true

package-lock.json

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

supported-version/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ See the [action.yml](./action.yml)
1313

1414
| Input | Description | Required | Default |
1515
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
16-
| kind | The "kind" of support you're targeting for your package. Allowed values are `currently-supported`, `latest`, `custom`, and `all` | false | 'currently-supported' |
16+
| kind | The "kind" of support you're targeting for your package. Allowed values are `currently-supported`, `latest`, `custom`, `nightly` and `all` | false | 'currently-supported' |
1717
| 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 | '' |
1818

19+
## Kinds
20+
- `currently-supported` - The currently supported Magento Open Source versions by Adobe.
21+
- `latest` - The latest version of Magento only.
22+
- `custom` - A custom subset of the versions, as specified by you. Requires `custom_versions` sibling key.
23+
- `nightly` - The nightly version of Magento (only available via `https://upstream-nightly.mage-os.org`)
24+
- `all` - All versions of Magento (including patched/unpatched versions).
1925
## Usage
2026

2127
```yml

supported-version/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: "A Github Action that computes the Github Actions matrix for the ch
55
inputs:
66
kind:
77
required: false
8-
description: "The kind of versions you want to return. Allowed values are `currently-supported, latest, custom, all`"
8+
description: "The kind of versions you want to return. Allowed values are `currently-supported`, `latest`, `custom`, `nightly` and `all`"
99
default: "currently-supported"
1010
custom_versions:
1111
required: false

supported-version/dist/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

supported-version/src/kind/compute-kind.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const KNOWN_KINDS = {
55
'currently-supported': true,
66
'latest': true,
77
'custom': true,
8+
'nightly': true,
89
'all': true,
910
}
1011

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"magento/project-community-edition:next"
3+
]

supported-version/src/matrix/get-matrix-for-kind.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ describe('getMatrixForKind', () => {
2929
expect(result.include).toBeDefined();
3030
});
3131

32+
it('returns a matrix for the next release when using `nightly`', () => {
33+
const result = getMatrixForKind("nightly", "magento/project-community-edition:next");
34+
35+
expect(result.magento).toBeDefined();
36+
expect(result.include).toBeDefined();
37+
});
38+
3239
it('returns a matrix for valid multiple `custom`', () => {
3340
const result = getMatrixForKind("custom", "magento/project-community-edition:2.3.7-p3,magento/project-community-edition:2.4.0");
3441

supported-version/src/matrix/get-matrix-for-kind.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@ import { getMatrixForVersions } from "./get-matrix-for-versions";
33
import latestJson from '../kind/latest.json';
44
import currentlySupportedJson from '../kind/currently-supported.json';
55
import allVersions from '../versions/individual.json';
6+
import nightly from '../kind/nightly.json';
7+
import { amendMatrixForNext } from "../nightly/get-next-version";
8+
import { getDayBefore } from '../nightly/get-day-before';
69

710
export const getMatrixForKind = (kind: string, versions: string = "") => {
811
switch(kind){
912
case 'latest':
1013
return getMatrixForVersions(latestJson);
1114
case 'currently-supported':
1215
return getMatrixForVersions(currentlySupportedJson);
16+
case 'nightly':
17+
return amendMatrixForNext(getMatrixForVersions(nightly), 'https://upstream-mirror.mage-os.org', getDayBefore());
1318
case 'all':
1419
return getMatrixForVersions(Object.keys(allVersions));
1520
case 'custom':

0 commit comments

Comments
 (0)