From 658f0d164f4ddf03933562478a19a813ec013f13 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Thu, 28 Dec 2023 09:35:20 -0500 Subject: [PATCH 1/3] ci: Automate release process with release please --- .circleci/config.yml | 169 ------------------ .circleci/run-build-locally.sh | 13 -- .github/ISSUE_TEMPLATE/bug_report.md | 17 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/actions/build-docs/action.yml | 13 ++ .github/actions/ci/action.yml | 83 +++++++++ .github/actions/publish-docs/action.yml | 15 ++ .github/actions/publish/action.yml | 14 ++ .github/actions/update-versions/action.yml | 55 ++++++ .github/pull_request_template.md | 2 +- .github/workflows/ci.yml | 36 ++++ .github/workflows/lint-pr-title.yml | 12 ++ .github/workflows/manual-publish-docs.yml | 26 +++ .github/workflows/manual-publish.yml | 35 ++++ .github/workflows/release-please.yml | 64 +++++++ .release-please-manifest.json | 3 + CONTRIBUTING.md | 2 +- LaunchDarkly.podspec | 2 +- .../ServiceObjects/EnvironmentReporter.swift | 2 +- Makefile | 8 +- README.md | 6 +- release-please-config.json | 16 ++ 22 files changed, 391 insertions(+), 204 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .circleci/run-build-locally.sh create mode 100644 .github/actions/build-docs/action.yml create mode 100644 .github/actions/ci/action.yml create mode 100644 .github/actions/publish-docs/action.yml create mode 100644 .github/actions/publish/action.yml create mode 100644 .github/actions/update-versions/action.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/lint-pr-title.yml create mode 100644 .github/workflows/manual-publish-docs.yml create mode 100644 .github/workflows/manual-publish.yml create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index f0a20bc4..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,169 +0,0 @@ -version: 2.1 - -jobs: - contract-tests: - macos: - xcode: '14.2.0' - - steps: - - checkout - - - run: - name: Install swift lint - command: brew install swiftlint - - run: - name: Run swiftlint - command: | - cd ./ContractTests - swiftlint lint --reporter junit | tee /tmp/contract-test-swiftlint-results.xml - - store_artifacts: - path: /tmp/contract-test-swiftlint-results.xml - - store_test_results: - path: /tmp/contract-test-swiftlint-results.xml - - - run: - name: Install required ssl libraries - command: brew install libressl - - run: - name: make test output directory - command: mkdir /tmp/test-results - - run: make build-contract-tests - - run: - command: make start-contract-test-service - background: true - - run: - name: run contract tests - command: TEST_HARNESS_PARAMS="-junit /tmp/test-results/contract-tests-junit.xml" make run-contract-tests - - store_test_results: - path: /tmp/test-results/ - - build: - parameters: - xcode-version: - type: string - ios-sim: - type: string - build-doc: - type: boolean - default: false - run-lint: - type: boolean - default: false - - shell: /bin/bash --login -eo pipefail - - macos: - xcode: <> - resource_class: macos.x86.medium.gen2 - - steps: - - checkout - - # XCode11 has a bug related to respecting system known_hosts. The CircleCI checkout - # step is automatically setting all git URLs to use ssh. Since we do not have any - # private dependencies in this repo, it is ok to not us SSH for fetching the dependencies - - run: - name: Remove Git SSH restriction (XCode 11 bug workaround) - command: git config --global --remove-section url."ssh://git@github.com" - - - run: - name: Setup for builds - command: | - mkdir -p 'test-results' - mkdir -p 'artifacts' - - - run: - name: Build for macOS - command: xcodebuild build -scheme 'LaunchDarkly_macOS' -sdk macosx -destination 'platform=macOS' | tee 'artifacts/raw-logs-macosx.txt' | xcpretty -r junit -o 'test-results/platform-macosx/junit.xml' - when: always - - - run: - name: Build Tests for iOS device - command: xcodebuild build-for-testing -scheme 'LaunchDarkly_iOS' -sdk iphoneos CODE_SIGN_IDENTITY= | tee 'artifacts/raw-logs-iphoneos.txt' | xcpretty - when: always - - - run: - name: Build & Test on iOS Simulator - command: xcodebuild test -scheme 'LaunchDarkly_iOS' -sdk iphonesimulator -destination '<>' CODE_SIGN_IDENTITY= | tee 'artifacts/raw-logs-iphonesimulator.txt' | xcpretty -r junit -o 'test-results/platform-iphonesimulator/junit.xml' - when: always - - - run: - name: Build for tvOS device - command: xcodebuild build -scheme 'LaunchDarkly_tvOS' -sdk appletvos CODE_SIGN_IDENTITY= | tee 'artifacts/raw-logs-appletvos.txt' | xcpretty - when: always - - - run: - name: Build for tvOS Simulator - command: xcodebuild build -scheme 'LaunchDarkly_tvOS' -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' | tee 'artifacts/raw-logs-appletvsimulator.txt' | xcpretty -r junit -o 'test-results/platform-appletvsimulator/junit.xml' - when: always - - - run: - name: Build for watchOS simulator - command: xcodebuild build -scheme 'LaunchDarkly_watchOS' -sdk watchsimulator | tee 'artifacts/raw-logs-watchsimulator.txt' | xcpretty - when: always - - - run: - name: Build for watchOS device - command: xcodebuild build -scheme 'LaunchDarkly_watchOS' -sdk watchos | tee 'artifacts/raw-logs-watchos.txt' | xcpretty - when: always - - - run: - name: Build & Test with swiftpm - command: swift test -v 2>&1 | tee 'artifacts/raw-logs-swiftpm.txt' | xcpretty -r junit -o 'test-results/swiftpm/junit.xml' - when: always - - - when: - condition: <> - steps: - - restore_cache: - key: v1-gem-cache-<>- - - - run: - name: Install jazzy gem - command: | - gem install jazzy - gem cleanup - # Used as cache key to prevent storing redundant caches - gem list > /tmp/cache-key.txt - - - save_cache: - key: v1-gem-cache-<>-{{ checksum "/tmp/cache-key.txt" }} - paths: - - ~/.gem - - - run: - name: Build Documentation - command: jazzy -o artifacts/docs - - - when: - condition: <> - steps: - - run: - name: CocoaPods spec lint - command: | - if [ "$CIRCLE_BRANCH" = 'main' ]; then - pod spec lint - else - pod lib lint - fi - - - store_test_results: - path: test-results - - - store_artifacts: - path: artifacts - -workflows: - version: 2 - - build: - jobs: - - build: - name: Xcode 14.0 - Swift 5.7 - xcode-version: '14.0.1' - ios-sim: 'platform=iOS Simulator,name=iPhone 14,OS=16.0' - - build: - name: Xcode 13.4.1 - Swift 5.6 - xcode-version: '13.4.1' - ios-sim: 'platform=iOS Simulator,name=iPhone 13,OS=15.5' - - contract-tests diff --git a/.circleci/run-build-locally.sh b/.circleci/run-build-locally.sh deleted file mode 100644 index 6d75fee4..00000000 --- a/.circleci/run-build-locally.sh +++ /dev/null @@ -1,13 +0,0 @@ -# A script that triggers a circleci build from the command line -# Script from https://circleci.com/docs/2.0/examples/#video-test-your-config-file-locally -# Usage: From the project folder (e.g. 'ios-swift-client-sdk-private') run 'bash .circleci/run-build-locally.sh' -# Set the url to run in this format -# https://circleci.com/api/v1.1/project////tree/ -# Dependencies: -# CIRCLE_TOKEN must be defined in the environment. -# See https://circleci.com/docs/2.0/managing-api-tokens/#creating-a-personal-api-token -curl --user ${CIRCLE_TOKEN}: \ - --request POST \ - --form config=@.circleci/config.yml \ - --form notify=false \ - https://circleci.com/api/v1.1/project/github/launchdarkly/ios-swift-client-sdk-private/tree/main diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a9c8db85..a18e20c0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,11 +7,6 @@ assignees: '' --- -**Is this a support request?** -This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/hc/en-us/requests/new) or by emailing support@launchdarkly.com. - -Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above. - **Describe the bug** A clear and concise description of what the bug is. @@ -24,14 +19,14 @@ A clear and concise description of what you expected to happen. **Logs** If applicable, add any log output related to your problem. -**SDK version** -The version of this SDK that you are using. +**Library version** +The version that you are using. -**Language version, developer tools** -For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too. +**XCode and Swift version** +For instance, XCode 11.5, Swift 5.1. -**OS/platform** -For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version. +**Platform the issue occurs on** +iPhone, iPad, macOS, tvOS, or watchOS. **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 3f7d5bf3..ec89dc9c 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -8,7 +8,7 @@ assignees: '' --- **Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...] +A clear and concise description of what the problem is. Ex. I would love to see the library [...does something new...] **Describe the solution you'd like** A clear and concise description of what you want to happen. diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml new file mode 100644 index 00000000..991107a4 --- /dev/null +++ b/.github/actions/build-docs/action.yml @@ -0,0 +1,13 @@ +name: Build Documentation +description: 'Build Documentation.' + +runs: + using: composite + steps: + - name: Install jazzy gem + shell: bash + run: gem install jazzy + + - name: Build Documentation + shell: bash + run: jazzy -o docs diff --git a/.github/actions/ci/action.yml b/.github/actions/ci/action.yml new file mode 100644 index 00000000..ff4cb2f1 --- /dev/null +++ b/.github/actions/ci/action.yml @@ -0,0 +1,83 @@ +# This is a composite to allow sharing these steps into other workflows. +# For instance it could be used by regular CI as well as the release process. + +name: CI Workflow +description: 'Shared CI workflow.' +inputs: + xcode-version: + description: 'Which version of xcode should be installed' + required: true + ios-sim: + description: 'iOS Simulator to use for testing' + required: true + +runs: + using: composite + steps: + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd + with: + xcode-version: ${{ inputs.xcode-version }} + + - name: Install mint and swiftlint + shell: bash + run: | + brew tap mint-lang/mint-lang + brew install mint-lang swiftlint libressl + + - name: Install cocoapods + shell: bash + run: gem install cocoapods + + - name: Lint the podspec + shell: bash + run: pod spec lint LaunchDarkly.podspec + + - name: Run swiftlint + shell: bash + run: | + cd ./ContractTests + swiftlint lint + + - name: Build for macOS + shell: bash + run: xcodebuild build -scheme 'LaunchDarkly_macOS' -sdk macosx -destination 'platform=macOS' | xcpretty + + - name: Build Tests for iOS device + shell: bash + run: xcodebuild build-for-testing -scheme 'LaunchDarkly_iOS' -sdk iphoneos CODE_SIGN_IDENTITY= | xcpretty + + - name: Build & Test on iOS Simulator + shell: bash + run: xcodebuild test -scheme 'LaunchDarkly_iOS' -sdk iphonesimulator -destination '${{ inputs.ios-sim }}' CODE_SIGN_IDENTITY= | xcpretty + + - name: Build for tvOS device + shell: bash + run: xcodebuild build -scheme 'LaunchDarkly_tvOS' -sdk appletvos CODE_SIGN_IDENTITY= | xcpretty + + - name: Build for tvOS Simulator + shell: bash + run: xcodebuild build -scheme 'LaunchDarkly_tvOS' -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty + + - name: Build for watchOS simulator + shell: bash + run: xcodebuild build -scheme 'LaunchDarkly_watchOS' -sdk watchsimulator | xcpretty + + - name: Build for watchOS device + shell: bash + run: xcodebuild build -scheme 'LaunchDarkly_watchOS' -sdk watchos | xcpretty + + - name: Build & Test with swiftpm + shell: bash + run: swift test -v + + - name: Build contract tests + shell: bash + run: make build-contract-tests + + - name: Start contract tests in background + shell: bash + run: make start-contract-test-service-bg + + - name: Run contract tests + shell: bash + run: sleep 5 && make run-contract-tests diff --git a/.github/actions/publish-docs/action.yml b/.github/actions/publish-docs/action.yml new file mode 100644 index 00000000..31a360a5 --- /dev/null +++ b/.github/actions/publish-docs/action.yml @@ -0,0 +1,15 @@ +name: Publish Documentation +description: 'Publish the documentation to GitHub pages' +inputs: + token: + description: 'Token to use for publishing.' + required: true + +runs: + using: composite + steps: + - uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1 + name: 'Publish to GitHub pages' + with: + docs_path: docs + github_token: ${{ inputs.token }} diff --git a/.github/actions/publish/action.yml b/.github/actions/publish/action.yml new file mode 100644 index 00000000..eac3c6e3 --- /dev/null +++ b/.github/actions/publish/action.yml @@ -0,0 +1,14 @@ +name: Publish Package +description: 'Publish the package to Cocoapods' +inputs: + dry_run: + description: 'Is this a dry run. If so no package will be published.' + required: true + +runs: + using: composite + steps: + - name: Push to cocoapods + if: ${{ inputs.dry_run == 'false' }} + shell: bash + run: pod trunk push LaunchDarkly.podspec --allow-warnings --verbose diff --git a/.github/actions/update-versions/action.yml b/.github/actions/update-versions/action.yml new file mode 100644 index 00000000..66695a5d --- /dev/null +++ b/.github/actions/update-versions/action.yml @@ -0,0 +1,55 @@ +name: Update xcode project version numbers +description: 'Update xcode project version numbers' +inputs: + branch: + description: 'The branch to checkout and push updates to' + required: true + +runs: + using: composite + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} + + - name: Calculate version numbers + id: version + shell: bash + run: | + version=$(jq -r '."."' .release-please-manifest.json) + major=$(echo "$version" | cut -f1 -d.) + minor=$(echo "$version" | cut -f2 -d.) + patch=$(echo "$version" | cut -f3 -d.) + # 64 + version gives us a letter offset for the framework version. + framework=$(echo $((major + 64)) | awk '{ printf("%c", $1) }') + + echo "major=${major}" >> "$GITHUB_OUTPUT" + echo "minor=${minor}" >> "$GITHUB_OUTPUT" + echo "patch=${patch}" >> "$GITHUB_OUTPUT" + echo "framework=${framework}" >> "$GITHUB_OUTPUT" + + - name: Update other version numbers + shell: bash + run: | + sed -i .bak -E \ + -e 's/MARKETING_VERSION = [^;]+/MARKETING_VERSION = ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}/' \ + -e 's/DYLIB_CURRENT_VERSION = [^;]+/DYLIB_CURRENT_VERSION = ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}/' \ + -e 's/DYLIB_COMPATIBILITY_VERSION = [^;]+/DYLIB_COMPATIBILITY_VERSION = ${{ steps.version.outputs.major }}.0.0/' \ + -e 's/FRAMEWORK_VERSION = .*/FRAMEWORK_VERSION = ${{ steps.version.outputs.framework }};/' \ + LaunchDarkly.xcodeproj/project.pbxproj + + sed -i .bak -E \ + -e "s/pod 'LaunchDarkly', '~> [0-9]+.[0-9]+'/pod 'LaunchDarkly', '~> ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}'/" \ + -e "s/github \"launchdarkly\/ios-client-sdk\" ~> [0-9]+.[0-9]+/github \"launchdarkly\/ios-client-sdk\" ~> ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}/" README.md + + rm -f LaunchDarkly.xcodeproj/project.pbxproj.bak README.md.bak + if [ $(git status --porcelain | wc -l) -gt 0 ]; then + git config --global user.name 'LaunchDarklyReleaseBot' + git config --global user.email 'LaunchDarklyReleaseBot@launchdarkly.com' + + git add LaunchDarkly.xcodeproj/project.pbxproj + git add README.md + + git commit -m 'Updating generated project and readme files' + git push + fi diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e7723490..d8892286 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,7 @@ **Requirements** - [ ] I have added test coverage for new or changed functionality -- [ ] I have followed the repository's [pull request submission guidelines](../blob/v6/CONTRIBUTING.md#submitting-pull-requests) +- [ ] I have followed the repository's [pull request submission guidelines](../blob/v8/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..d4d31cd7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: Run CI +on: + push: + branches: [ v8 ] + paths-ignore: + - '**.md' # Do not need to run CI for markdown changes. + pull_request: + branches: [ v8 ] + paths-ignore: + - '**.md' + +jobs: + macos-build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + include: + - xcode-version: 14.3.1 + ios-sim: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' + os: macos-13 + - xcode-version: 13.4.1 + ios-sim: 'platform=iOS Simulator,name=iPhone 11,OS=15.5' + os: macos-12 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # If you only need the current version keep this. + + - uses: ./.github/actions/ci + with: + xcode-version: ${{ matrix.xcode-version }} + ios-sim: ${{ matrix.ios-sim }} + + - uses: ./.github/actions/build-docs diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 00000000..4ba79c13 --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,12 @@ +name: Lint PR title + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + lint-pr-title: + uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main diff --git a/.github/workflows/manual-publish-docs.yml b/.github/workflows/manual-publish-docs.yml new file mode 100644 index 00000000..2d21f3a3 --- /dev/null +++ b/.github/workflows/manual-publish-docs.yml @@ -0,0 +1,26 @@ +on: + workflow_dispatch: + +name: Publish Documentation +jobs: + build-publish: + runs-on: macos-13 + + permissions: + id-token: write # Needed if using OIDC to get release secrets. + contents: write # Needed in this case to write github pages. + + steps: + - uses: actions/checkout@v4 + + - name: Build and Test + uses: ./.github/actions/ci + with: + xcode-version: 14.3.1 + ios-sim: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' + + - uses: ./.github/actions/build-docs + + - uses: ./.github/actions/publish-docs + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml new file mode 100644 index 00000000..b0aad877 --- /dev/null +++ b/.github/workflows/manual-publish.yml @@ -0,0 +1,35 @@ +name: Publish Package +on: + workflow_dispatch: + inputs: + dry_run: + description: 'Is this a dry run. If so no package will be published.' + type: boolean + required: true + +jobs: + build-publish: + runs-on: macos-13 + + # Needed to get tokens during publishing. + permissions: + id-token: write + contents: read + + steps: + - uses: actions/checkout@v4 + + - uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.0 + name: 'Get Cocoapods token' + with: + aws_assume_role: ${{ vars.AWS_ROLE_ARN }} + ssm_parameter_pairs: '/production/common/releasing/cocoapods/token = COCOAPODS_TRUNK_TOKEN' + + - uses: ./.github/actions/ci + with: + xcode-version: 14.3.1 + ios-sim: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' + + - uses: ./.github/actions/publish + with: + dry_run: ${{ inputs.dry_run }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..ea7b1c02 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,64 @@ +name: Run Release Please + +on: + push: + branches: + - v8 + +jobs: + release-package: + runs-on: macos-13 + + permissions: + id-token: write # Needed if using OIDC to get release secrets. + contents: write # Contents and pull-requests are for release-please to make releases. + pull-requests: write + + steps: + - uses: google-github-actions/release-please-action@v4 + id: release + with: + token: ${{ secrets.GITHUB_TOKEN }} + target-branch: ${{ github.ref_name }} + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # If you only need the current version keep this. + + # + # This step runs and updates an existing PR + # + - uses: ./.github/actions/update-versions + if: ${{ steps.release.outputs.prs_created == 'true' }} + with: + branch: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} + + # + # These remaining steps are ONLY run if a release was actually created + # + - uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.0 + if: ${{ steps.release.outputs.releases_created == 'true' }} + name: 'Get Cocoapods token' + with: + aws_assume_role: ${{ vars.AWS_ROLE_ARN }} + ssm_parameter_pairs: '/production/common/releasing/cocoapods/token = COCOAPODS_TRUNK_TOKEN' + + - uses: ./.github/actions/ci + if: ${{ steps.release.outputs.releases_created == 'true' }} + with: + xcode-version: 14.3.1 + ios-sim: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' + + - uses: ./.github/actions/build-docs + if: ${{ steps.release.outputs.releases_created == 'true' }} + + - uses: ./.github/actions/publish + if: ${{ steps.release.outputs.releases_created == 'true' }} + with: + token: ${{secrets.GITHUB_TOKEN}} + dry_run: false + + - uses: ./.github/actions/publish-docs + if: ${{ steps.release.outputs.releases_created == 'true' }} + with: + token: ${{secrets.GITHUB_TOKEN}} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..b0034f9d --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "8.3.1" +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0cf7e378..07866b01 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ This SDK is built with [Xcode](https://developer.apple.com/xcode/). This version ### Building -The exact command used to build the SDK depends on where you want to use it (for example -- iOS, watchOS, etc.). Refer to the `xcodebuild` commands in the SDK's [continuous integration build configuration](.circleci/config.yml) for examples on how to build for the different platforms. +The exact command used to build the SDK depends on where you want to use it (for example -- iOS, watchOS, etc.). Refer to the `xcodebuild` commands in the SDK's [continuous integration build configuration](.github/workflows/ci.yml) for examples on how to build for the different platforms. If you wish to clean your working directory between builds, include the `clean` goal in your `xcodebuild` command(s). diff --git a/LaunchDarkly.podspec b/LaunchDarkly.podspec index 30a93107..f214b513 100644 --- a/LaunchDarkly.podspec +++ b/LaunchDarkly.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |ld| ld.name = "LaunchDarkly" - ld.version = "8.3.1" + ld.version = "8.3.1" # x-release-please-version ld.summary = "iOS SDK for LaunchDarkly" ld.description = <<-DESC diff --git a/LaunchDarkly/LaunchDarkly/ServiceObjects/EnvironmentReporter.swift b/LaunchDarkly/LaunchDarkly/ServiceObjects/EnvironmentReporter.swift index fb2789f9..c33683f8 100644 --- a/LaunchDarkly/LaunchDarkly/ServiceObjects/EnvironmentReporter.swift +++ b/LaunchDarkly/LaunchDarkly/ServiceObjects/EnvironmentReporter.swift @@ -102,7 +102,7 @@ struct EnvironmentReporter: EnvironmentReporting { #endif var shouldThrottleOnlineCalls: Bool { !isDebugBuild } - let sdkVersion = "8.3.1" + let sdkVersion = "8.3.1" // x-release-please-version // Unfortunately, the following does not function in certain configurations, such as when included through SPM // var sdkVersion: String { // Bundle(for: LDClient.self).infoDictionary?["CFBundleShortVersionString"] as? String ?? "5.x" diff --git a/Makefile b/Makefile index e8523241..e30fac23 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ TEMP_TEST_OUTPUT=/tmp/contract-test-service.log build-contract-tests: - cd ./ContractTests && swift build + cd ./ContractTests && swift build --product ContractTests start-contract-test-service: build-contract-tests - cd ./ContractTests && swift run + cd ./ContractTests && swift run ContractTests serve -b 0.0.0.0:8080 start-contract-test-service-bg: @echo "Test service output will be captured in $(TEMP_TEST_OUTPUT)" @@ -12,8 +12,8 @@ start-contract-test-service-bg: run-contract-tests: @curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/master/downloader/run.sh \ - | VERSION=v2 PARAMS="-url http://localhost:8080 -debug -stop-service-at-end -skip-from ./ContractTests/testharness-suppressions.txt $(TEST_HARNESS_PARAMS)" sh + | VERSION=v2 PARAMS="-url http://0.0.0.0:8080 -debug -stop-service-at-end -skip-from ./ContractTests/testharness-suppressions.txt $(TEST_HARNESS_PARAMS)" sh -contract-tests: build-contract-tests start-contract-test-service-bg run-contract-tests +contract-tests: start-contract-test-service-bg run-contract-tests .PHONY: build-contract-tests start-contract-test-service run-contract-tests contract-tests diff --git a/README.md b/README.md index 5c3bede5..81e61da0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ LaunchDarkly SDK for iOS ======================== -[![CircleCI](https://circleci.com/gh/launchdarkly/ios-client-sdk/tree/v6.svg?style=shield)](https://circleci.com/gh/launchdarkly/ios-client-sdk) +[![Run CI](https://github.com/launchdarkly/ios-client-sdk/actions/workflows/ci.yml/badge.svg?branch=v8)](https://github.com/launchdarkly/ios-client-sdk/actions/workflows/ci.yml) [![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-4BC51D.svg?style=flat)](https://swift.org/package-manager/) [![CocoaPods compatible](https://img.shields.io/cocoapods/v/LaunchDarkly.svg)](https://cocoapods.org/pods/LaunchDarkly) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) @@ -47,11 +47,13 @@ To integrate LaunchDarkly into an Xcode project, go to the project editor, and s To include LaunchDarkly in a Swift package, simply add it to the dependencies section of your `Package.swift` file. And add the product "LaunchDarkly" as a dependency for your targets. + ```swift dependencies: [ - .package(url: "https://github.com/launchdarkly/ios-client-sdk.git", .upToNextMinor(from: "8.3.0")) + .package(url: "https://github.com/launchdarkly/ios-client-sdk.git", .upToNextMajor(from: "8.3.1")) ] ``` + ### CocoaPods diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..324446bb --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,16 @@ +{ + "packages": { + ".": { + "release-type": "simple", + "bump-minor-pre-major": true, + "versioning": "default", + "include-v-in-tag": false, + "include-component-in-tag": false, + "extra-files": [ + "LaunchDarkly.podspec", + "LaunchDarkly/LaunchDarkly/ServiceObjects/EnvironmentReporter.swift", + "README.md" + ] + } + } +} From bb2cb034b3f860fa868ef3024364f3ddbe586da8 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Fri, 29 Dec 2023 10:34:12 -0500 Subject: [PATCH 2/3] Try localhost again --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e30fac23..34445b97 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ build-contract-tests: cd ./ContractTests && swift build --product ContractTests start-contract-test-service: build-contract-tests - cd ./ContractTests && swift run ContractTests serve -b 0.0.0.0:8080 + cd ./ContractTests && swift run start-contract-test-service-bg: @echo "Test service output will be captured in $(TEMP_TEST_OUTPUT)" @@ -12,7 +12,7 @@ start-contract-test-service-bg: run-contract-tests: @curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/master/downloader/run.sh \ - | VERSION=v2 PARAMS="-url http://0.0.0.0:8080 -debug -stop-service-at-end -skip-from ./ContractTests/testharness-suppressions.txt $(TEST_HARNESS_PARAMS)" sh + | VERSION=v2 PARAMS="-url http://localhost:8080 -debug -stop-service-at-end -skip-from ./ContractTests/testharness-suppressions.txt $(TEST_HARNESS_PARAMS)" sh contract-tests: start-contract-test-service-bg run-contract-tests From 5ce79764404ee7d0c5720adb1929836f48ce476a Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Fri, 29 Dec 2023 10:34:16 -0500 Subject: [PATCH 3/3] Explain sleep --- .github/actions/ci/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/ci/action.yml b/.github/actions/ci/action.yml index ff4cb2f1..9bbd0233 100644 --- a/.github/actions/ci/action.yml +++ b/.github/actions/ci/action.yml @@ -80,4 +80,6 @@ runs: - name: Run contract tests shell: bash + # Add a brief sleep here to ensure the test service is ready to receive + # requests run: sleep 5 && make run-contract-tests