-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add project versions #110
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eda3e57
refactor: allow version matrixes by projects
Vinai 4502859
feat: add initial version-matrix for mage-os
Vinai 017ec29
feat: add project as optional input to action
Vinai 802ed0c
docs: document new input
Vinai 86b9b56
refactor: tighten types a bit
Vinai 31e1708
chore: apply change requests from code review
Vinai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { MagentoMatrixVersion } from '../matrix/matrix-type'; | ||
import allVersions from '../versions/individual.json'; | ||
import { PackageMatrixVersion } from '../matrix/matrix-type'; | ||
import { getIndividualVersionsForProject } from "../versions/get-versions-for-project"; | ||
|
||
export const getCurrentlySupportedVersions = (date: Date): string[] => | ||
Object.entries(<Record<string,MagentoMatrixVersion>>allVersions) | ||
.filter(([key, value]) => { | ||
const dayAfterRelease = new Date(value.release); | ||
dayAfterRelease.setDate(dayAfterRelease.getDate() + 1); | ||
return date >= dayAfterRelease && new Date(value.eol) >= date; | ||
}) | ||
.map(([key, value]) => key); | ||
export const getCurrentlySupportedVersions = (project: string, date: Date): string[] => { | ||
const allVersions = getIndividualVersionsForProject(project) | ||
return Object.entries(<Record<string,PackageMatrixVersion>>allVersions) | ||
.filter(([key, value]) => { | ||
const dayAfterRelease = new Date(value.release); | ||
dayAfterRelease.setDate(dayAfterRelease.getDate() + 1); | ||
return date >= dayAfterRelease && new Date(value.eol) >= date; | ||
}) | ||
.map(([key, value]) => key); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"mage-os": ["mage-os/project-community-edition"], | ||
"magento-open-source": ["magento/project-community-edition"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"mage-os": ["mage-os/project-community-edition:next"], | ||
"magento-open-source": ["magento/project-community-edition:next"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,96 @@ | ||
import { getMatrixForKind } from "./get-matrix-for-kind"; | ||
|
||
describe('getMatrixForKind', () => { | ||
|
||
describe('getMatrixForKind for mage-os', () => { | ||
const project = "mage-os"; | ||
|
||
it('returns a matrix for `latest`', () => { | ||
const result = getMatrixForKind("latest", project); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('returns a matrix for `currently-supported`', () => { | ||
const result = getMatrixForKind("currently-supported", project); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('returns a matrix for `all`', () => { | ||
const result = getMatrixForKind("all", project); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('returns a matrix for valid `custom`', () => { | ||
const result = getMatrixForKind("custom", project, "mage-os/project-community-edition:1.0.0"); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('returns a matrix for the next release when using `nightly`', () => { | ||
const result = getMatrixForKind("nightly", project, "mage-os/project-community-edition:next"); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('errors for invalid `custom``', () => { | ||
expect(() => getMatrixForKind("custom", project)).toThrowError(); | ||
}); | ||
}) | ||
|
||
|
||
describe('getMatrixForKind for magento-open-source', () => { | ||
const project = "magento-open-source"; | ||
|
||
it('returns a matrix for `latest`', () => { | ||
const result = getMatrixForKind("latest"); | ||
const result = getMatrixForKind("latest", project); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('returns a matrix for `currently-supported`', () => { | ||
const result = getMatrixForKind("currently-supported"); | ||
const result = getMatrixForKind("currently-supported", project); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('returns a matrix for `all`', () => { | ||
const result = getMatrixForKind("all"); | ||
const result = getMatrixForKind("all", project); | ||
|
||
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"); | ||
const result = getMatrixForKind("custom", project, "magento/project-community-edition:2.3.7-p3"); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('returns a matrix for the next release when using `nightly`', () => { | ||
const result = getMatrixForKind("nightly", "magento/project-community-edition:next"); | ||
const result = getMatrixForKind("nightly", project, "magento/project-community-edition:next"); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('returns a matrix for valid multiple `custom`', () => { | ||
const result = getMatrixForKind("custom", "magento/project-community-edition:2.3.7-p3,magento/project-community-edition:2.4.0"); | ||
const result = getMatrixForKind("custom", project, "magento/project-community-edition:2.3.7-p3,magento/project-community-edition:2.4.0"); | ||
|
||
expect(result.magento).toBeDefined(); | ||
expect(result.include).toBeDefined(); | ||
}); | ||
|
||
it('errors for invalid `custom``', () => { | ||
expect(() => getMatrixForKind("custom")).toThrowError(); | ||
expect(() => getMatrixForKind("custom", project)).toThrowError(); | ||
}); | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.