-
Notifications
You must be signed in to change notification settings - Fork 17
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(script): variadic parameters #472
Conversation
✅ Deploy Preview for api-clients-automation canceled.
|
e21c23b
to
88ce6dc
Compare
✗ The generated branch has been deleted.If the PR has been merged, you can check the generated code on the |
88ce6dc
to
b45fd07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing ! One obvious improvement would be to run the CTS directly after a gen is done, we don't have to wait for all languages, but it's already a huge upgrade !
This composite restore all of our artifacts, at their right path. | ||
|
||
inputs: | ||
type: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we go full circle with the cache ahah
if: ${{ steps.cache.outputs.cache-hit != 'true' }} | ||
run: git --no-pager diff | ||
run: yarn cli build specs ${{ matrix.client.toRun }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove the matrix and just use $ {{ fromJSON(needs.setup.outputs.SPECS_MATRIX).client.toRun }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more verbose I'm not a fan of it for readability purposes D:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that way we don't have to click on the CI to see the details !
scripts/config.ts
Outdated
return clientsConfig[language]?.tests?.extension; | ||
} | ||
|
||
export function getTestOutputFolder(language: string): string | undefined { | ||
export function getTestOutputFolder(language: string): string { | ||
return clientsConfig[language]?.tests?.outputFolder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this correct ? ?
will return undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The types are really wrong in some places, we need to fix that in a later PR 6920796
if (language === 'all') { | ||
langsTodo = LANGUAGES; | ||
} | ||
if (client === 'all') { | ||
if (client[0] === 'all') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe throw if the first client is all
and the length is more than one
const matrix = LANGUAGES.reduce( | ||
(curr, lang) => ({ | ||
...curr, | ||
[lang]: { | ||
path: getLanguageFolder(lang), | ||
toRun: [], | ||
cacheToCompute: [], | ||
}, | ||
}), | ||
{} as Record<Language, ToRunMatrix> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const matrix = LANGUAGES.reduce( | |
(curr, lang) => ({ | |
...curr, | |
[lang]: { | |
path: getLanguageFolder(lang), | |
toRun: [], | |
cacheToCompute: [], | |
}, | |
}), | |
{} as Record<Language, ToRunMatrix> | |
); | |
const matrix: Record<string, ToRunMatrix> = Object.fromEntries( | |
LANGUAGES.map((lang) => [ | |
lang, | |
{ | |
path: getLanguageFolder(lang), | |
toRun: [], | |
cacheToCompute: [], | |
}, | |
]) | |
); |
There is no good way to do it and keep the type correct without casting, I don't know which one is more readable
Good idea!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good ! It's weird that the size of the artifacts is the uncompressed size at upload and download, but when I actually download an artifacts it's the correct size
|
||
inputs: | ||
type: | ||
description: Type of artifacts to restore (`all` | `specs` | `javascript` | `js-utils` | `java` | `php`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove 'java' and 'php' if they are not used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
🧭 What and Why
🎟 JIRA Ticket: https://algolia.atlassian.net/browse/DI-238
Allow variadic parameters in the CLI, to reduce the number of jobs/complexity of the CI.
Changes included:
(Sorry for the huge PR, it was hard not to break things here and there)
The goal of this PR is to remove any logic of the client path at the CI level, which what makes it extremely verbose.
New CLI usage:
yarn docker generate javascript search && yarn docker generate javascript recommend
yarn docker generate javascript search recommend
This change allow us to scope every clients at their base folder level.
Side effects:
Language
type in the CLI https://algolia.atlassian.net/browse/APIC-385🧪 Test
CI :D