Commit ae874c31 authored by ysaito1001's avatar ysaito1001
Browse files

Stop cloning `aws-doc-sdk-examples` repo in CI

parent b570622e
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -69,15 +69,6 @@ jobs:
      with:
        repository: awslabs/aws-sdk-rust
        path: aws-sdk-rust
    # The examples from aws-doc-sdk-examples are needed to see if smithy-rs changes break examples
    - uses: actions/checkout@v4
      with:
        repository: awsdocs/aws-doc-sdk-examples
        path: aws-doc-sdk-examples
    - name: Run ${{ matrix.actions.action }}
      uses: ./smithy-rs/.github/actions/docker-build
      with:
        action: ${{ matrix.actions.action }}

  # Test the code generator and other parts (styles and lints) that don't require
  # code to have already been generated in order to run.
+0 −50
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ val awsRustRuntimePath = rootProject.projectDir.resolve("aws/rust-runtime")
val awsSdkPath = rootProject.projectDir.resolve("aws/sdk")
val outputDir = layout.buildDirectory.dir("aws-sdk").get()
val sdkOutputDir = outputDir.dir("sdk")
val examplesOutputDir = outputDir.dir("examples")
val checkedInSdkLockfile = rootProject.projectDir.resolve("aws/sdk/Cargo.lock")
val generatedSdkLockfile = outputDir.file("Cargo.lock")

@@ -110,7 +109,6 @@ fun generateSmithyBuild(services: AwsServices): String {
                        "moduleVersion": "${crateVersioner.decideCrateVersion(moduleName, service)}",
                        "moduleAuthors": ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Russell Cohen <rcoh@amazon.com>"],
                        "moduleDescription": "${service.moduleDescription}",
                        ${service.examplesUri(project)?.let { """"examples": "$it",""" } ?: ""}
                        "moduleRepository": "https://github.com/awslabs/aws-sdk-rust",
                        "license": "Apache-2.0",
                        "minimumSupportedRustVersion": "${getRustMSRV()}",
@@ -192,30 +190,6 @@ tasks.register("relocateServices") {
    outputs.dir(sdkOutputDir)
}

tasks.register("relocateExamples") {
    description = "relocate the examples folder & rewrite path dependencies"
    dependsOn("jar")

    doLast {
        if (awsServices.examples.isNotEmpty()) {
            copy {
                from(projectDir)
                awsServices.examples.forEach { example ->
                    include("$example/**")
                }
                into(outputDir)
                exclude("**/target")
                exclude("**/rust-toolchain.toml")
                filter { line -> line.replace("build/aws-sdk/sdk/", "sdk/") }
            }
        }
    }
    if (awsServices.examples.isNotEmpty()) {
        inputs.dir(projectDir.resolve("examples"))
    }
    outputs.dir(outputDir)
}

tasks.register("relocateTests") {
    description = "relocate the root integration tests and rewrite path dependencies"
    dependsOn("jar")
@@ -240,24 +214,6 @@ tasks.register("relocateTests") {
    outputs.dir(outputDir)
}

tasks.register<ExecRustBuildTool>("fixExampleManifests") {
    description = "Adds dependency path and corrects version number of examples after relocation"
    enabled = awsServices.examples.isNotEmpty()
    dependsOn("relocateExamples")

    toolPath = sdkVersionerToolPath
    binaryName = "sdk-versioner"
    arguments = listOf(
        "use-path-and-version-dependencies",
        "--sdk-path", sdkOutputDir.asFile.absolutePath,
        "--versions-toml", outputDir.file("versions.toml").asFile.absolutePath,
        outputDir.dir("examples").asFile.absolutePath,
    )

    outputs.dir(outputDir)
    dependsOn("relocateExamples", "generateVersionManifest")
}

/**
 * The aws/rust-runtime crates depend on local versions of the Smithy core runtime enabling local compilation. However,
 * those paths need to be replaced in the final build. We should probably fix this with some symlinking.
@@ -336,9 +292,6 @@ tasks.register("generateCargoWorkspace") {
        rootProject.rootDir.resolve("clippy-root.toml").copyTo(outputDir.file("clippy.toml").asFile, overwrite = true)
    }
    inputs.property("servicelist", awsServices.moduleNames.toString())
    if (awsServices.examples.isNotEmpty()) {
        inputs.dir(projectDir.resolve("examples"))
    }
    for (test in awsServices.rootTests) {
        inputs.dir(test.path)
    }
@@ -352,7 +305,6 @@ tasks.register<ExecRustBuildTool>("fixManifests") {
    dependsOn("relocateServices")
    dependsOn("relocateRuntime")
    dependsOn("relocateAwsRuntime")
    dependsOn("relocateExamples")
    dependsOn("relocateTests")

    inputs.dir(publisherToolPath)
@@ -428,12 +380,10 @@ tasks.assemble.configure {
        "relocateServices",
        "relocateRuntime",
        "relocateAwsRuntime",
        "relocateExamples",
        "relocateTests",
        "generateIndexMd",
        "fixManifests",
        "generateVersionManifest",
        "fixExampleManifests",
        "hydrateReadme",
        "relocateChangelog",
    )
+3 −12
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@ fun Project.docsLandingPage(
        write(
            "The AWS SDK for Rust contains one crate for each AWS service, as well as ${cratesIo("aws-config")} " +
                "${docsRs("aws-config")}, a crate implementing configuration loading such as credential providers. " +
                "For usage documentation see the [Developer Guide](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html).",
                "For usage documentation see the [Developer Guide](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html). " +
                "For code examples refer to the [Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1).",
        )

        writer.write("## AWS Services")
@@ -35,7 +36,7 @@ fun Project.docsLandingPage(
        writer.write("| Service | Package |")
        writer.write("| ------- | ------- |")
        awsServices.services.sortedBy { it.humanName }.forEach {
            val items = listOfNotNull(cratesIo(it), docsRs(it), examplesLink(it, project)).joinToString(" ")
            val items = listOfNotNull(cratesIo(it), docsRs(it)).joinToString(" ")
            writer.write(
                "| ${it.humanName} | $items |",
            )
@@ -44,16 +45,6 @@ fun Project.docsLandingPage(
    outputPath.writeText(writer.toString())
}

/**
 * Generate a link to the examples for a given service
 */
private fun examplesLink(
    service: AwsService,
    project: Project,
) = service.examplesUri(project)?.let {
    "([examples]($it))"
}

/**
 * Generate a link to the docs
 */
+2 −22
Original line number Diff line number Diff line
@@ -38,18 +38,10 @@ class AwsServices(
                CrateSet.AWS_SDK_SMITHY_RUNTIME.map { "sdk/${it.name}" } +
                CrateSet.AWS_SDK_RUNTIME.map { "sdk/${it.name}" }
            // Root tests should not be included since they can't be part of the root Cargo workspace
            // in order to test differences in Cargo features. Examples should not be included either
            // because each example itself is a workspace.
            // in order to test differences in Cargo features.
        ).toSortedSet()
    }

    val examples: List<String> by lazy {
        val examplesRoot = project.projectDir.resolve("examples")
        examplesRoot.listFiles { file ->
            !file.name.startsWith(".") && file.isDirectory() && file.resolve("Cargo.toml").exists()
        }.orEmpty().toList().map { "examples/${it.name}" }
    }

    /**
     * Tests in `aws/sdk/integration-tests` that are not named after a service module, and therefore,
     * are not included in a service's `tests/` directory. These are to be included at the SDK root
@@ -88,7 +80,7 @@ class AwsServices(
    /**
     * Returns a list of crates excluded from the workspace.
     */
    fun excludedFromWorkspace() = examples + rootTests.map(RootTest::manifestName)
    fun excludedFromWorkspace() = rootTests.map(RootTest::manifestName)
}

/**
@@ -192,18 +184,6 @@ data class AwsService(
    val humanName: String,
) {
    fun modelFiles(): List<File> = listOf(modelFile) + extraFiles

    fun Project.examples(): File = projectDir.resolve("examples").resolve(module)

    /**
     * Generate a link to the examples for a given service
     */
    fun examplesUri(project: Project) =
        if (project.examples().exists()) {
            "https://github.com/awslabs/aws-sdk-rust/tree/main/examples/$module"
        } else {
            null
        }
}

fun AwsService.crate(): String = "aws-sdk-$module"
+0 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ cp -r "${SCRIPT_PATH}/../ci-scripts" "${ACTION_PATH}/workspace/"

# Copy inputs into workspace
for input_name in \
    "aws-doc-sdk-examples" \
    "aws-sdk-rust" \
    "aws-sdk" \
    "aws-sdk-smoketest" \
Loading