Skip to content

Commit

Permalink
Merge branch 'main' into jbe/versioning_policy
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins committed Nov 14, 2024
2 parents 7945e63 + b2bf4ec commit 3119136
Show file tree
Hide file tree
Showing 1,872 changed files with 181,452 additions and 62,866 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/codegen-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ env:

jobs:
codegen-build-test:
runs-on: macos-14-xlarge
runs-on: macos-15-xlarge
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer
steps:
- name: Checkout aws-sdk-swift
uses: actions/checkout@v3
Expand Down Expand Up @@ -61,19 +61,5 @@ jobs:
run: ./scripts/ci_steps/codegen_sdk.sh
- name: Build SDK with Unit Tests
run: swift build --build-tests

# Configure credentials for use during special protocol tests run against real clients
# Since environment variables are modified by some tests profiles are used instead
- name: Create AWS config directory
run: mkdir -p ~/.aws
- name: Create AWS config file
run: |
echo "[default]" > ~/.aws/config
echo "region=us-west-2" >> ~/.aws/config
- name: Create AWS credentials file
run: |
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id = test-key-id" >> ~/.aws/credentials
echo "aws_secret_access_key = test-secret-access-key" >> ~/.aws/credentials
- name: Run Unit Tests
run: swift test --skip-build
45 changes: 30 additions & 15 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,45 @@ jobs:
matrix:
# This matrix runs tests on iOS sim & Mac, on oldest & newest supported Xcodes
runner:
- macos-13
- macos-14
- macos-15
xcode:
- Xcode_15.2
- Xcode_16
- Xcode_16.1
destination:
- 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
- 'platform=iOS Simulator,OS=18.0,name=iPhone 16'
- 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
- 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=tvOS Simulator,OS=18.0,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
- 'platform=visionOS Simulator,OS=2.0,name=Apple Vision Pro'
- 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
- 'platform=macOS'
exclude:
# Don't run old macOS with new Xcode
- runner: macos-13
xcode: Xcode_16
- runner: macos-14
xcode: Xcode_16.1
# Don't run new macOS with old Xcode
- runner: macos-15
xcode: Xcode_15.2
# Don't run old simulators with new Xcode
- destination: 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_16
xcode: Xcode_16.1
- destination: 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
xcode: Xcode_16
xcode: Xcode_16.1
- destination: 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
xcode: Xcode_16
xcode: Xcode_16.1
# Don't run new simulators with old Xcode
- destination: 'platform=tvOS Simulator,OS=18.0,name=Apple TV 4K (3rd generation) (at 1080p)'
- destination: 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_15.2
- destination: 'platform=iOS Simulator,OS=18.0,name=iPhone 16'
- destination: 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
xcode: Xcode_15.2
- destination: 'platform=visionOS Simulator,OS=2.0,name=Apple Vision Pro'
- destination: 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
xcode: Xcode_15.2
steps:
- name: Configure Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app
- name: Install visionOS 2.0 sim
if: ${{ matrix.destination == 'platform=visionOS Simulator,OS=2.0,name=Apple Vision Pro' }}
- name: Install visionOS sim if needed
if: ${{ contains(matrix.destination, 'platform=visionOS') }}
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
Expand Down Expand Up @@ -101,6 +101,14 @@ jobs:
java-version: 17
- name: Tools Versions
run: ./scripts/ci_steps/log_tool_versions.sh
- name: Run CLI Unit Tests
if: ${{ matrix.destination == 'platform=macOS' }}
run: |
cd AWSSDKSwiftCLI
swift test
cd ../SPRCLI
unset AWS_SWIFT_SDK_USE_LOCAL_DEPS
swift build
- name: Prepare Protocol & Unit Tests
run: |
./scripts/ci_steps/prepare_protocol_and_unit_tests.sh
Expand Down Expand Up @@ -182,6 +190,13 @@ jobs:
run: ./scripts/ci_steps/install_native_linux_dependencies.sh
- name: Tools Versions
run: ./scripts/ci_steps/log_tool_versions.sh
- name: Run CLI Unit Tests
run: |
cd AWSSDKSwiftCLI
swift test
cd ../SPRCLI
unset AWS_SWIFT_SDK_USE_LOCAL_DEPS
swift build
- name: Prepare Protocol & Unit Tests
run: |
./scripts/ci_steps/prepare_protocol_and_unit_tests.sh
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,45 @@ jobs:
matrix:
# This matrix runs tests on iOS sim & Mac, on oldest & newest supported Xcodes
runner:
- macos-13
- macos-14
- macos-15
xcode:
- Xcode_15.2
- Xcode_16
- Xcode_16.1
destination:
- 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
- 'platform=iOS Simulator,OS=18.0,name=iPhone 16'
- 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
- 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=tvOS Simulator,OS=18.0,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
- 'platform=visionOS Simulator,OS=2.0,name=Apple Vision Pro'
- 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
- 'platform=macOS'
exclude:
# Don't run old macOS with new Xcode
- runner: macos-13
xcode: Xcode_16
- runner: macos-14
xcode: Xcode_16.1
# Don't run new macOS with old Xcode
- runner: macos-15
xcode: Xcode_15.2
# Don't run old simulators with new Xcode
- destination: 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_16
xcode: Xcode_16.1
- destination: 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
xcode: Xcode_16
xcode: Xcode_16.1
- destination: 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
xcode: Xcode_16
xcode: Xcode_16.1
# Don't run new simulators with old Xcode
- destination: 'platform=tvOS Simulator,OS=18.0,name=Apple TV 4K (3rd generation) (at 1080p)'
- destination: 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_15.2
- destination: 'platform=iOS Simulator,OS=18.0,name=iPhone 16'
- destination: 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
xcode: Xcode_15.2
- destination: 'platform=visionOS Simulator,OS=2.0,name=Apple Vision Pro'
- destination: 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
xcode: Xcode_15.2
steps:
- name: Configure Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app
- name: Install visionOS 2.0 sim
if: ${{ matrix.destination == 'platform=visionOS Simulator,OS=2.0,name=Apple Vision Pro' }}
- name: Install visionOS sim if needed
if: ${{ contains(matrix.destination, 'platform=visionOS') }}
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Package.resolved
build/
codegen/protocol-test-codegen-local/smithy-build.json
codegen/protocol-test-codegen/smithy-build.json
SmokeTests/

# vim temporary files
*.swp
Expand All @@ -39,3 +40,6 @@ codegen/protocol-test-codegen/smithy-build.json
# Allow the AWSSDKSwiftCLI Package.resolved
# while excluding all other Package.resolved files
!/AWSSDKSwiftCLI/Package.resolved

# Xcode config that is for the installed copy only
xcuserdata
1 change: 1 addition & 0 deletions AWSSDKSwiftCLI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let package = Package(
resources: [
.process("Resources/Package.Prefix.txt"),
.process("Resources/Package.Base.txt"),
.process("Resources/SmokeTestsPackage.Base.txt"),
.process("Resources/DocIndex.Base.md")
]
),
Expand Down
13 changes: 13 additions & 0 deletions AWSSDKSwiftCLI/Sources/AWSCLIUtils/FileManager+Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ public extension FileManager {
.filter { !$0.hasPrefix(".") }
}

/// Returns the list of services that have smoke tests and test runner generated for them.
/// Service names are extracted from service name prefix of directory names under `SmokeTests/`.
/// E.g., extract `AWSS3` from `SmokeTests/AWSS3SmokeTestRunner/`.
///
/// - Returns: The list of services with generated smoke tests.
func servicesWithSmokeTests() throws -> [String] {
try FileManager.default
.contentsOfDirectory(atPath: "SmokeTests")
.sorted()
.filter { !$0.hasPrefix(".") && $0.hasSuffix("SmokeTestRunner") }
.map { $0.replacingOccurrences(of: "SmokeTestRunner", with: "") }
}

/// Returns the list of Smithy runtime modules within `../smithy-swift/Sources/Core`
///
/// - Returns: The list of Smithy runtime modules.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ struct AWSSDKSwiftCLI: ParsableCommand {
PrepareReleaseCommand.self,
SyncClientRuntimeVersionCommand.self,
TestAWSSDKCommand.self,
GenerateDocIndexCommand.self
GenerateDocIndexCommand.self,
GenerateSmokeTestsPackageManifestCommand.self
]
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//

import ArgumentParser
import Foundation
import AWSCLIUtils

struct GenerateSmokeTestsPackageManifestCommand: ParsableCommand {
static var configuration = CommandConfiguration(
commandName: "generate-smoke-tests-package-manifest",
abstract: "Generates the Package.swift manifest for the aws-sdk-swift/SmokeTests package."
)

@Argument(help: "The path to the aws-sdk-swift repository")
var repoPath: String

func run() throws {
let generateSmokeTestsPackageManifest = GenerateSmokeTestsPackageManifest(
repoPath: repoPath
)
try generateSmokeTestsPackageManifest.run()
}
}

struct GenerateSmokeTestsPackageManifest {
/// The path to the package repository
let repoPath: String

func run() throws {
try FileManager.default.changeWorkingDirectory(repoPath)
// Generate package manifest for smoke tests and save it as aws-sdk-swift/SmokeTests/Package.swift
let smokeTestsContents = try generateSmokeTestsPackageManifestContents()
try savePackageManifest(smokeTestsContents)
}

// MARK: - Helpers

func generateSmokeTestsPackageManifestContents() throws -> String {
return [
// SmokeTests package manifest uses same prefix as one for aws-sdk-swift.
try PackageManifestBuilder.contentReader(filename: "Package.Prefix")(),
try generateServiceNamesArray(),
try PackageManifestBuilder.contentReader(filename: "SmokeTestsPackage.Base")()
].joined(separator: .newline)
}

func generateServiceNamesArray() throws -> String {
let servicesWithSmokeTests = try FileManager.default.servicesWithSmokeTests()
let formatedServiceList = servicesWithSmokeTests.map { "\t\"\($0)\"," }.joined(separator: .newline)
return [
"// All services that have smoke tests generated for them.",
"let serviceNames: [String] = [",
formatedServiceList,
"]"
].joined(separator: .newline)
}

func savePackageManifest(_ contents: String) throws {
let packageFilePath = "SmokeTests/Package.swift"
log("Saving package manifest to \(packageFilePath)...")
try contents.write(
toFile: packageFilePath,
atomically: true,
encoding: .utf8
)
log("Successfully saved package manifest to \(packageFilePath)")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct PrepareRelease {
let diffChecker: DiffChecker

/// Prepares a release for the specified repository.
/// If the respository doesn't have any changes, then this does nothing.
/// If the repository doesn't have any changes, then this does nothing.
func run() throws {
try FileManager.default.changeWorkingDirectory(repoPath)

Expand Down Expand Up @@ -235,13 +235,16 @@ struct PrepareRelease {
previousVersion: Version
) throws {
let commits = try Process.git.listOfCommitsBetween("HEAD", "\(previousVersion)")

let featuresReader = FeaturesReader()

let releaseNotes = try ReleaseNotesBuilder(
previousVersion: previousVersion,
newVersion: newVersion,
repoOrg: repoOrg,
repoType: repoType,
commits: commits
commits: commits,
features: featuresReader.getFeaturesFromFile(),
featuresIDToServiceName: featuresReader.getFeaturesIDToServiceNameDictFromFile()
).build()

let manifest = ReleaseManifest(
Expand Down
19 changes: 6 additions & 13 deletions AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Features.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,18 @@
import Foundation
import AWSCLIUtils

struct FeaturesReader: Decodable {
private let requestFilePath: String
private let mappingFilePath: String

public init(
requestFilePath: String = "../build-request.json",
mappingFilePath: String = "../feature-service-id.json"
) {
self.requestFilePath = requestFilePath
self.mappingFilePath = mappingFilePath
}
/// Reads the Trebuchet request & service mapping files from the parent of the current working directory.
struct FeaturesReader {
private let requestFile = "../build-request.json"
private let mappingFile = "../feature-service-id.json"

public func getFeaturesFromFile() throws -> Features {
let fileContents = try FileManager.default.loadContents(atPath: requestFilePath)
let fileContents = try FileManager.default.loadContents(atPath: requestFile)
return try JSONDecoder().decode(Features.self, from: fileContents)
}

public func getFeaturesIDToServiceNameDictFromFile() throws -> [String: String] {
let fileContents = try FileManager.default.loadContents(atPath: mappingFilePath)
let fileContents = try FileManager.default.loadContents(atPath: mappingFile)
return try JSONDecoder().decode([String: String].self, from: fileContents)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ struct ReleaseNotesBuilder {
let repoOrg: PrepareRelease.Org
let repoType: PrepareRelease.Repo
let commits: [String]
var featuresReader: FeaturesReader = FeaturesReader()
let features: Features
let featuresIDToServiceName: [String: String]

// MARK: - Build

Expand All @@ -41,9 +42,7 @@ struct ReleaseNotesBuilder {
}

func buildServiceChangeSection() throws -> [String] {
let features = try featuresReader.getFeaturesFromFile()
let mapping = try featuresReader.getFeaturesIDToServiceNameDictFromFile()
return buildServiceFeatureSection(features, mapping) + buildServiceDocSection(features, mapping)
return buildServiceFeatureSection(features, featuresIDToServiceName) + buildServiceDocSection(features, featuresIDToServiceName)
}

private func buildServiceFeatureSection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ A pure-Swift SDK for accessing all published AWS services.

## Overview

**The AWS SDK for Swift is currently in developer preview and is intended strictly for feedback purposes only. Do not use this SDK for production workloads. Refer to the SDK [stability guidelines](docs/stability.md) for more detail.**

This SDK is open-source. Code is available on Github [here](https://github.com/awslabs/aws-sdk-swift).
Loading

0 comments on commit 3119136

Please sign in to comment.