-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Migrate typespec validation #31033
Migrate typespec validation #31033
Conversation
Next Steps to Merge✅ All automated merging requirements have been met! To get your PR merged, see aka.ms/azsdk/specreview/merge. |
PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment. |
521aaa8
to
f7c31e3
Compare
8443eae
to
33006c5
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.
Main recommendation is changing to use shards
and shard
PR validation pipeline can not start as the pull request is not merged or mergeable - most likely it has merge conflicts. |
1 similar comment
PR validation pipeline can not start as the pull request is not merged or mergeable - most likely it has merge conflicts. |
229ea9b
to
17ba38a
Compare
* ` * ` * Revert "`" This reverts commit c26fc6a.
…sn't reach total-shards. Math is not allowed in expressions. This reverts commit 035bec7.
…t this time but adding back in because schema requires it.
7229bd3
to
a316274
Compare
Co-authored-by: Mike Harder <mharder@microsoft.com>
Co-authored-by: Mike Harder <mharder@microsoft.com>
fetch-depth: 2 | ||
|
||
- name: Setup Node 20 and run `npm ci` | ||
uses: ./.github/actions/setup-node-npm-ci |
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.
@mikeharder @danieljurek I thought github force these to be under the workflows directory. Is this a way we can make other reusable pieces for actions?
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 workflow itself must be under .github/workflows
, but I believe custom actions can live anywhere in your repo, in another repo, etc.
We're still experimenting, but we're considering trying to provide most reusable code through custom actions, rather than using github-script
everywhere and sharing JS code.
Custom actions can still use github-script
internally, but the goal would be to make most of our leaf-node workflows as declarative as possible (no github-script).
} | ||
|
||
if ($totalShards -gt $array.Length) { | ||
throw "Cannot shard array into more pieces than there are elements" |
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.
Would we hit this case if there were only one spec discovered but we have it sharded in 3? I assume this wouldn't be the case for tsv-all but could be in other cases if we use this logic.
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.
Yes, currently the caller needs to check this first:
* test breaking change mlc in js (Azure#3451) * ` * ` * Revert "`" This reverts commit c26fc6a. * Update specificationRepositoryConfiguration.json (Azure#3457) * Update specificationRepositoryConfiguration.json (Azure#3459) * Update specificationRepositoryConfiguration.json (Azure#3462) Revert python repo branch change as it was deleted. * Update specificationRepositoryConfiguration.json (Azure#3463) * Migrate typespec-validation.yml to GH Actions * path, fetch depth * Introduce error * Test a feature that AI says will collapse logs (doubtful it'll work) * Revert "Test a feature that AI says will collapse logs (doubtful it'll work)" This reverts commit 04aed83. * Log $LASTEXITCODE * Invalid syntax * Use error logging, remove continue-on-error because that is different behavior in GitHub Actions compared to ignoreLASTEXITCODE * Errors also get annotations in GitHub Actions * String replacement * Revert Logging-Functions.ps1 * Test composite action * File location * Invocation * Add typespec-validation-all.yml * Migrate typespec-validation-all.yml * Revert main.tsp invalid spec * fetch-depth: 2 * Long paths * checkout@v4 * Remove pipelines * *.yml -> *.yaml * Do not change specificationRepositoryConfiguration.json * Job names (for checks) * Add Skip/Take logic and matrix * Syntax * Rename * Remove "shell" * Try defaults.run.shell (unlikely to work) * bash * Name for actions/setup-node@v4 does not appear in the logs. Remove. * Use sharding semantics * Shard * Review feedback * Review feedback * +1 * Revert "Shard"... Display is confusing because it starts at 0 and doesn't reach total-shards. Math is not allowed in expressions. This reverts commit 035bec7. * Shard only if TotalShards > 0 * Remove description (schema validaiton does not pass, let's see what GH Actions says) * The `description` property is not absolutely required by GH Actions at this time but adding back in because schema requires it. * Add array functions and tests * Move Copy-ApiVersion.Tests.ps1 out of folder (adjust paths so they are accurate) * Add trailing newline * Add trailing newline * Update .github/workflows/typespec-validation.yaml Co-authored-by: Mike Harder <mharder@microsoft.com> * Review feedback * Update eng/scripts/TypeSpec-Validation.ps1 Co-authored-by: Mike Harder <mharder@microsoft.com> --------- Co-authored-by: Wanpeng Li <wanl@microsoft.com> Co-authored-by: Peng Jiahui <46921893+Alancere@users.noreply.github.com> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com> Co-authored-by: Ray Chen <raychen@microsoft.com> Co-authored-by: Mike Harder <mharder@microsoft.com>
Fixes Azure/azure-sdk-tools#9175
Fixes #28974
Fixes #29635
Of note...
ignoreLASTEXITCODE: true
... there's no direct analog in GitHub Actions (continue-on-error: true
hides failures in these cases).Sharding and performance
For the
TypeSpec Validation - All
pipeline, this change shards using skip/take logic configured in the matrix. There is significant improvement at the cost of agent time.In its current configuration, the "last" job will scan all remaining folders after the existing 213 folders have been divided up. Folders that are "displaced" by the addition of a new folder earlier in the sequence can be scanned in later jobs and the "last" job's
take: 0
means that all remaining entries will be scanned.If the "last" job starts taking long the matrix will have to be rebalanced to either add a shard or require other entries to take more folders.
Composite actions
This PR uses composite actions to do Node setup,
npm ci
, andnpm ls -a
... These are all collapsed into a single task in the logs. It's possible to further subdivide these for UI benefits if we care. We can use the composite actions in other places (like the eng-tools-test.yaml) but that's outside the scope of this change.Example failure:
PR with contrived failure: https://github.com/Azure/azure-rest-api-specs/actions/runs/11351864042/job/31573371561?pr=31034
When clicking on the failed check in the PR UI...
The user is taken straight to the logs: