Commit 42219b0
authored
Add SemVer checks (#3375)
* Fixes #1605
* Check "stable" Rust on Linux only (others add significant time to
build)
* Add `eng/cgmanfiest.json` to track installation of a dev tool in the
build system
* `Test-Semver.ps1` uses the version specified in `eng/cgmanifest.json`
Tested:
| Scenario | Result |
| -------- | ------ |
| No packages changed | |
| [Checks SemVer of changed package in
PR](https://dev.azure.com/azure-sdk/public/_build/results?buildId=5614015&view=logs&j=906b8cf8-77d6-5b97-38eb-78e393929662&t=a7849eae-de43-5ea0-75a4-5b970d68e244)
| Success (expected) |
| [Fails on SemVer violation in
PR](https://dev.azure.com/azure-sdk/public/_build/results?buildId=5614218&view=logs&j=b766ebde-1fdb-5f11-1350-46ddc53b23cf&t=7ef29fa0-f532-5653-3473-16dc04608431)
| Fail (expected) |
| [Checks SemVer of packages in
service](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5614246&view=logs&j=b766ebde-1fdb-5f11-1350-46ddc53b23cf&t=9494b470-f365-50d2-5008-6394593b39c5)
| Fail (expected) |
| [Checks SemVer of packages in release (and blocks
release)](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5614282&view=logs&j=b766ebde-1fdb-5f11-1350-46ddc53b23cf&t=9494b470-f365-50d2-5008-6394593b39c5)
| Fail (expected) |
# Test performance
SemVer checks add a non-trivial amount of time in some OS configurations
(Windows, MacOS) because `rust-semver-checks` is built.
| Test Job | OS | Time |
| -------- | -- | ---- |
| Unit | Linux | 1m42s |
| Unit | Windows | 5m40s |
| Unit | Mac | 7m2s |
| Semver | Linux | 6m13s |
| Semver | Windows | 15m3s |
| Semver | Mac | 21m19s |
`rust-semver-check` build times (look at logs for builds of stable in
[this PR
run](https://dev.azure.com/azure-sdk/public/_build/results?buildId=5613783&view=logs&j=7e382a76-12de-5903-1057-64e59e53ed06&t=ba3464b8-2ae1-508a-306c-badcf96fe2c9)):
| OS | Time |
| -- | ---- |
| Linux | 4m50s |
| Windows | 10m15s |
| Mac | 17m12s |
## Caching considerations
Also discussed here:
#3158
Azure DevOps caches are scoped according to [several
factors](https://learn.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops&tabs=bundler#cache-isolation-and-security).
In the case of a PR where speed is most important, we would need a job
that runs against `main` to populate a cache that PRs could read. We
don't currently schedule PR pipelines to run. In fact, vcpkg, uses its
own cache mechanism with relevant rules.
If we needed to semver check across OS quickly, we could use a storage
account to hold pre-built binaries (similar to vcpkg). The binaries
would be built in a Rust pipeline and uploaded to the storage account
with a path prefix like `carge-semver-checks/ubuntu-24/0.45.0/`.
Something would need to update the cache and cgmanifes.json file and
proper arrangements would need to be made locally so that calling `cargo
semver-checks` would use the correct binary.
Similar work could also be done to cache source analysis binaries
# Other considerations
Checking "nightly" and "msrv" versions of Rust is more complicated.
Generally, [`cargo-semver-checks` supports
"stable"](https://github.com/obi1kenobi/cargo-semver-checks?tab=readme-ov-file#what-rust-versions-does-cargo-semver-checks-support)
so SemVer checking focuses there.
PRs should also block on semver-breaking changes. It may be possible
that future version schemes (e.g. adding `-beta.x` to a version number)
may not block PRs because semver allows breaking changes in `-beta.x`
versions. This will need to be investigated as part of the version
incrementing script. We'd either need to adjust the version scheme or
update `-beta.x` at CI execution time.1 parent 3b81ef1 commit 42219b0
File tree
5 files changed
+181
-53
lines changed- eng
- pipelines/templates/jobs
- scripts
5 files changed
+181
-53
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
71 | 84 | | |
72 | 85 | | |
73 | 86 | | |
| |||
101 | 114 | | |
102 | 115 | | |
103 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
104 | 130 | | |
105 | 131 | | |
106 | 132 | | |
| |||
123 | 149 | | |
124 | 150 | | |
125 | 151 | | |
126 | | - | |
| 152 | + | |
127 | 153 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | 26 | | |
76 | 27 | | |
77 | 28 | | |
| |||
105 | 56 | | |
106 | 57 | | |
107 | 58 | | |
108 | | - | |
109 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
110 | 86 | | |
111 | 87 | | |
112 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
0 commit comments