Unverified Commit 6ffd9900 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Implement runtime-versioner audit tool (#3332)

This PR implements a build tool to audit runtime crate versions as part
of CI and release. If a runtime crate doesn't have the special
`0.0.0-smithy-rs-head` version number, then it is assumed to be
independently versioned, and the audit tool will verify it is version
bumped when any changes are made to it.

Given that there isn't a complete/reliable semver checking tool for Rust
yet, this tool isn't smart. It will rely on devs to correctly bump the
version number when that is done.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent ad133fd3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ jobs:
          runner: smithy_ubuntu-latest_8-core
        - action: check-rust-runtimes
          runner: smithy_ubuntu-latest_8-core
          fetch-depth: 0
        - action: check-sdk-codegen-unit-tests
          runner: ubuntu-latest
        - action: check-server-codegen-integration-tests
@@ -119,6 +120,8 @@ jobs:
      with:
        path: smithy-rs
        ref: ${{ inputs.git_ref }}
        # Defaults to 1 if not set
        fetch-depth: ${{ matrix.test.fetch-depth }}
    - name: Run ${{ matrix.test.action }}
      uses: ./smithy-rs/.github/actions/docker-build
      with:
+1 −5
Original line number Diff line number Diff line
@@ -358,11 +358,7 @@ tasks.register<ExecRustBuildTool>("fixManifests") {

    toolPath = publisherToolPath
    binaryName = "publisher"
    arguments = mutableListOf("fix-manifests", "--location", outputDir.asFile.absolutePath).apply {
        if (crateVersioner.independentVersioningEnabled()) {
            add("--disable-version-number-validation")
        }
    }
    arguments = mutableListOf("fix-manifests", "--location", outputDir.asFile.absolutePath)
}

tasks.register<ExecRustBuildTool>("hydrateReadme") {
+0 −6
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@ interface VersionCrate {
        moduleName: String,
        service: AwsService,
    ): String

    fun independentVersioningEnabled(): Boolean
}

class SynchronizedCrateVersioner(
@@ -58,8 +56,6 @@ class SynchronizedCrateVersioner(
        moduleName: String,
        service: AwsService,
    ): String = sdkVersion

    override fun independentVersioningEnabled(): Boolean = sdkVersion == LOCAL_DEV_VERSION
}

private data class SemVer(
@@ -130,8 +126,6 @@ class IndependentCrateVersioner(
        )
    }

    override fun independentVersioningEnabled(): Boolean = true

    override fun decideCrateVersion(
        moduleName: String,
        service: AwsService,
+4 −2
Original line number Diff line number Diff line
@@ -82,10 +82,11 @@ RUN set -eux; \
        cd smithy-rs; \
        git checkout ${smithy_rs_commit_hash}; \
    fi; \
    cargo install --locked --path tools/ci-build/publisher; \
    cargo install --locked --path tools/ci-build/changelogger; \
    cargo install --locked --path tools/ci-build/crate-hasher; \
    cargo install --locked --path tools/ci-build/difftags; \
    cargo install --locked --path tools/ci-build/publisher; \
    cargo install --locked --path tools/ci-build/runtime-versioner; \
    cargo install --locked --path tools/ci-build/sdk-lints; \
    cargo install --locked --path tools/ci-build/sdk-versioner; \
    chmod g+rw -R /opt/cargo/registry
@@ -166,7 +167,8 @@ RUN set -eux; \
        python3 \
        python3-devel \
        python3-pip \
        shadow-utils; \
        shadow-utils \
        tar; \
    yum clean all; \
    rm -rf /var/cache/yum; \
    groupadd build; \
+33 −12
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
 "syn 2.0.48",
]

[[package]]
@@ -621,7 +621,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
 "syn 2.0.48",
]

[[package]]
@@ -723,18 +723,18 @@ dependencies = [

[[package]]
name = "proc-macro2"
version = "1.0.70"
version = "1.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c"
dependencies = [
 "unicode-ident",
]

[[package]]
name = "quote"
version = "1.0.33"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
 "proc-macro2",
]
@@ -895,7 +895,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
 "syn 2.0.48",
]

[[package]]
@@ -942,6 +942,7 @@ dependencies = [
 "semver",
 "serde",
 "serde_json",
 "thiserror",
 "toml",
 "tracing",
]
@@ -985,9 +986,9 @@ dependencies = [

[[package]]
name = "syn"
version = "2.0.39"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [
 "proc-macro2",
 "quote",
@@ -1043,6 +1044,26 @@ version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"

[[package]]
name = "thiserror"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
dependencies = [
 "thiserror-impl",
]

[[package]]
name = "thiserror-impl"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.48",
]

[[package]]
name = "time"
version = "0.3.30"
@@ -1152,7 +1173,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
 "syn 2.0.48",
]

[[package]]
@@ -1250,7 +1271,7 @@ dependencies = [
 "once_cell",
 "proc-macro2",
 "quote",
 "syn 2.0.39",
 "syn 2.0.48",
 "wasm-bindgen-shared",
]

@@ -1284,7 +1305,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.39",
 "syn 2.0.48",
 "wasm-bindgen-backend",
 "wasm-bindgen-shared",
]
Loading