-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build IntegrationTest package as part of CI pipeline (#56)
### Motivation We have an package in a subdirectory in this repo that we can be used as an integration test to gate changes to the various repos in Swift OpenAPI project, including the runtime package. This will likely be implemented by shallow cloning this repo in the pull request pipelines of other projects and running a script, using `swift package edit` to override the dependency on the package being tested, and building the integration test package. ### Modifications - Simplify the integration test package location and name. - Add a CI script that runs the integration test with a package override. - Run this script as part of the soundness pipeline. ### Result On each pull request, the integration test package will be built with the changes proposed in the pull request. ### Test Plan The CI pipeline for this PR will run the integration test because it's been added to the soundness script, which is run as part of an existing CI pipeline. I have also validated this locally: ```console ❯ docker-compose -f docker/docker-compose.yaml run --build soundness ... ** Running /code/scripts/check-for-broken-symlinks.sh... ** Checking for broken symlinks... ** ✅ Found 0 symlinks. ** Running /code/scripts/check-for-unacceptable-language.sh... ** Checking for unacceptable language... ** ✅ Found no unacceptable language. ** Running /code/scripts/check-license-headers.sh... ** ✅ Found no files with missing license header. ** Running /code/scripts/run-swift-format.sh... ** ✅ Ran swift-format with no errors. ** Running /code/scripts/check-for-docc-warnings.sh... ... ** ✅ Generated documentation with no warnings. ** Running /code/scripts/run-integration-test.sh... ** Checking required executables... ... Build complete! (42.53s) ** ✅ Successfully built integration test package. ** ✅ All soundness check(s) passed. ``` ### Notes This PR adds the integration test to the soundness script, but we probably want to split this out into its own pipeline. --------- Signed-off-by: Si Beaumont <[email protected]>
- Loading branch information
1 parent
02924d1
commit 37255b7
Showing
20 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the SwiftOpenAPIGenerator open source project | ||
## | ||
## Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
set -euo pipefail | ||
|
||
log() { printf -- "** %s\n" "$*" >&2; } | ||
error() { printf -- "** ERROR: %s\n" "$*" >&2; } | ||
fatal() { error "$@"; exit 1; } | ||
|
||
log "Checking required executables..." | ||
SWIFT_BIN=${SWIFT_BIN:-$(command -v swift || xcrun -f swift)} || fatal "SWIFT_BIN unset and no swift on PATH" | ||
JQ_BIN=${JQ_BIN:-$(command -v jq)} || fatal "JQ_BIN unset and no jq on PATH" | ||
|
||
CURRENT_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
REPO_ROOT="$(git -C "${CURRENT_SCRIPT_DIR}" rev-parse --show-toplevel)" | ||
TMP_DIR=$(mktemp -d "${PWD}/tmp.$(basename "$0").XXXXXXXXXX.noindex") | ||
|
||
PACKAGE_PATH=${PACKAGE_PATH:-${REPO_ROOT}} | ||
|
||
SWIFT_OPENAPI_GENERATOR_REPO_URL="${SWIFT_OPENAPI_GENERATOR_REPO_URL:-https://github.com/apple/swift-openapi-generator}" | ||
SWIFT_OPENAPI_GENERATOR_REPO_CLONE_DIR="${TMP_DIR}/$(basename "${SWIFT_OPENAPI_GENERATOR_REPO_URL}")" | ||
INTEGRATION_TEST_PACKAGE_PATH="${SWIFT_OPENAPI_GENERATOR_REPO_CLONE_DIR}/IntegrationTest" | ||
|
||
log "Cloning ${SWIFT_OPENAPI_GENERATOR_REPO_URL} to ${SWIFT_OPENAPI_GENERATOR_REPO_CLONE_DIR}" | ||
git clone --depth=1 "${SWIFT_OPENAPI_GENERATOR_REPO_URL}" "${SWIFT_OPENAPI_GENERATOR_REPO_CLONE_DIR}" | ||
|
||
log "Extracting name for Swift package: ${PACKAGE_PATH}" | ||
PACKAGE_NAME=$(swift package --package-path "${PACKAGE_PATH}" describe --type json | "${JQ_BIN}" -r .name) | ||
|
||
log "Overriding dependency in ${INTEGRATION_TEST_PACKAGE_PATH} on ${PACKAGE_NAME} to use ${PACKAGE_PATH}" | ||
swift package --package-path "${INTEGRATION_TEST_PACKAGE_PATH}" \ | ||
edit "${PACKAGE_NAME}" --path "${PACKAGE_PATH}" | ||
|
||
log "Building integration test package: ${INTEGRATION_TEST_PACKAGE_PATH}" | ||
swift build --package-path "${INTEGRATION_TEST_PACKAGE_PATH}" | ||
|
||
log "✅ Successfully built integration test package." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters