api-swift / scripts / release-check.sh
204 words
 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
#!/usr/bin/env bash
# scripts/release-check.sh — everything that must be green before tagging a
# release: the manifest parses, the generated code matches the spec snapshot,
# the package builds and the offline test suite passes on macOS, and the working
# tree is clean. RELEASE=1 additionally requires HEAD to carry a version tag;
# MACAPP=1 also builds the example app; IOS=1 builds the package for the iOS Simulator.
set -euo pipefail
cd "$(dirname "$0")/.."

echo "== manifest"
swift package dump-package > /dev/null

echo "== generated sources"
python3 scripts/gen-api.py --check

echo "== build (macOS)"
swift build

echo "== tests (offline)"
swift test

if [ "${IOS:-0}" = "1" ]; then
  echo "== build (iOS Simulator)"
  xcodebuild -scheme ird-api-swift -destination 'generic/platform=iOS Simulator' -derivedDataPath .build/DerivedData build | grep -E "BUILD|error:" || true
fi

if [ "${MACAPP:-0}" = "1" ]; then
  echo "== build (example app, macOS)"
  xcodebuild -project Examples/IrdManager/IrdManager.xcodeproj -scheme IrdManager -destination 'generic/platform=macOS' \
    -derivedDataPath .build/DerivedData CODE_SIGNING_ALLOWED=NO build | grep -E "BUILD|error:" || true
fi

echo "== working tree"
if [ -n "$(git status --porcelain)" ]; then
  echo "ABORT: uncommitted changes" >&2
  git status --short >&2
  exit 1
fi

if [ "${RELEASE:-0}" = "1" ]; then
  echo "== tag"
  git describe --exact-match --tags HEAD
fi

echo "release-check: OK"

static mirror of HEAD · about · clone: git clone https://ird.cod-sursa.ro/api-swift.git