Expose reconnect scheduling metrics #53
This file contains hidden or 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
| name: Distribution Checks | |
| on: | |
| pull_request: | |
| paths: | |
| - "Source/**/*.swift" | |
| - "CocoaMQTTTests/**/*.swift" | |
| - "Package.swift" | |
| - "Package.resolved" | |
| - "CocoaMQTT.podspec" | |
| - ".github/workflows/distribution-check.yml" | |
| push: | |
| tags: | |
| - "*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tag-version-check: | |
| name: Tag Version Guard | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Verify pushed tag matches CocoaMQTT.podspec version | |
| run: | | |
| set -euo pipefail | |
| VERSION="$(ruby -ne 'puts $1 if /s\.version\s*=\s*"([^"]+)"/' CocoaMQTT.podspec)" | |
| SOURCE_TAG="$(ruby -ne 'puts $1 if /:tag\s*=>\s*"([^"]+)"/' CocoaMQTT.podspec)" | |
| if [ -z "${VERSION}" ] || [ -z "${SOURCE_TAG}" ]; then | |
| echo "Failed to parse version or source tag from CocoaMQTT.podspec" | |
| exit 1 | |
| fi | |
| if [ "${VERSION}" != "${SOURCE_TAG}" ]; then | |
| echo "podspec version (${VERSION}) must match source tag (${SOURCE_TAG})" | |
| exit 1 | |
| fi | |
| TAG_NAME="${GITHUB_REF#refs/tags/}" | |
| TAG_VERSION="${TAG_NAME#v}" | |
| if [ "${TAG_VERSION}" != "${VERSION}" ]; then | |
| echo "Git tag (${TAG_NAME}) must match podspec version (${VERSION})" | |
| exit 1 | |
| fi | |
| echo "Tag/version guard passed: tag=${TAG_NAME}, podspec=${VERSION}" | |
| spm-smoke: | |
| name: SPM Release Smoke | |
| runs-on: macos-15 | |
| timeout-minutes: 25 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Validate package manifest | |
| run: swift package dump-package > /dev/null | |
| - name: Build package targets | |
| run: swift build | |
| - name: Build as local SPM dependency | |
| run: | | |
| set -euo pipefail | |
| TMP_DIR="$(mktemp -d)" | |
| trap 'rm -rf "${TMP_DIR}"' EXIT | |
| cat > "${TMP_DIR}/Package.swift" <<SPM | |
| // swift-tools-version:5.7 | |
| import PackageDescription | |
| let package = Package( | |
| name: "CocoaMQTTSmoke", | |
| platforms: [.macOS(.v10_13)], | |
| dependencies: [ | |
| .package(path: "${GITHUB_WORKSPACE}") | |
| ], | |
| targets: [ | |
| .executableTarget( | |
| name: "CocoaMQTTSmoke", | |
| dependencies: [ | |
| .product(name: "CocoaMQTT", package: "CocoaMQTT"), | |
| .product(name: "CocoaMQTTWebSocket", package: "CocoaMQTT") | |
| ] | |
| ) | |
| ] | |
| ) | |
| SPM | |
| mkdir -p "${TMP_DIR}/Sources/CocoaMQTTSmoke" | |
| cat > "${TMP_DIR}/Sources/CocoaMQTTSmoke/main.swift" <<'SPM_MAIN' | |
| import CocoaMQTT | |
| import CocoaMQTTWebSocket | |
| let message = CocoaMQTTMessage(topic: "ci/spm", string: "ok") | |
| let socket = CocoaMQTTWebSocket(uri: "/mqtt") | |
| print("\(message.topic) \(socket.enableSSL)") | |
| SPM_MAIN | |
| swift build --package-path "${TMP_DIR}" | |
| - name: Build as tagged SPM dependency | |
| if: github.ref_type == 'tag' | |
| run: | | |
| set -euo pipefail | |
| TMP_DIR="$(mktemp -d)" | |
| trap 'rm -rf "${TMP_DIR}"' EXIT | |
| cat > "${TMP_DIR}/Package.swift" <<SPM | |
| // swift-tools-version:5.7 | |
| import PackageDescription | |
| let package = Package( | |
| name: "CocoaMQTTTaggedSmoke", | |
| platforms: [.macOS(.v10_13)], | |
| dependencies: [ | |
| .package(url: "https://github.com/${GITHUB_REPOSITORY}.git", exact: "${GITHUB_REF_NAME}") | |
| ], | |
| targets: [ | |
| .executableTarget( | |
| name: "CocoaMQTTTaggedSmoke", | |
| dependencies: [ | |
| .product(name: "CocoaMQTT", package: "CocoaMQTT"), | |
| .product(name: "CocoaMQTTWebSocket", package: "CocoaMQTT") | |
| ] | |
| ) | |
| ] | |
| ) | |
| SPM | |
| mkdir -p "${TMP_DIR}/Sources/CocoaMQTTTaggedSmoke" | |
| cat > "${TMP_DIR}/Sources/CocoaMQTTTaggedSmoke/main.swift" <<'SPM_MAIN' | |
| import CocoaMQTT | |
| import CocoaMQTTWebSocket | |
| print(CocoaMQTTMessage(topic: "ci/tag", string: "ok").topic) | |
| SPM_MAIN | |
| swift build --package-path "${TMP_DIR}" | |
| cocoapods-lint: | |
| name: CocoaPods Release Lint | |
| runs-on: macos-15 | |
| timeout-minutes: 35 | |
| env: | |
| COCOAPODS_DISABLE_STATS: "true" | |
| LANG: en_US.UTF-8 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@19a43a6a2428d455dbd1b85344698725179c9d8c # v1 | |
| with: | |
| ruby-version: "3.2" | |
| - name: Install CocoaPods | |
| run: gem install cocoapods --no-document | |
| - name: Verify podspec version and source tag | |
| run: | | |
| set -euo pipefail | |
| VERSION="$(ruby -ne 'puts $1 if /s\.version\s*=\s*"([^"]+)"/' CocoaMQTT.podspec)" | |
| SOURCE_TAG="$(ruby -ne 'puts $1 if /:tag\s*=>\s*"([^"]+)"/' CocoaMQTT.podspec)" | |
| if [ -z "${VERSION}" ] || [ -z "${SOURCE_TAG}" ]; then | |
| echo "Failed to parse CocoaMQTT.podspec version or source tag" | |
| exit 1 | |
| fi | |
| if [ "${VERSION}" != "${SOURCE_TAG}" ]; then | |
| echo "podspec version (${VERSION}) must match source tag (${SOURCE_TAG})" | |
| exit 1 | |
| fi | |
| - name: Lint CocoaPods Core subspec | |
| run: pod lib lint CocoaMQTT.podspec --subspec=Core --allow-warnings --skip-tests --fail-fast --verbose | |
| - name: Lint CocoaPods WebSockets subspec | |
| run: pod lib lint CocoaMQTT.podspec --subspec=WebSockets --allow-warnings --skip-tests --fail-fast --verbose | |
| - name: Lint tagged podspec from source | |
| if: github.ref_type == 'tag' | |
| run: pod spec lint CocoaMQTT.podspec --allow-warnings --skip-tests --fail-fast --verbose |