Skip to content

chore(ci): fallback step name when they are skipped #3679

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 3 commits into from
Sep 9, 2024
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
12 changes: 7 additions & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ jobs:
outputs:
RUN_SCRIPTS: ${{ steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 }}

RUN_WEBSITE: ${{ steps.diff.outputs.WEBSITE_CHANGED > 0 }}

SPECS_MATRIX: ${{ steps.spec-matrix.outputs.MATRIX }}

RUN_GEN: ${{ steps.gen-matrix.outputs.RUN_GEN }}
Expand Down Expand Up @@ -184,7 +186,7 @@ jobs:
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }}
name: client javascript@${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).version }}
name: client javascript${{ needs.setup.outputs.RUN_GEN_JAVASCRIPT == 'true' && format('@{0}', fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).version) || '' }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -408,7 +410,7 @@ jobs:
!contains(needs.*.result, 'failure')
outputs:
success: ${{ steps.setoutput.outputs.success }}
name: client kotlin@${{ fromJSON(needs.setup.outputs.KOTLIN_DATA).version }} macos
name: client kotlin${{ needs.setup.outputs.RUN_MACOS_KOTLIN_BUILD == 'true' && format('@{0}', fromJSON(needs.setup.outputs.KOTLIN_DATA).version) || '' }} macos
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -455,7 +457,7 @@ jobs:
MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }}
outputs:
success: ${{ steps.setoutput.outputs.success }}
name: client swift@${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }} macos
name: client swift${{ needs.setup.outputs.RUN_MACOS_SWIFT_CTS == 'true' && format('@{0}', fromJSON(needs.setup.outputs.SWIFT_DATA).version) || '' }} macos
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -576,11 +578,11 @@ jobs:
${{ steps.benchmark.outputs.BENCHMARK_SECTION }}

- name: Build website
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' && needs.setup.outputs.RUN_WEBSITE == 'true' }}
run: yarn website:build

- name: Deploy documentation
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' && needs.setup.outputs.RUN_WEBSITE == 'true' }}
uses: nwtgck/[email protected]
with:
publish-dir: 'website/build'
Expand Down
45 changes: 24 additions & 21 deletions scripts/ci/githubActions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,32 @@ export const COMMON_DEPENDENCIES = {
* Variables starting by `LANGUAGENAME_` will be used in the `createMatrix` to determine
* if a job should be added.
*/
export const DEPENDENCIES = LANGUAGES.reduce(
(finalDependencies, lang) => {
const key = `${lang.toUpperCase()}_CLIENT_CHANGED`;
const langFolder = getLanguageFolder(lang);
export const DEPENDENCIES = {
...LANGUAGES.reduce(
(finalDependencies, lang) => {
const key = `${lang.toUpperCase()}_CLIENT_CHANGED`;
const langFolder = getLanguageFolder(lang);

finalDependencies[key] = [
':!**node_modules',
`templates/${lang}`,
'templates/Bug_report.yml',
'templates/issue.yml',
'templates/LICENSE',
// language related files
langFolder,
getVersionFileForLanguage(lang),
`tests/output/${lang}`,
`:!${langFolder}/.github`,
`:!${langFolder}/README.md`,
];
finalDependencies[key] = [
':!**node_modules',
`templates/${lang}`,
'templates/Bug_report.yml',
'templates/issue.yml',
'templates/LICENSE',
// language related files
langFolder,
getVersionFileForLanguage(lang),
`tests/output/${lang}`,
`:!${langFolder}/.github`,
`:!${langFolder}/README.md`,
];

return finalDependencies;
},
{ ...COMMON_DEPENDENCIES } as Record<string, string[]>,
);
return finalDependencies;
},
{ ...COMMON_DEPENDENCIES } as Record<string, string[]>,
),
WEBSITE_CHANGED: ['website', 'scripts/website', 'package.json', 'netlify.toml'],
};

function getVersionFileForLanguage(lang: Language): string {
// js rely on the nvmrc of the repo
Expand Down
2 changes: 1 addition & 1 deletion scripts/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function formatter(language: string, cwd: string): Promise<void> {
switch (language) {
case 'csharp':
if (cwd.includes('tests') || cwd.includes('snippets')) {
await run('dotnet format && dotnet tool restore && dotnet dotnet-csharpier .', {
await run('dotnet format --no-restore && dotnet tool restore && dotnet dotnet-csharpier .', {
cwd,
language,
});
Expand Down
Loading