-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcheck-for-docc-warnings.sh
executable file
·55 lines (47 loc) · 1.88 KB
/
check-for-docc-warnings.sh
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
#!/usr/bin/env bash
##===----------------------------------------------------------------------===##
##
## This source file is part of the Swift OpenAPI Lambda open source project
##
## Copyright (c) 2023 Amazon.com, Inc. or its affiliates
## and the Swift OpenAPI Lambda project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.txt for the list of Swift OpenAPI Lambda project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##
##===----------------------------------------------------------------------===##
##
## 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 environment variables..."
test -n "${DOCC_TARGET:-}" || fatal "DOCC_TARGET unset"
CURRENT_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_ROOT="$(git -C "${CURRENT_SCRIPT_DIR}" rev-parse --show-toplevel)"
# --warnings-as-errors \
swift package --package-path "${REPO_ROOT}" plugin generate-documentation \
--product "${DOCC_TARGET}" \
--analyze \
--level detailed \
&& DOCC_PLUGIN_RC=$? || DOCC_PLUGIN_RC=$?
if [ "${DOCC_PLUGIN_RC}" -ne 0 ]; then
fatal "❌ Generating documentation produced warnings and/or errors."
exit "${DOCC_PLUGIN_RC}"
fi
log "✅ Generated documentation with no warnings."