From 8ad3ace9024b4fdf6bb0694c8e56dd81be9a144e Mon Sep 17 00:00:00 2001 From: Yasir Folio3 <39988750+yasirfolio3@users.noreply.github.com> Date: Wed, 13 Apr 2022 13:50:50 +0500 Subject: [PATCH 01/83] Initial commit --- .github/workflows/swift.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 00000000..238915dc --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,19 @@ +name: Swift + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + - name: Build + run: swift build -v + - name: Run tests + run: swift test -v From 0671c2336920afabfe326253fb1b39522c625f8a Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Wed, 13 Apr 2022 15:33:15 +0500 Subject: [PATCH 02/83] Work in progress. --- .github/workflows/integration_test.yml | 56 +++++++++++++++++++++++++ .github/workflows/lint_markdown.yml | 19 +++++++++ .github/workflows/source_clear_cron.yml | 18 ++++++++ .github/workflows/swift.yml | 42 +++++++++++++++---- 4 files changed, 128 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/integration_test.yml create mode 100644 .github/workflows/lint_markdown.yml create mode 100644 .github/workflows/source_clear_cron.yml diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml new file mode 100644 index 00000000..eada6765 --- /dev/null +++ b/.github/workflows/integration_test.yml @@ -0,0 +1,56 @@ +name: Reusable action of running integration and production test suite + +on: + workflow_call: + inputs: + FULLSTACK_TEST_REPO: + required: false + type: string + secrets: + CI_USER_TOKEN: + required: true + TRAVIS_COM_TOKEN: + required: true +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.CI_USER_TOKEN }} + repository: 'optimizely/travisci-tools' + path: 'home/runner/travisci-tools' + ref: 'master' + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - name: Trigger build + env: + SDK: swift + FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }} + BUILD_NUMBER: ${{ github.run_id }} + TESTAPP_BRANCH: master + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} + UPSTREAM_REPO: ${{ github.repository }} + TRAVIS_COMMIT: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + UPSTREAM_SHA: ${{ github.sha }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + EVENT_MESSAGE: ${{ github.event.message }} + HOME: 'home/runner' + run: | + echo "$GITHUB_CONTEXT" + home/runner/travisci-tools/trigger-script-with-status-update.sh diff --git a/.github/workflows/lint_markdown.yml b/.github/workflows/lint_markdown.yml new file mode 100644 index 00000000..dfe895ea --- /dev/null +++ b/.github/workflows/lint_markdown.yml @@ -0,0 +1,19 @@ +name: Reusable action of linting markdown files + +on: [workflow_call] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.6' + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Install gem + run: | + gem install awesome_bot + - name: Run tests + run: find . -type f -name '*.md' -exec awesome_bot {} \; diff --git a/.github/workflows/source_clear_cron.yml b/.github/workflows/source_clear_cron.yml new file mode 100644 index 00000000..884cd2f0 --- /dev/null +++ b/.github/workflows/source_clear_cron.yml @@ -0,0 +1,18 @@ +name: Source clear + +on: + push: + branches: [ master ] + schedule: + # Runs "weekly" + - cron: '0 0 * * 0' + +jobs: + source_clear: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Source clear scan + env: + SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }} + run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s - scan diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 238915dc..47725283 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -7,13 +7,41 @@ on: branches: [ master ] jobs: - build: + lint_markdown_files: + uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction - runs-on: macos-latest + integration_tests: + uses: optimizely/swift-sdk/.github/workflows/integration_test.yml@yasir/gitAction + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + + fullstack_production_suite: + uses: optimizely/swift-sdk/.github/workflows/integration_test.yml@yasir/gitAction + with: + FULLSTACK_TEST_REPO: ProdTesting + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + lint: + runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - name: Build - run: swift build -v - - name: Run tests - run: swift test -v + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + run: | + gem install cocoapods -v '1.9.3' + pod spec lint --quick + curl -sSL https://download.sourceclear.com/ci.sh | bash + + # build: + + # runs-on: macos-latest + + # steps: + # - uses: actions/checkout@v3 + # - name: Build + # run: swift build -v + # - name: Run tests + # run: swift test -v From ba4bc671177441fdd2a5af0d1753383fa90fe987 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Wed, 13 Apr 2022 16:56:46 +0500 Subject: [PATCH 03/83] WIP. --- .github/workflows/integration_test.yml | 56 ------------ .github/workflows/swift.yml | 122 ++++++++++++++++++++++--- 2 files changed, 110 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/integration_test.yml diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml deleted file mode 100644 index eada6765..00000000 --- a/.github/workflows/integration_test.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Reusable action of running integration and production test suite - -on: - workflow_call: - inputs: - FULLSTACK_TEST_REPO: - required: false - type: string - secrets: - CI_USER_TOKEN: - required: true - TRAVIS_COM_TOKEN: - required: true -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # You should create a personal access token and store it in your repository - token: ${{ secrets.CI_USER_TOKEN }} - repository: 'optimizely/travisci-tools' - path: 'home/runner/travisci-tools' - ref: 'master' - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - name: Trigger build - env: - SDK: swift - FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }} - BUILD_NUMBER: ${{ github.run_id }} - TESTAPP_BRANCH: master - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_EVENT_TYPE: ${{ github.event_name }} - GITHUB_CONTEXT: ${{ toJson(github) }} - TRAVIS_REPO_SLUG: ${{ github.repository }} - TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} - UPSTREAM_REPO: ${{ github.repository }} - TRAVIS_COMMIT: ${{ github.sha }} - TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} - TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - UPSTREAM_SHA: ${{ github.sha }} - TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - EVENT_MESSAGE: ${{ github.event.message }} - HOME: 'home/runner' - run: | - echo "$GITHUB_CONTEXT" - home/runner/travisci-tools/trigger-script-with-status-update.sh diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 47725283..9729af7a 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -11,18 +11,49 @@ jobs: uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction integration_tests: - uses: optimizely/swift-sdk/.github/workflows/integration_test.yml@yasir/gitAction - secrets: - CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - - fullstack_production_suite: - uses: optimizely/swift-sdk/.github/workflows/integration_test.yml@yasir/gitAction - with: - FULLSTACK_TEST_REPO: ProdTesting - secrets: - CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + if: ${{ github.event.inputs.SNAPSHOT != 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.CI_USER_TOKEN }} + repository: 'optimizely/travisci-tools' + path: 'home/runner/travisci-tools' + ref: 'master' + + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - name: Trigger build + env: + SDK: swift + TESTAPP_TAG: master + BUILD_NUMBER: ${{ github.run_id }} + TESTAPP_BRANCH: master + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} + UPSTREAM_REPO: ${{ github.repository }} + TRAVIS_COMMIT: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + UPSTREAM_SHA: ${{ github.sha }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + EVENT_MESSAGE: ${{ github.event.message }} + HOME: 'home/runner' + run: | + echo "$GITHUB_CONTEXT" + home/runner/travisci-tools/trigger-script-with-status-update.sh lint: runs-on: macos-latest @@ -34,6 +65,73 @@ jobs: gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash + + # unittests: + # runs-on: macos-latest + # strategy: + # fail-fast: false + # matrix: + # os: [14.4, 13.3, 11.4, 12.1] + # device: [iPhone 11, iPhone 8, iPad Air, Apple TV 4K] + # steps: + # - uses: maxim-lobanov/setup-xcode@v1 + # - name: PLATFORM='iOS Simulator' OS=${{ matrix.os }} NAME='${{ matrix.device }}' + # env: + # COVERAGE_DIR: ./COVERAGE + # SCHEME: OptimizelySwiftSDK-iOS + # TEST_SDK: iphonesimulator + # PLATFORM: iOS Simulator + # OS: ${{ matrix.os }} + # NAME: ${{ matrix.device }} + # run: | + # gem install coveralls-lcov + # gem install cocoapods -v '1.9.3' + # pod repo update + # pod install + # HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq + # Scripts/start_simulator.sh + # Scripts/run_unit_tests.sh + + # - &unittests + # stage: 'Unit Tests' + # language: swift + # os: osx + # osx_image: xcode12.4 + # branches: + # only: + # - master + # env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=14.4 NAME='iPhone 11' + # name: PLATFORM='iOS Simulator' OS=14.4 NAME='iPhone 11' + # install: + # #- gem install slather --no-document --quiet + # - gem install coveralls-lcov + # # + # - gem install cocoapods -v '1.9.3' + # - pod repo update + # - pod install + # # install jq without cleaning up + # - HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq + # # preload simulator + # - Scripts/start_simulator.sh + # script: + # - Scripts/run_unit_tests.sh + # after_success: + # - Scripts/upload_coveralls.sh + # - sleep 5 # https://github.com/travis-ci/travis-ci/issues/4725 + # after_failure: + # # install travis artifacts uploader + # - sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash + # - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) + # - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" + # - <<: *unittests + # env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=13.3 NAME='iPhone 8' + # name: PLATFORM='iOS Simulator' OS=13.3 NAME='iPhone 8' + # - <<: *unittests + # env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=11.4 NAME='iPad Air' + # name: PLATFORM='iOS Simulator' OS=11.4 NAME='iPad Air' + # - <<: *unittests + # env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-tvOS TEST_SDK=appletvsimulator PLATFORM='tvOS Simulator' OS=12.1 NAME='Apple TV 4K' + # name: PLATFORM='tvOS Simulator' OS=12.1 NAME='Apple TV 4K' # build: From f938fea6adac89114803315ea9453925c7a08d4c Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 14:06:32 +0500 Subject: [PATCH 04/83] Implementing git action. --- .../workflows/Scripts}/run_prep.sh | 0 .../workflows/Scripts}/run_release.sh | 0 .../workflows/Scripts}/run_unit_tests.sh | 0 .../workflows/Scripts}/start_simulator.sh | 0 .../workflows/Scripts}/upload_coveralls.sh | 0 .github/workflows/swift.yml | 138 ++++++++---------- .travis.yml | 136 ----------------- 7 files changed, 64 insertions(+), 210 deletions(-) rename {Scripts => .github/workflows/Scripts}/run_prep.sh (100%) rename {Scripts => .github/workflows/Scripts}/run_release.sh (100%) rename {Scripts => .github/workflows/Scripts}/run_unit_tests.sh (100%) rename {Scripts => .github/workflows/Scripts}/start_simulator.sh (100%) rename {Scripts => .github/workflows/Scripts}/upload_coveralls.sh (100%) delete mode 100644 .travis.yml diff --git a/Scripts/run_prep.sh b/.github/workflows/Scripts/run_prep.sh similarity index 100% rename from Scripts/run_prep.sh rename to .github/workflows/Scripts/run_prep.sh diff --git a/Scripts/run_release.sh b/.github/workflows/Scripts/run_release.sh similarity index 100% rename from Scripts/run_release.sh rename to .github/workflows/Scripts/run_release.sh diff --git a/Scripts/run_unit_tests.sh b/.github/workflows/Scripts/run_unit_tests.sh similarity index 100% rename from Scripts/run_unit_tests.sh rename to .github/workflows/Scripts/run_unit_tests.sh diff --git a/Scripts/start_simulator.sh b/.github/workflows/Scripts/start_simulator.sh similarity index 100% rename from Scripts/start_simulator.sh rename to .github/workflows/Scripts/start_simulator.sh diff --git a/Scripts/upload_coveralls.sh b/.github/workflows/Scripts/upload_coveralls.sh similarity index 100% rename from Scripts/upload_coveralls.sh rename to .github/workflows/Scripts/upload_coveralls.sh diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 9729af7a..275dcdab 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -66,80 +66,70 @@ jobs: pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash - # unittests: - # runs-on: macos-latest - # strategy: - # fail-fast: false - # matrix: - # os: [14.4, 13.3, 11.4, 12.1] - # device: [iPhone 11, iPhone 8, iPad Air, Apple TV 4K] - # steps: - # - uses: maxim-lobanov/setup-xcode@v1 - # - name: PLATFORM='iOS Simulator' OS=${{ matrix.os }} NAME='${{ matrix.device }}' - # env: - # COVERAGE_DIR: ./COVERAGE - # SCHEME: OptimizelySwiftSDK-iOS - # TEST_SDK: iphonesimulator - # PLATFORM: iOS Simulator - # OS: ${{ matrix.os }} - # NAME: ${{ matrix.device }} - # run: | - # gem install coveralls-lcov - # gem install cocoapods -v '1.9.3' - # pod repo update - # pod install - # HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq - # Scripts/start_simulator.sh - # Scripts/run_unit_tests.sh + unittests: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + os: [14.4, 13.3, 11.4, 12.1] + device: [iPhone 11, iPhone 8, iPad Air, Apple TV 4K] + scheme: [OptimizelySwiftSDK-iOS, OptimizelySwiftSDK-iOS, OptimizelySwiftSDK-iOS, OptimizelySwiftSDK-tvOS] + sdk: [iphonesimulator, iphonesimulator, iphonesimulator, appletvsimulator] + platform: [iOS Simulator, iOS Simulator, iOS Simulator, tvOS Simulator] + steps: + - uses: maxim-lobanov/setup-xcode@v1 + - name: PLATFORM='${{ matrix.platform }}' OS=${{ matrix.os }} NAME='${{ matrix.device }}' + id: unit_tests + env: + COVERAGE_DIR: ./COVERAGE + SCHEME: ${{ matrix.scheme }} + TEST_SDK: ${{ matrix.sdk }} + PLATFORM: ${{ matrix.platform }} + OS: ${{ matrix.os }} + NAME: ${{ matrix.device }} + run: | + gem install coveralls-lcov + gem install cocoapods -v '1.9.3' + pod repo update + pod install + HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq + Scripts/start_simulator.sh + Scripts/run_unit_tests.sh - # - &unittests - # stage: 'Unit Tests' - # language: swift - # os: osx - # osx_image: xcode12.4 - # branches: - # only: - # - master - # env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=14.4 NAME='iPhone 11' - # name: PLATFORM='iOS Simulator' OS=14.4 NAME='iPhone 11' - # install: - # #- gem install slather --no-document --quiet - # - gem install coveralls-lcov - # # - # - gem install cocoapods -v '1.9.3' - # - pod repo update - # - pod install - # # install jq without cleaning up - # - HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq - # # preload simulator - # - Scripts/start_simulator.sh - # script: - # - Scripts/run_unit_tests.sh - # after_success: - # - Scripts/upload_coveralls.sh - # - sleep 5 # https://github.com/travis-ci/travis-ci/issues/4725 - # after_failure: - # # install travis artifacts uploader - # - sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash - # - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) - # - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" - # - <<: *unittests - # env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=13.3 NAME='iPhone 8' - # name: PLATFORM='iOS Simulator' OS=13.3 NAME='iPhone 8' - # - <<: *unittests - # env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=11.4 NAME='iPad Air' - # name: PLATFORM='iOS Simulator' OS=11.4 NAME='iPad Air' - # - <<: *unittests - # env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-tvOS TEST_SDK=appletvsimulator PLATFORM='tvOS Simulator' OS=12.1 NAME='Apple TV 4K' - # name: PLATFORM='tvOS Simulator' OS=12.1 NAME='Apple TV 4K' - - # build: + - name: Check on failures + if: steps.unit_tests.outcome != 'success' + run: | + sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash + artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) + artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" - # runs-on: macos-latest + - name: Check on success + if: steps.unit_tests.outcome == 'success' + run: | + Scripts/upload_coveralls.sh + sleep 5 - # steps: - # - uses: actions/checkout@v3 - # - name: Build - # run: swift build -v - # - name: Run tests - # run: swift test -v + prepare_for_release: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + id: [prepare_for_release, release] + name: [Prepare for release, Push to cocoapods.org] + script: [run_prep, run_release] + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + id: ${{ matrix.id }} + name: ${{ matrix.name }} + env: + VERSION: 3.10.1 + run: | + wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub + gem install cocoapods -v '1.9.3' + Scripts/${{ matrix.script }}.sh + + - name: Check prepare for release failure + if: steps.prepare_for_release.outcome != 'success' + run: cat /tmp/build.out diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 83c87e49..00000000 --- a/.travis.yml +++ /dev/null @@ -1,136 +0,0 @@ -language: minimal -os: linux - -# Integration tests need to run first to reset the PR build status to pending -stages: - - name: 'Source Clear' - - name: 'Lint markdown files' - - name: 'Trigger Integration Tests' - if: env(RUN_COMPAT_SUITE) = true and env(PREP) IS NOT present and env(RELEASE) IS NOT present - - name: 'Lint' - - name: 'Unit Tests' - if: env(PREP) IS NOT present and env(RELEASE) IS NOT present - - name: 'Prepare for release' - if: env(PREP) = true and type = api - - name: 'Release' - if: env(RELEASE) = true and type = api - -jobs: - include: - - stage: 'Lint markdown files' - os: linux - language: generic - install: gem install awesome_bot - script: - - find . -type f -name '*.md' -exec awesome_bot {} \; - notifications: - email: false - - - stage: 'Trigger Integration Tests' - language: minimal - os: linux - env: - - SDK=swift - - BUILD_NUMBER=${TRAVIS_JOB_NUMBER/.} - - TESTAPP_TAG=master - - SDK_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH - - cache: false - install: - - mkdir $HOME/travisci-tools && pushd $HOME/travisci-tools && git init && git pull https://$CI_USER_TOKEN@github.com/optimizely/travisci-tools.git && popd - script: - - $HOME/travisci-tools/trigger-script-with-status-update.sh - - - stage: 'Lint' - language: swift - os: osx - osx_image: xcode12.4 - install: - - gem install cocoapods -v '1.9.3' - script: - - pod spec lint --quick - after_script: - - curl -sSL https://download.sourceclear.com/ci.sh | bash - - - stage: 'Source Clear' - if: type = cron - addons: - srcclr: true - before_install: skip - install: skip - before_script: skip - script: skip - after_success: skip - - - &unittests - stage: 'Unit Tests' - language: swift - os: osx - osx_image: xcode12.4 - branches: - only: - - master - env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=14.4 NAME='iPhone 11' - name: PLATFORM='iOS Simulator' OS=14.4 NAME='iPhone 11' - install: - #- gem install slather --no-document --quiet - - gem install coveralls-lcov - # - - gem install cocoapods -v '1.9.3' - - pod repo update - - pod install - # install jq without cleaning up - - HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq - # preload simulator - - Scripts/start_simulator.sh - script: - - Scripts/run_unit_tests.sh - after_success: - - Scripts/upload_coveralls.sh - - sleep 5 # https://github.com/travis-ci/travis-ci/issues/4725 - after_failure: - # install travis artifacts uploader - - sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash - - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) - - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" - - <<: *unittests - env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=13.3 NAME='iPhone 8' - name: PLATFORM='iOS Simulator' OS=13.3 NAME='iPhone 8' - - <<: *unittests - env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=11.4 NAME='iPad Air' - name: PLATFORM='iOS Simulator' OS=11.4 NAME='iPad Air' - - <<: *unittests - env: COVERAGE_DIR=./COVERAGE SCHEME=OptimizelySwiftSDK-tvOS TEST_SDK=appletvsimulator PLATFORM='tvOS Simulator' OS=12.1 NAME='Apple TV 4K' - name: PLATFORM='tvOS Simulator' OS=12.1 NAME='Apple TV 4K' - - - stage: 'Prepare for release' - name: Prepare for release - language: swift - os: osx - osx_image: xcode12.4 - env: - - VERSION=3.10.1 - install: - # install hub - - wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub - # upgrade cocoapods - - gem install cocoapods -v '1.9.3' - script: - - Scripts/run_prep.sh - after_failure: - - cat /tmp/build.out - - - stage: 'Release' - name: Push to cocoapods.org - language: minimal - os: osx - osx_image: xcode12.4 - env: - - VERSION=3.10.1 - install: - # install hub - - wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub - # upgrade cocoapods - - gem install cocoapods -v '1.9.3' - script: - - Scripts/run_release.sh From 258933988901d3ff69d75c40029be3d234440834 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 14:15:54 +0500 Subject: [PATCH 05/83] fixes. --- .github/workflows/swift.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 275dcdab..83c1e1e5 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -61,7 +61,7 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable - run: | + - run: | gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash @@ -125,7 +125,7 @@ jobs: name: ${{ matrix.name }} env: VERSION: 3.10.1 - run: | + - run: | wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/${{ matrix.script }}.sh From 62d7d3fe56882f16d64a9504fc49a77f1cb5d5ba Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 14:47:22 +0500 Subject: [PATCH 06/83] fixes. --- .github/workflows/swift.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 83c1e1e5..a2556e4b 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -111,25 +111,33 @@ jobs: prepare_for_release: runs-on: macos-latest - strategy: - fail-fast: false - matrix: - id: [prepare_for_release, release] - name: [Prepare for release, Push to cocoapods.org] - script: [run_prep, run_release] steps: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable - id: ${{ matrix.id }} - name: ${{ matrix.name }} + id: prepare_for_release + name: Prepare for release env: VERSION: 3.10.1 - run: | wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' - Scripts/${{ matrix.script }}.sh + Scripts/run_prep.sh - name: Check prepare for release failure if: steps.prepare_for_release.outcome != 'success' run: cat /tmp/build.out + + release: + runs-on: macos-latest + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + name: Push to cocoapods.org + env: + VERSION: 3.10.1 + - run: | + wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub + gem install cocoapods -v '1.9.3' + Scripts/run_release.sh From cfc07ba925e61ee5be5aae557493151034890168 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 14:54:36 +0500 Subject: [PATCH 07/83] fixes. --- .github/workflows/lint_markdown.yml | 6 +++--- .github/workflows/swift.yml | 5 +++++ {.github/workflows/Scripts => Scripts}/run_prep.sh | 0 {.github/workflows/Scripts => Scripts}/run_release.sh | 0 {.github/workflows/Scripts => Scripts}/run_unit_tests.sh | 0 {.github/workflows/Scripts => Scripts}/start_simulator.sh | 0 {.github/workflows/Scripts => Scripts}/upload_coveralls.sh | 0 7 files changed, 8 insertions(+), 3 deletions(-) rename {.github/workflows/Scripts => Scripts}/run_prep.sh (100%) rename {.github/workflows/Scripts => Scripts}/run_release.sh (100%) rename {.github/workflows/Scripts => Scripts}/run_unit_tests.sh (100%) rename {.github/workflows/Scripts => Scripts}/start_simulator.sh (100%) rename {.github/workflows/Scripts => Scripts}/upload_coveralls.sh (100%) diff --git a/.github/workflows/lint_markdown.yml b/.github/workflows/lint_markdown.yml index dfe895ea..f9c8b4e9 100644 --- a/.github/workflows/lint_markdown.yml +++ b/.github/workflows/lint_markdown.yml @@ -12,8 +12,8 @@ jobs: with: ruby-version: '2.6' bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Install gem + - name: Install gem and Run tests run: | + cd ../../ gem install awesome_bot - - name: Run tests - run: find . -type f -name '*.md' -exec awesome_bot {} \; + find . -type f -name '*.md' -exec awesome_bot {} \; diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index a2556e4b..4d5a5dcc 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -62,6 +62,7 @@ jobs: with: xcode-version: latest-stable - run: | + cd ../../ gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash @@ -88,6 +89,7 @@ jobs: OS: ${{ matrix.os }} NAME: ${{ matrix.device }} run: | + cd ../../ gem install coveralls-lcov gem install cocoapods -v '1.9.3' pod repo update @@ -106,6 +108,7 @@ jobs: - name: Check on success if: steps.unit_tests.outcome == 'success' run: | + cd ../../ Scripts/upload_coveralls.sh sleep 5 @@ -120,6 +123,7 @@ jobs: env: VERSION: 3.10.1 - run: | + cd ../../ wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/run_prep.sh @@ -138,6 +142,7 @@ jobs: env: VERSION: 3.10.1 - run: | + cd ../../ wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/run_release.sh diff --git a/.github/workflows/Scripts/run_prep.sh b/Scripts/run_prep.sh similarity index 100% rename from .github/workflows/Scripts/run_prep.sh rename to Scripts/run_prep.sh diff --git a/.github/workflows/Scripts/run_release.sh b/Scripts/run_release.sh similarity index 100% rename from .github/workflows/Scripts/run_release.sh rename to Scripts/run_release.sh diff --git a/.github/workflows/Scripts/run_unit_tests.sh b/Scripts/run_unit_tests.sh similarity index 100% rename from .github/workflows/Scripts/run_unit_tests.sh rename to Scripts/run_unit_tests.sh diff --git a/.github/workflows/Scripts/start_simulator.sh b/Scripts/start_simulator.sh similarity index 100% rename from .github/workflows/Scripts/start_simulator.sh rename to Scripts/start_simulator.sh diff --git a/.github/workflows/Scripts/upload_coveralls.sh b/Scripts/upload_coveralls.sh similarity index 100% rename from .github/workflows/Scripts/upload_coveralls.sh rename to Scripts/upload_coveralls.sh From f0f47f3183ff56c51b06555996fbcc61b2e6c193 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 16:29:51 +0500 Subject: [PATCH 08/83] fixes. --- .github/workflows/swift.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 4d5a5dcc..f8052ef3 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -78,8 +78,15 @@ jobs: sdk: [iphonesimulator, iphonesimulator, iphonesimulator, appletvsimulator] platform: [iOS Simulator, iOS Simulator, iOS Simulator, tvOS Simulator] steps: + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - uses: maxim-lobanov/setup-xcode@v1 - - name: PLATFORM='${{ matrix.platform }}' OS=${{ matrix.os }} NAME='${{ matrix.device }}' id: unit_tests env: COVERAGE_DIR: ./COVERAGE @@ -88,8 +95,10 @@ jobs: PLATFORM: ${{ matrix.platform }} OS: ${{ matrix.os }} NAME: ${{ matrix.device }} + COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} run: | cd ../../ + pwd gem install coveralls-lcov gem install cocoapods -v '1.9.3' pod repo update @@ -109,12 +118,21 @@ jobs: if: steps.unit_tests.outcome == 'success' run: | cd ../../ + pwd Scripts/upload_coveralls.sh sleep 5 prepare_for_release: runs-on: macos-latest steps: + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable @@ -122,6 +140,10 @@ jobs: name: Prepare for release env: VERSION: 3.10.1 + HOME: 'home/runner' + TRAVIS_REPO_SLUG: ${{ github.repository }} + GITHUB_USER: optimizely + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | cd ../../ wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub From fe68edf69306280f5ffdcf8233c293efe40eedfd Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 16:32:51 +0500 Subject: [PATCH 09/83] fixes. --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index f8052ef3..b2c1a51d 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -96,7 +96,7 @@ jobs: OS: ${{ matrix.os }} NAME: ${{ matrix.device }} COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - run: | + - run: | cd ../../ pwd gem install coveralls-lcov From 37cd6a99e10bf8521152d84a3d504c1df3ec7a1f Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 16:46:30 +0500 Subject: [PATCH 10/83] fixes. --- .github/workflows/swift.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index b2c1a51d..a99c47e7 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -21,7 +21,6 @@ jobs: repository: 'optimizely/travisci-tools' path: 'home/runner/travisci-tools' ref: 'master' - - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | @@ -60,9 +59,10 @@ jobs: steps: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: latest-stable + xcode-version: '12.4' - run: | cd ../../ + pwd gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash @@ -78,6 +78,9 @@ jobs: sdk: [iphonesimulator, iphonesimulator, iphonesimulator, appletvsimulator] platform: [iOS Simulator, iOS Simulator, iOS Simulator, tvOS Simulator] steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '12.4' - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | @@ -86,8 +89,7 @@ jobs: if: ${{ github.event_name != 'pull_request' }} run: | echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - uses: maxim-lobanov/setup-xcode@v1 - id: unit_tests + - id: unit_tests env: COVERAGE_DIR: ./COVERAGE SCHEME: ${{ matrix.scheme }} @@ -106,14 +108,12 @@ jobs: HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq Scripts/start_simulator.sh Scripts/run_unit_tests.sh - - name: Check on failures if: steps.unit_tests.outcome != 'success' run: | sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" - - name: Check on success if: steps.unit_tests.outcome == 'success' run: | @@ -135,7 +135,7 @@ jobs: echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: latest-stable + xcode-version: '12.4' id: prepare_for_release name: Prepare for release env: @@ -146,10 +146,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | cd ../../ + pwd wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/run_prep.sh - - name: Check prepare for release failure if: steps.prepare_for_release.outcome != 'success' run: cat /tmp/build.out @@ -159,12 +159,13 @@ jobs: steps: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: latest-stable + xcode-version: '12.4' name: Push to cocoapods.org env: VERSION: 3.10.1 - run: | cd ../../ + pwd wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/run_release.sh From 5525d2ad1aa2891a6fe5ac2f1a76a5104e2eb328 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 17:32:39 +0500 Subject: [PATCH 11/83] fixes. --- .github/workflows/lint_markdown.yml | 2 +- .github/workflows/set_sdk_branch.yml | 18 +++++++++ .github/workflows/setup_release.yml | 16 ++++++++ .github/workflows/swift.yml | 59 ++++++---------------------- 4 files changed, 46 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/set_sdk_branch.yml create mode 100644 .github/workflows/setup_release.yml diff --git a/.github/workflows/lint_markdown.yml b/.github/workflows/lint_markdown.yml index f9c8b4e9..cf002b7f 100644 --- a/.github/workflows/lint_markdown.yml +++ b/.github/workflows/lint_markdown.yml @@ -3,7 +3,7 @@ name: Reusable action of linting markdown files on: [workflow_call] jobs: - lint: + lint_markdown: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/set_sdk_branch.yml b/.github/workflows/set_sdk_branch.yml new file mode 100644 index 00000000..10860b9e --- /dev/null +++ b/.github/workflows/set_sdk_branch.yml @@ -0,0 +1,18 @@ +name: Reusable action of setting SDK Branch Env variable + +on: [workflow_call] + +jobs: + set_sdk_branch: + runs-on: ubuntu-latest + steps: + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV diff --git a/.github/workflows/setup_release.yml b/.github/workflows/setup_release.yml new file mode 100644 index 00000000..39ddc804 --- /dev/null +++ b/.github/workflows/setup_release.yml @@ -0,0 +1,16 @@ +name: Reusable action of setup before release + +on: [workflow_call] + +jobs: + setup_release: + runs-on: macos-latest + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '12.4' + - run: | + cd ../../ + pwd + wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub + gem install cocoapods -v '1.9.3' diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index a99c47e7..7d182a9b 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -21,16 +21,7 @@ jobs: repository: 'optimizely/travisci-tools' path: 'home/runner/travisci-tools' ref: 'master' - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: optimizely/swift-sdk/.github/workflows/set_sdk_branch.yml@yasir/gitAction - name: Trigger build env: SDK: swift @@ -81,14 +72,7 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: optimizely/swift-sdk/.github/workflows/set_sdk_branch.yml@yasir/gitAction - id: unit_tests env: COVERAGE_DIR: ./COVERAGE @@ -98,7 +82,7 @@ jobs: OS: ${{ matrix.os }} NAME: ${{ matrix.device }} COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - - run: | + run: | cd ../../ pwd gem install coveralls-lcov @@ -125,31 +109,17 @@ jobs: prepare_for_release: runs-on: macos-latest steps: - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '12.4' - id: prepare_for_release + - uses: optimizely/swift-sdk/.github/workflows/set_sdk_branch.yml@yasir/gitAction + - uses: optimizely/swift-sdk/.github/workflows/setup_release.yml@yasir/gitAction + - id: prepare_for_release name: Prepare for release env: VERSION: 3.10.1 HOME: 'home/runner' TRAVIS_REPO_SLUG: ${{ github.repository }} - GITHUB_USER: optimizely + GITHUB_USER: optibot GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: | - cd ../../ - pwd - wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub - gem install cocoapods -v '1.9.3' - Scripts/run_prep.sh + run: Scripts/run_prep.sh - name: Check prepare for release failure if: steps.prepare_for_release.outcome != 'success' run: cat /tmp/build.out @@ -157,15 +127,8 @@ jobs: release: runs-on: macos-latest steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '12.4' - name: Push to cocoapods.org + - uses: optimizely/swift-sdk/.github/workflows/setup_release.yml@yasir/gitAction + - name: Push to cocoapods.org env: VERSION: 3.10.1 - - run: | - cd ../../ - pwd - wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub - gem install cocoapods -v '1.9.3' - Scripts/run_release.sh + run: Scripts/run_release.sh From ea18040e2a277cb3a1d68dbe4b0d6ba9c05cf63a Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 17:47:33 +0500 Subject: [PATCH 12/83] fixes. --- .github/workflows/set_sdk_branch.yml | 18 --------- .github/workflows/setup_release.yml | 16 -------- .github/workflows/swift.yml | 55 ++++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/set_sdk_branch.yml delete mode 100644 .github/workflows/setup_release.yml diff --git a/.github/workflows/set_sdk_branch.yml b/.github/workflows/set_sdk_branch.yml deleted file mode 100644 index 10860b9e..00000000 --- a/.github/workflows/set_sdk_branch.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Reusable action of setting SDK Branch Env variable - -on: [workflow_call] - -jobs: - set_sdk_branch: - runs-on: ubuntu-latest - steps: - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV diff --git a/.github/workflows/setup_release.yml b/.github/workflows/setup_release.yml deleted file mode 100644 index 39ddc804..00000000 --- a/.github/workflows/setup_release.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Reusable action of setup before release - -on: [workflow_call] - -jobs: - setup_release: - runs-on: macos-latest - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '12.4' - - run: | - cd ../../ - pwd - wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub - gem install cocoapods -v '1.9.3' diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 7d182a9b..592cea75 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -21,7 +21,16 @@ jobs: repository: 'optimizely/travisci-tools' path: 'home/runner/travisci-tools' ref: 'master' - - uses: optimizely/swift-sdk/.github/workflows/set_sdk_branch.yml@yasir/gitAction + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - name: Trigger build env: SDK: swift @@ -72,7 +81,16 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - - uses: optimizely/swift-sdk/.github/workflows/set_sdk_branch.yml@yasir/gitAction + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - id: unit_tests env: COVERAGE_DIR: ./COVERAGE @@ -109,8 +127,19 @@ jobs: prepare_for_release: runs-on: macos-latest steps: - - uses: optimizely/swift-sdk/.github/workflows/set_sdk_branch.yml@yasir/gitAction - - uses: optimizely/swift-sdk/.github/workflows/setup_release.yml@yasir/gitAction + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '12.4' - id: prepare_for_release name: Prepare for release env: @@ -119,7 +148,12 @@ jobs: TRAVIS_REPO_SLUG: ${{ github.repository }} GITHUB_USER: optibot GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: Scripts/run_prep.sh + run: | + cd ../../ + pwd + wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub + gem install cocoapods -v '1.9.3' + Scripts/run_prep.sh - name: Check prepare for release failure if: steps.prepare_for_release.outcome != 'success' run: cat /tmp/build.out @@ -127,8 +161,15 @@ jobs: release: runs-on: macos-latest steps: - - uses: optimizely/swift-sdk/.github/workflows/setup_release.yml@yasir/gitAction + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '12.4' - name: Push to cocoapods.org env: VERSION: 3.10.1 - run: Scripts/run_release.sh + run: | + cd ../../ + pwd + wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub + gem install cocoapods -v '1.9.3' + Scripts/run_release.sh From bf81c48648f3839e317e63fd850d921d52de1206 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 18:11:47 +0500 Subject: [PATCH 13/83] fixes --- .github/workflows/swift.yml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 592cea75..dbfaed6a 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -72,11 +72,27 @@ jobs: strategy: fail-fast: false matrix: - os: [14.4, 13.3, 11.4, 12.1] - device: [iPhone 11, iPhone 8, iPad Air, Apple TV 4K] - scheme: [OptimizelySwiftSDK-iOS, OptimizelySwiftSDK-iOS, OptimizelySwiftSDK-iOS, OptimizelySwiftSDK-tvOS] - sdk: [iphonesimulator, iphonesimulator, iphonesimulator, appletvsimulator] - platform: [iOS Simulator, iOS Simulator, iOS Simulator, tvOS Simulator] + include: + - os: 14.4 + device: "iPhone 11" + scheme: "OptimizelySwiftSDK-iOS" + sdk: "iphonesimulator" + platform: "iOS Simulator" + - os: 13.3 + device: "iPhone 8" + scheme: "OptimizelySwiftSDK-iOS" + sdk: "iphonesimulator" + platform: "iOS Simulator" + - os: 11.4 + device: "iPad Air" + scheme: "OptimizelySwiftSDK-iOS" + sdk: "iphonesimulator" + platform: "iOS Simulator" + - os: 12.1 + device: "Apple TV 4K" + scheme: "OptimizelySwiftSDK-tvOS" + sdk: "appletvsimulator" + platform: "tvOS Simulator" steps: - uses: maxim-lobanov/setup-xcode@v1 with: @@ -102,7 +118,6 @@ jobs: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} run: | cd ../../ - pwd gem install coveralls-lcov gem install cocoapods -v '1.9.3' pod repo update @@ -119,8 +134,6 @@ jobs: - name: Check on success if: steps.unit_tests.outcome == 'success' run: | - cd ../../ - pwd Scripts/upload_coveralls.sh sleep 5 @@ -147,10 +160,9 @@ jobs: HOME: 'home/runner' TRAVIS_REPO_SLUG: ${{ github.repository }} GITHUB_USER: optibot - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} run: | cd ../../ - pwd wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/run_prep.sh From 35cfa3a55a0a828af83e5d6bf32a6976116d5090 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 18:16:28 +0500 Subject: [PATCH 14/83] fixes --- .github/workflows/swift.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index dbfaed6a..099d4a05 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -61,8 +61,6 @@ jobs: with: xcode-version: '12.4' - run: | - cd ../../ - pwd gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash @@ -117,7 +115,6 @@ jobs: NAME: ${{ matrix.device }} COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} run: | - cd ../../ gem install coveralls-lcov gem install cocoapods -v '1.9.3' pod repo update @@ -162,7 +159,6 @@ jobs: GITHUB_USER: optibot GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} run: | - cd ../../ wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/run_prep.sh @@ -180,8 +176,6 @@ jobs: env: VERSION: 3.10.1 run: | - cd ../../ - pwd wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/run_release.sh From d19982701ff568ae9e7dc23513f3680ebfeb3ef7 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 18:27:56 +0500 Subject: [PATCH 15/83] fixes. --- .github/workflows/swift.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 099d4a05..16cd52c2 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -60,7 +60,10 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - - run: | + - env: + BUILD_DIR: ${{ github.workspace }} + run: | + cd $BUILD_DIR gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash From 640a68b486fb05c64f56975d3ed682a827d5ea68 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 18:38:33 +0500 Subject: [PATCH 16/83] fixes --- .github/workflows/swift.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 16cd52c2..5304abca 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -56,13 +56,14 @@ jobs: lint: runs-on: macos-latest + defaults: + run: + working-directory: optimizely/swift-sdk/ steps: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - - env: - BUILD_DIR: ${{ github.workspace }} - run: | + - run: | cd $BUILD_DIR gem install cocoapods -v '1.9.3' pod spec lint --quick From 41bd868763563a186981a95adae626e1c91c0c05 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 18:40:25 +0500 Subject: [PATCH 17/83] fixes --- .github/workflows/swift.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 5304abca..262e5589 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -64,7 +64,6 @@ jobs: with: xcode-version: '12.4' - run: | - cd $BUILD_DIR gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash From 6b8a79a643bb8ee67e7b42030b91e57229e5b00a Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 18:49:50 +0500 Subject: [PATCH 18/83] fixes. --- .github/workflows/swift.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 262e5589..b1c75869 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -56,14 +56,12 @@ jobs: lint: runs-on: macos-latest - defaults: - run: - working-directory: optimizely/swift-sdk/ steps: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - run: | + cd .. gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash From c9e5de6348637ac5bb33a97ff87fcd29f8ee7924 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 19:05:56 +0500 Subject: [PATCH 19/83] fixes --- .github/workflows/swift.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index b1c75869..7097b1ae 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -61,7 +61,9 @@ jobs: with: xcode-version: '12.4' - run: | - cd .. + cd swift-sdk + pwd + ls gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash From 17f3db7c81c747f2740e471f2d3018f49f05b5bd Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 19:19:12 +0500 Subject: [PATCH 20/83] fixes --- .github/workflows/swift.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 7097b1ae..9608311b 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -60,9 +60,10 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - - run: | - cd swift-sdk - pwd + - env: + BUILD_DIR: ${{ github.workspace }} + run: | + cd $BUILD_DIR ls gem install cocoapods -v '1.9.3' pod spec lint --quick From 3855e807a0f27be6e4d526bae945da0ccfa70343 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 19:27:58 +0500 Subject: [PATCH 21/83] fixes --- .github/workflows/swift.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 9608311b..29f96b3c 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -60,11 +60,9 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - - env: - BUILD_DIR: ${{ github.workspace }} - run: | - cd $BUILD_DIR - ls + - run: | + cd /home/runner/swift-sdk + ls -la gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash From 7b7ba159d1286ddabfdfef9cb3ef2de5e2da1735 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 19:29:20 +0500 Subject: [PATCH 22/83] fixes --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 29f96b3c..5a2ec863 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -61,7 +61,7 @@ jobs: with: xcode-version: '12.4' - run: | - cd /home/runner/swift-sdk + cd /Users/runner/swift-sdk ls -la gem install cocoapods -v '1.9.3' pod spec lint --quick From e1d6175abb21acaf8b040ca75d45db3403204c5d Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 22:13:34 +0500 Subject: [PATCH 23/83] fixes --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 5a2ec863..cc74d0d3 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -61,7 +61,7 @@ jobs: with: xcode-version: '12.4' - run: | - cd /Users/runner/swift-sdk + pwd ls -la gem install cocoapods -v '1.9.3' pod spec lint --quick From 8d6642d835bb9a092ebd1b018360c722d0b01c61 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 22:19:15 +0500 Subject: [PATCH 24/83] checking directory structure. --- .github/workflows/swift.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index cc74d0d3..6da34850 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -61,6 +61,12 @@ jobs: with: xcode-version: '12.4' - run: | + pwd + ls -la + cd .. + pwd + ls -la + cd .. pwd ls -la gem install cocoapods -v '1.9.3' From 1d754001b3fd9828b31e552042e50fb312099901 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 22:27:05 +0500 Subject: [PATCH 25/83] fixes. --- .github/workflows/swift.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 6da34850..83f74cac 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -57,18 +57,11 @@ jobs: lint: runs-on: macos-latest steps: + - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - run: | - pwd - ls -la - cd .. - pwd - ls -la - cd .. - pwd - ls -la gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash @@ -100,6 +93,7 @@ jobs: sdk: "appletvsimulator" platform: "tvOS Simulator" steps: + - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' @@ -145,6 +139,7 @@ jobs: prepare_for_release: runs-on: macos-latest steps: + - uses: actions/checkout@v3 - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | @@ -177,6 +172,7 @@ jobs: release: runs-on: macos-latest steps: + - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' From c956ea50901bd4d4f9ce18d06905e8f50c7ee0c6 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 22:58:07 +0500 Subject: [PATCH 26/83] fixes --- .github/workflows/swift.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 83f74cac..0c1dd147 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -61,7 +61,9 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: '12.4' - - run: | + - env: + SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }} + run: | gem install cocoapods -v '1.9.3' pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash @@ -77,26 +79,30 @@ jobs: scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" + xcode: 12.4 - os: 13.3 device: "iPhone 8" scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" - - os: 11.4 + xcode: 11.3.1 + - os: 12.4 device: "iPad Air" scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" - - os: 12.1 + xcode: 10.3 + - os: 12.4 device: "Apple TV 4K" scheme: "OptimizelySwiftSDK-tvOS" sdk: "appletvsimulator" platform: "tvOS Simulator" + xcode: 10.3 steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '12.4' + xcode-version: ${{ matrix.xcode }} - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | From 5963aaf89b190bfe393fbe4dd91bde8d15796c03 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 23:11:22 +0500 Subject: [PATCH 27/83] fixes. --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 0c1dd147..8c523944 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -69,7 +69,7 @@ jobs: curl -sSL https://download.sourceclear.com/ci.sh | bash unittests: - runs-on: macos-latest + runs-on: macos-10.15 strategy: fail-fast: false matrix: From 4bc52fda4891546fb5d0da67a96655e31dbb1ef3 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 14 Apr 2022 23:40:27 +0500 Subject: [PATCH 28/83] fixes --- .github/workflows/swift.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 8c523944..3917d7cd 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -25,7 +25,7 @@ jobs: if: ${{ github.event_name == 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | @@ -107,7 +107,7 @@ jobs: if: ${{ github.event_name == 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | @@ -145,18 +145,18 @@ jobs: prepare_for_release: runs-on: macos-latest steps: - - uses: actions/checkout@v3 - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - uses: maxim-lobanov/setup-xcode@v1 + - uses: actions/checkout@v3 with: xcode-version: '12.4' - id: prepare_for_release From 4eb2a51b107011a1f75911531586ed960b67835c Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 10:11:13 +0500 Subject: [PATCH 29/83] fixes. --- .github/workflows/swift.yml | 17 +++++++++-------- Scripts/start_simulator.sh | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 3917d7cd..85602812 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -25,7 +25,7 @@ jobs: if: ${{ github.event_name == 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | @@ -79,30 +79,30 @@ jobs: scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" - xcode: 12.4 + os_type: "iOS" - os: 13.3 device: "iPhone 8" scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" - xcode: 11.3.1 - - os: 12.4 + os_type: "iOS" + - os: 11.4 device: "iPad Air" scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" - xcode: 10.3 - - os: 12.4 + os_type: "iOS" + - os: 12.1 device: "Apple TV 4K" scheme: "OptimizelySwiftSDK-tvOS" sdk: "appletvsimulator" platform: "tvOS Simulator" - xcode: 10.3 + os_type: "tvOS" steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: ${{ matrix.xcode }} + xcode-version: 12.4 - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | @@ -120,6 +120,7 @@ jobs: TEST_SDK: ${{ matrix.sdk }} PLATFORM: ${{ matrix.platform }} OS: ${{ matrix.os }} + OS_TYPE: ${{ matrix.os_type }} NAME: ${{ matrix.device }} COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} run: | diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 7cbc9bc0..eb6a7c41 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -8,7 +8,7 @@ set -eou pipefail # prep jq arg because it doesnt allow parameter expansion within its single quotes echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file - +xcversion simulators --install="$OS_TYPE $OS" simulator=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) if [ -z $simulator ]; then echo "The requested simulator ($PLATFORM $OS $NAME) cannot be found." From c9d29a64ed99c8fc2a8651053beff727cabc3856 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 11:08:14 +0500 Subject: [PATCH 30/83] fixes. --- .github/workflows/swift.yml | 9 +++++++-- Scripts/start_simulator.sh | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 85602812..8b7f1df9 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -80,24 +80,28 @@ jobs: sdk: "iphonesimulator" platform: "iOS Simulator" os_type: "iOS" + simulator_xcode: 12.4 - os: 13.3 device: "iPhone 8" scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" os_type: "iOS" - - os: 11.4 + simulator_xcode: 11.3.1 + - os: 12.4 device: "iPad Air" scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" os_type: "iOS" - - os: 12.1 + simulator_xcode: 10.3 + - os: 12.4 device: "Apple TV 4K" scheme: "OptimizelySwiftSDK-tvOS" sdk: "appletvsimulator" platform: "tvOS Simulator" os_type: "tvOS" + simulator_xcode: 10.3 steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 @@ -121,6 +125,7 @@ jobs: PLATFORM: ${{ matrix.platform }} OS: ${{ matrix.os }} OS_TYPE: ${{ matrix.os_type }} + SIMULATOR_XCODE: ${{ matrix.simulator_xcode }} NAME: ${{ matrix.device }} COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} run: | diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index eb6a7c41..ed0e175e 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -8,7 +8,23 @@ set -eou pipefail # prep jq arg because it doesnt allow parameter expansion within its single quotes echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file -xcversion simulators --install="$OS_TYPE $OS" +sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes +if [ "$SIMULATOR_XCODE" == 10.3 ] +then + sudo ln -s /Applications/Xcode_10.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime +elif [ "$SIMULATOR_XCODE" != 12.4 ]; then + sudo ln -s /Applications/$SIMULATOR_XCODE.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime +fi + +if [ "$SIMULATOR_XCODE" != 12.4 ] +then + os="${OS/ /-}" + name="${NAME// /-}" + xcrun simctl list runtimes + xcrun simctl create "$NAME" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" + xcrun simctl list devices $SIMULATOR_XCODE +fi + simulator=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) if [ -z $simulator ]; then echo "The requested simulator ($PLATFORM $OS $NAME) cannot be found." From 39731d96b026aa2c8406a67b1f6d9ceb5c284299 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 11:14:00 +0500 Subject: [PATCH 31/83] fixes --- Scripts/start_simulator.sh | 4 ++-- Tests/TestUtils/MockUrlSession.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index ed0e175e..a1813120 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -18,8 +18,8 @@ fi if [ "$SIMULATOR_XCODE" != 12.4 ] then - os="${OS/ /-}" - name="${NAME// /-}" + os="${OS/./-}" + name="${NAME//./-}" xcrun simctl list runtimes xcrun simctl create "$NAME" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" xcrun simctl list devices $SIMULATOR_XCODE diff --git a/Tests/TestUtils/MockUrlSession.swift b/Tests/TestUtils/MockUrlSession.swift index c8c498a5..28ab4092 100644 --- a/Tests/TestUtils/MockUrlSession.swift +++ b/Tests/TestUtils/MockUrlSession.swift @@ -54,7 +54,7 @@ class MockUrlSession: URLSession { } init(handler: MockDatafileHandler? = nil, statusCode: Int = 0, withError: Bool = false, localResponseData: String? = nil) { - Self.validSessions += 1 + MockUrlSession.validSessions += 1 self.handler = handler self.statusCode = statusCode self.withError = withError @@ -62,7 +62,7 @@ class MockUrlSession: URLSession { } init(handler: MockDatafileHandler? = nil, settingsMap: [String: (Int, Bool)]) { - Self.validSessions += 1 + MockUrlSession.validSessions += 1 self.handler = handler self.statusCode = 0 self.withError = false From 5dc1a0a4b3a415290c7606ac9ed9e2c9365e91e2 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 11:19:02 +0500 Subject: [PATCH 32/83] fixes. --- Scripts/start_simulator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index a1813120..e6e1c734 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -19,7 +19,7 @@ fi if [ "$SIMULATOR_XCODE" != 12.4 ] then os="${OS/./-}" - name="${NAME//./-}" + name="${NAME// /-}" xcrun simctl list runtimes xcrun simctl create "$NAME" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" xcrun simctl list devices $SIMULATOR_XCODE From 70977cab21efebfd5edeebd21b9e4d3872d8b3f8 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 11:30:02 +0500 Subject: [PATCH 33/83] fixes. --- Scripts/start_simulator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index e6e1c734..7c428993 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -13,7 +13,7 @@ if [ "$SIMULATOR_XCODE" == 10.3 ] then sudo ln -s /Applications/Xcode_10.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime elif [ "$SIMULATOR_XCODE" != 12.4 ]; then - sudo ln -s /Applications/$SIMULATOR_XCODE.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime + sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime fi if [ "$SIMULATOR_XCODE" != 12.4 ] From c027a1667e15f134966fd1e8c88f996124b0cb71 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 12:12:48 +0500 Subject: [PATCH 34/83] fixes. --- Scripts/start_simulator.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 7c428993..4762302c 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -20,19 +20,21 @@ if [ "$SIMULATOR_XCODE" != 12.4 ] then os="${OS/./-}" name="${NAME// /-}" - xcrun simctl list runtimes - xcrun simctl create "$NAME" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" - xcrun simctl list devices $SIMULATOR_XCODE + if [ "$name" == "Apple-TV-4K" ] + then + name="${name}-1080p" + fi + + CUSTOM_SIMULATOR="${NAME}-CUSTOM" + # xcrun simctl list runtimes + xcrun simctl create "$CUSTOM_SIMULATOR" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" + # xcrun simctl list devices $SIMULATOR_XCODE fi -simulator=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) -if [ -z $simulator ]; then - echo "The requested simulator ($PLATFORM $OS $NAME) cannot be found." - #xcrun instruments -s device - xcrun xctrace list devices - sleep 3 - exit 1 +if [ -z "$CUSTOM_SIMULATOR" ] +then + CUSTOM_SIMULATOR=$NAME fi -xcrun simctl boot $simulator && sleep 30 +xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30 xcrun simctl list | grep Booted From 9ff845e1b0bd0b27ec0884607e79028bc2461ccb Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 12:28:17 +0500 Subject: [PATCH 35/83] testing. --- Scripts/start_simulator.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 4762302c..99335f39 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -25,16 +25,18 @@ then name="${name}-1080p" fi - CUSTOM_SIMULATOR="${NAME}-CUSTOM" # xcrun simctl list runtimes - xcrun simctl create "$CUSTOM_SIMULATOR" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" + xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" + CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" + echo $CUSTOM_SIMULATOR # xcrun simctl list devices $SIMULATOR_XCODE fi -if [ -z "$CUSTOM_SIMULATOR" ] +if [ ! $CUSTOM_SIMULATOR ] then CUSTOM_SIMULATOR=$NAME fi +echo $CUSTOM_SIMULATOR xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30 xcrun simctl list | grep Booted From b7cc912a1c81c47ed33221ddbec6abff798684d1 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 12:51:38 +0500 Subject: [PATCH 36/83] fixes. --- Scripts/start_simulator.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 99335f39..2b43e26c 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -25,18 +25,12 @@ then name="${name}-1080p" fi - # xcrun simctl list runtimes xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" - echo $CUSTOM_SIMULATOR - # xcrun simctl list devices $SIMULATOR_XCODE +else + CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 '$NAME' | awk -F'[][]' '{print $2}')" fi -if [ ! $CUSTOM_SIMULATOR ] -then - CUSTOM_SIMULATOR=$NAME -fi - -echo $CUSTOM_SIMULATOR +xcrun simctl list runtimes xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30 xcrun simctl list | grep Booted From 8a5af17d4beec547f96c753c39260e661f4a4d34 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 13:25:54 +0500 Subject: [PATCH 37/83] fixes. --- Scripts/start_simulator.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 2b43e26c..f88e5227 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -22,13 +22,13 @@ then name="${NAME// /-}" if [ "$name" == "Apple-TV-4K" ] then - name="${name}-1080p" + name="${name}-4K" fi xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" - CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" + CUSTOM_SIMULATOR="$(xctrace list devices | grep -m 1 'custom-device' | awk '{print substr($0,length($0)-36,36)}')" else - CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 '$NAME' | awk -F'[][]' '{print $2}')" + CUSTOM_SIMULATOR="$(xctrace list devices | grep -m 1 '$NAME' | awk '{print substr($0,length($0)-36,36)}')" fi xcrun simctl list runtimes From 286781b04d95c4797271d476e9d462e06760a349 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 13:47:17 +0500 Subject: [PATCH 38/83] fixes. --- Scripts/start_simulator.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index f88e5227..58100706 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -26,9 +26,9 @@ then fi xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" - CUSTOM_SIMULATOR="$(xctrace list devices | grep -m 1 'custom-device' | awk '{print substr($0,length($0)-36,36)}')" + CUSTOM_SIMULATOR="$(xcrun xctrace list devices | grep -m 1 'custom-device' | awk '{print substr($0,length($0)-36,36)}')" else - CUSTOM_SIMULATOR="$(xctrace list devices | grep -m 1 '$NAME' | awk '{print substr($0,length($0)-36,36)}')" + CUSTOM_SIMULATOR="$(xcrun xctrace list devices | grep -m 1 '$NAME' | awk '{print substr($0,length($0)-36,36)}')" fi xcrun simctl list runtimes From 3f4156fb54a52e4c705d82a4a4ccba729d7d75d0 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 13:57:43 +0500 Subject: [PATCH 39/83] fixes. --- Scripts/start_simulator.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 58100706..b4584dc6 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -26,9 +26,9 @@ then fi xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" - CUSTOM_SIMULATOR="$(xcrun xctrace list devices | grep -m 1 'custom-device' | awk '{print substr($0,length($0)-36,36)}')" + CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" else - CUSTOM_SIMULATOR="$(xcrun xctrace list devices | grep -m 1 '$NAME' | awk '{print substr($0,length($0)-36,36)}')" + CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) fi xcrun simctl list runtimes From 30de93878127bd5dd98c3f542be3806521fcf4df Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 14:20:47 +0500 Subject: [PATCH 40/83] fixes. --- .github/workflows/swift.yml | 4 ++-- Scripts/start_simulator.sh | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 8b7f1df9..dd8923a4 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -95,13 +95,13 @@ jobs: platform: "iOS Simulator" os_type: "iOS" simulator_xcode: 10.3 - - os: 12.4 + - os: 13.2 device: "Apple TV 4K" scheme: "OptimizelySwiftSDK-tvOS" sdk: "appletvsimulator" platform: "tvOS Simulator" os_type: "tvOS" - simulator_xcode: 10.3 + simulator_xcode: 11.2.1 steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index b4584dc6..fd0cceef 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -9,15 +9,9 @@ set -eou pipefail # prep jq arg because it doesnt allow parameter expansion within its single quotes echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes -if [ "$SIMULATOR_XCODE" == 10.3 ] -then - sudo ln -s /Applications/Xcode_10.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime -elif [ "$SIMULATOR_XCODE" != 12.4 ]; then - sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime -fi - if [ "$SIMULATOR_XCODE" != 12.4 ] -then +then + sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime os="${OS/./-}" name="${NAME// /-}" if [ "$name" == "Apple-TV-4K" ] From 62ee6a06b7e9b9e0dd731c79b28977f98253ee71 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 15:07:54 +0500 Subject: [PATCH 41/83] fixes. --- .github/workflows/swift.yml | 4 ++-- Scripts/start_simulator.sh | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index dd8923a4..8b7f1df9 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -95,13 +95,13 @@ jobs: platform: "iOS Simulator" os_type: "iOS" simulator_xcode: 10.3 - - os: 13.2 + - os: 12.4 device: "Apple TV 4K" scheme: "OptimizelySwiftSDK-tvOS" sdk: "appletvsimulator" platform: "tvOS Simulator" os_type: "tvOS" - simulator_xcode: 11.2.1 + simulator_xcode: 10.3 steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index fd0cceef..464c0ad7 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -9,9 +9,20 @@ set -eou pipefail # prep jq arg because it doesnt allow parameter expansion within its single quotes echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes -if [ "$SIMULATOR_XCODE" != 12.4 ] -then +if [ "$SIMULATOR_XCODE" == 10.3 ] +then + os_folder="iPhoneOS" + if [ "$NAME" == "Apple TV 4K" ] + then + os_folder="AppleTVOS" + fi + sudo ln -s /Applications/Xcode_10.3.app/Contents/Developer/Platforms/$os_folder.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime +elif [ "$SIMULATOR_XCODE" != 12.4 ]; then sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime +fi + +if [ "$SIMULATOR_XCODE" != 12.4 ] +then os="${OS/./-}" name="${NAME// /-}" if [ "$name" == "Apple-TV-4K" ] From c26f22d350ef50f81a1e12276c3dd8ee2dc3a24b Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 16:08:43 +0500 Subject: [PATCH 42/83] cleanup. --- .github/workflows/swift.yml | 1 + Scripts/start_simulator.sh | 35 ++++++++++++++++++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 8b7f1df9..5806a327 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -7,6 +7,7 @@ on: branches: [ master ] jobs: + lint_markdown_files: uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 464c0ad7..c2d4de74 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -2,40 +2,41 @@ set -eou pipefail # expects the following environment variables defined -# PLATFORM (eg. iOS Simulator) +# SIMULATOR_XCODE (Which Xcode's simulator to use) # OS (eg. 12.0) # NAME (eg. iPad Air) +# OS_TYPE (eg. iOS) # prep jq arg because it doesnt allow parameter expansion within its single quotes -echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes -if [ "$SIMULATOR_XCODE" == 10.3 ] -then + +if [ "$SIMULATOR_XCODE" != 12.4 ]; then + os_folder="iPhoneOS" + os="${OS/./-}" + name="${NAME// /-}" + + # Check if device is Apple tv, update os_folder for linking purposes if [ "$NAME" == "Apple TV 4K" ] then + name="${name}-4K" os_folder="AppleTVOS" fi - sudo ln -s /Applications/Xcode_10.3.app/Contents/Developer/Platforms/$os_folder.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime -elif [ "$SIMULATOR_XCODE" != 12.4 ]; then - sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime -fi -if [ "$SIMULATOR_XCODE" != 12.4 ] -then - os="${OS/./-}" - name="${NAME// /-}" - if [ "$name" == "Apple-TV-4K" ] + # update os_folder as per xcode version + if [ "$SIMULATOR_XCODE" == 10.3 ] then - name="${name}-4K" + os_folder="${os_folder}.platform/Developer" + else + os_folder="${os_folder}.platform" fi - + + # Create link and create simulators which are not part of the current xcode version + sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/$os_folder/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" else CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) fi -xcrun simctl list runtimes xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30 -xcrun simctl list | grep Booted From e2cc6d9eaf071ab6da63c980f477183c2a02e118 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 16:26:06 +0500 Subject: [PATCH 43/83] cleanup. --- Scripts/start_simulator.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index c2d4de74..1a5ed0cd 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -6,33 +6,32 @@ set -eou pipefail # OS (eg. 12.0) # NAME (eg. iPad Air) # OS_TYPE (eg. iOS) - -# prep jq arg because it doesnt allow parameter expansion within its single quotes +# More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes -if [ "$SIMULATOR_XCODE" != 12.4 ]; then +if [ $SIMULATOR_XCODE != 12.4 ]; then os_folder="iPhoneOS" os="${OS/./-}" name="${NAME// /-}" # Check if device is Apple tv, update os_folder for linking purposes - if [ "$NAME" == "Apple TV 4K" ] + if [ $NAME == "Apple TV 4K" ] then name="${name}-4K" os_folder="AppleTVOS" fi # update os_folder as per xcode version - if [ "$SIMULATOR_XCODE" == 10.3 ] + if [ $SIMULATOR_XCODE == 10.3 ] then - os_folder="${os_folder}.platform/Developer" + os_folder="${os_folder}.platform/Developer/Library" else - os_folder="${os_folder}.platform" + os_folder="${os_folder}.platform/Library/Developer" fi # Create link and create simulators which are not part of the current xcode version - sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/$os_folder/Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime + sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" else From fff7e6f2b08e250da33683d563df57ba33c219a4 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 16:30:01 +0500 Subject: [PATCH 44/83] clean up. --- Scripts/start_simulator.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 1a5ed0cd..a75d4338 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -9,21 +9,21 @@ set -eou pipefail # More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes -if [ $SIMULATOR_XCODE != 12.4 ]; then +if [ "$SIMULATOR_XCODE" != 12.4 ]; then os_folder="iPhoneOS" os="${OS/./-}" name="${NAME// /-}" # Check if device is Apple tv, update os_folder for linking purposes - if [ $NAME == "Apple TV 4K" ] + if [ "$NAME" == "Apple TV 4K" ] then name="${name}-4K" os_folder="AppleTVOS" fi # update os_folder as per xcode version - if [ $SIMULATOR_XCODE == 10.3 ] + if [ "$SIMULATOR_XCODE" == 10.3 ] then os_folder="${os_folder}.platform/Developer/Library" else From 3dbfac6fd609950dc6474fc50ca030b1e10741bf Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 16:45:22 +0500 Subject: [PATCH 45/83] fixes. --- .github/workflows/swift.yml | 10 +++++----- Scripts/start_simulator.sh | 12 ++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 5806a327..c94327af 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -81,28 +81,28 @@ jobs: sdk: "iphonesimulator" platform: "iOS Simulator" os_type: "iOS" - simulator_xcode: 12.4 + simulator_xcode_version: 12.4 - os: 13.3 device: "iPhone 8" scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" os_type: "iOS" - simulator_xcode: 11.3.1 + simulator_xcode_version: 11.3.1 - os: 12.4 device: "iPad Air" scheme: "OptimizelySwiftSDK-iOS" sdk: "iphonesimulator" platform: "iOS Simulator" os_type: "iOS" - simulator_xcode: 10.3 + simulator_xcode_version: 10.3 - os: 12.4 device: "Apple TV 4K" scheme: "OptimizelySwiftSDK-tvOS" sdk: "appletvsimulator" platform: "tvOS Simulator" os_type: "tvOS" - simulator_xcode: 10.3 + simulator_xcode_version: 10.3 steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 @@ -126,7 +126,7 @@ jobs: PLATFORM: ${{ matrix.platform }} OS: ${{ matrix.os }} OS_TYPE: ${{ matrix.os_type }} - SIMULATOR_XCODE: ${{ matrix.simulator_xcode }} + SIMULATOR_XCODE_VERSION: ${{ matrix.simulator_xcode_version }} NAME: ${{ matrix.device }} COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} run: | diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index a75d4338..464833f3 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -2,14 +2,16 @@ set -eou pipefail # expects the following environment variables defined -# SIMULATOR_XCODE (Which Xcode's simulator to use) +# PLATFORM (eg. iOS Simulator) # OS (eg. 12.0) # NAME (eg. iPad Air) # OS_TYPE (eg. iOS) +# SIMULATOR_XCODE_VERSION (Which Xcode's simulator to use) +# Since github actions only provide limit simulators with each xcode, we need to link simulators from other versions of xcode to be used by current xcode. # More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes -if [ "$SIMULATOR_XCODE" != 12.4 ]; then +if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="iPhoneOS" os="${OS/./-}" @@ -23,7 +25,7 @@ if [ "$SIMULATOR_XCODE" != 12.4 ]; then fi # update os_folder as per xcode version - if [ "$SIMULATOR_XCODE" == 10.3 ] + if [ "$SIMULATOR_XCODE_VERSION" == 10.3 ] then os_folder="${os_folder}.platform/Developer/Library" else @@ -31,11 +33,13 @@ if [ "$SIMULATOR_XCODE" != 12.4 ]; then fi # Create link and create simulators which are not part of the current xcode version - sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime + sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" else + echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) fi xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30 +xcrun simctl list | grep Booted From 79bba9dc25348c02d22d650ef69102eae5b24f7b Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Fri, 15 Apr 2022 17:00:08 +0500 Subject: [PATCH 46/83] fixes. --- Scripts/start_simulator.sh | 6 +++--- Tests/TestUtils/MockUrlSession.swift | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Scripts/start_simulator.sh b/Scripts/start_simulator.sh index 464833f3..caede98a 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/start_simulator.sh @@ -9,14 +9,14 @@ set -eou pipefail # SIMULATOR_XCODE_VERSION (Which Xcode's simulator to use) # Since github actions only provide limit simulators with each xcode, we need to link simulators from other versions of xcode to be used by current xcode. # More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md -sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then - os_folder="iPhoneOS" os="${OS/./-}" name="${NAME// /-}" + sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes + # Check if device is Apple tv, update os_folder for linking purposes if [ "$NAME" == "Apple TV 4K" ] then @@ -32,7 +32,7 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="${os_folder}.platform/Library/Developer" fi - # Create link and create simulators which are not part of the current xcode version + # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" diff --git a/Tests/TestUtils/MockUrlSession.swift b/Tests/TestUtils/MockUrlSession.swift index 28ab4092..c8c498a5 100644 --- a/Tests/TestUtils/MockUrlSession.swift +++ b/Tests/TestUtils/MockUrlSession.swift @@ -54,7 +54,7 @@ class MockUrlSession: URLSession { } init(handler: MockDatafileHandler? = nil, statusCode: Int = 0, withError: Bool = false, localResponseData: String? = nil) { - MockUrlSession.validSessions += 1 + Self.validSessions += 1 self.handler = handler self.statusCode = statusCode self.withError = withError @@ -62,7 +62,7 @@ class MockUrlSession: URLSession { } init(handler: MockDatafileHandler? = nil, settingsMap: [String: (Int, Bool)]) { - MockUrlSession.validSessions += 1 + Self.validSessions += 1 self.handler = handler self.statusCode = 0 self.withError = false From 50250d47356d0fbc2d813ffca3f2da09094f50c0 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 13:36:20 +0500 Subject: [PATCH 47/83] fixing. --- .github/workflows/integration_tests.yml | 48 ++++++ .github/workflows/prepare_for_release.yml | 36 +++++ .github/workflows/swift.yml | 152 +----------------- .github/workflows/unit_tests.yml | 86 ++++++++++ ...tart_simulator.sh => prepare_simulator.sh} | 14 +- Scripts/test_all.sh | 27 ++-- 6 files changed, 198 insertions(+), 165 deletions(-) create mode 100644 .github/workflows/integration_tests.yml create mode 100644 .github/workflows/prepare_for_release.yml create mode 100644 .github/workflows/unit_tests.yml rename Scripts/{start_simulator.sh => prepare_simulator.sh} (80%) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml new file mode 100644 index 00000000..88bdf97f --- /dev/null +++ b/.github/workflows/integration_tests.yml @@ -0,0 +1,48 @@ +name: Reusable action of Integration tests + +on: [workflow_call] + +jobs: + integration_tests: + if: ${{ github.event.inputs.SNAPSHOT != 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.CI_USER_TOKEN }} + repository: 'optimizely/travisci-tools' + path: 'home/runner/travisci-tools' + ref: 'master' + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - name: Trigger build + env: + SDK: swift + TESTAPP_TAG: master + BUILD_NUMBER: ${{ github.run_id }} + TESTAPP_BRANCH: master + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} + UPSTREAM_REPO: ${{ github.repository }} + TRAVIS_COMMIT: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + UPSTREAM_SHA: ${{ github.sha }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + EVENT_MESSAGE: ${{ github.event.message }} + HOME: 'home/runner' + run: | + echo "$GITHUB_CONTEXT" + home/runner/travisci-tools/trigger-script-with-status-update.sh \ No newline at end of file diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml new file mode 100644 index 00000000..c549b8d3 --- /dev/null +++ b/.github/workflows/prepare_for_release.yml @@ -0,0 +1,36 @@ +name: Reusable action of Preparing for release + +on: [workflow_call] + +jobs: + prepare_for_release: + runs-on: macos-latest + steps: + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: maxim-lobanov/setup-xcode@v1 + - uses: actions/checkout@v3 + with: + xcode-version: '12.4' + - id: prepare_for_release + name: Prepare for release + env: + VERSION: 3.10.1 + HOME: 'home/runner' + TRAVIS_REPO_SLUG: ${{ github.repository }} + GITHUB_USER: optibot + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + run: | + gem install cocoapods -v '1.9.3' + Scripts/run_prep.sh + - name: Check prepare for release failure + if: steps.prepare_for_release.outcome != 'success' + run: cat /tmp/build.out \ No newline at end of file diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index c94327af..186ca3fa 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -12,48 +12,7 @@ jobs: uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction integration_tests: - if: ${{ github.event.inputs.SNAPSHOT != 'true' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # You should create a personal access token and store it in your repository - token: ${{ secrets.CI_USER_TOKEN }} - repository: 'optimizely/travisci-tools' - path: 'home/runner/travisci-tools' - ref: 'master' - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - name: Trigger build - env: - SDK: swift - TESTAPP_TAG: master - BUILD_NUMBER: ${{ github.run_id }} - TESTAPP_BRANCH: master - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_EVENT_TYPE: ${{ github.event_name }} - GITHUB_CONTEXT: ${{ toJson(github) }} - TRAVIS_REPO_SLUG: ${{ github.repository }} - TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} - UPSTREAM_REPO: ${{ github.repository }} - TRAVIS_COMMIT: ${{ github.sha }} - TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} - TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} - UPSTREAM_SHA: ${{ github.sha }} - TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - EVENT_MESSAGE: ${{ github.event.message }} - HOME: 'home/runner' - run: | - echo "$GITHUB_CONTEXT" - home/runner/travisci-tools/trigger-script-with-status-update.sh + uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction lint: runs-on: macos-latest @@ -70,121 +29,22 @@ jobs: curl -sSL https://download.sourceclear.com/ci.sh | bash unittests: - runs-on: macos-10.15 - strategy: - fail-fast: false - matrix: - include: - - os: 14.4 - device: "iPhone 11" - scheme: "OptimizelySwiftSDK-iOS" - sdk: "iphonesimulator" - platform: "iOS Simulator" - os_type: "iOS" - simulator_xcode_version: 12.4 - - os: 13.3 - device: "iPhone 8" - scheme: "OptimizelySwiftSDK-iOS" - sdk: "iphonesimulator" - platform: "iOS Simulator" - os_type: "iOS" - simulator_xcode_version: 11.3.1 - - os: 12.4 - device: "iPad Air" - scheme: "OptimizelySwiftSDK-iOS" - sdk: "iphonesimulator" - platform: "iOS Simulator" - os_type: "iOS" - simulator_xcode_version: 10.3 - - os: 12.4 - device: "Apple TV 4K" - scheme: "OptimizelySwiftSDK-tvOS" - sdk: "appletvsimulator" - platform: "tvOS Simulator" - os_type: "tvOS" - simulator_xcode_version: 10.3 - steps: - - uses: actions/checkout@v3 - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: 12.4 - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - id: unit_tests - env: - COVERAGE_DIR: ./COVERAGE - SCHEME: ${{ matrix.scheme }} - TEST_SDK: ${{ matrix.sdk }} - PLATFORM: ${{ matrix.platform }} - OS: ${{ matrix.os }} - OS_TYPE: ${{ matrix.os_type }} - SIMULATOR_XCODE_VERSION: ${{ matrix.simulator_xcode_version }} - NAME: ${{ matrix.device }} - COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - run: | - gem install coveralls-lcov - gem install cocoapods -v '1.9.3' - pod repo update - pod install - HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq - Scripts/start_simulator.sh - Scripts/run_unit_tests.sh - - name: Check on failures - if: steps.unit_tests.outcome != 'success' - run: | - sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" - - name: Check on success - if: steps.unit_tests.outcome == 'success' - run: | - Scripts/upload_coveralls.sh - sleep 5 + uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction prepare_for_release: + uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction + + release: runs-on: macos-latest steps: - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - uses: maxim-lobanov/setup-xcode@v1 - - uses: actions/checkout@v3 - with: - xcode-version: '12.4' - - id: prepare_for_release - name: Prepare for release - env: - VERSION: 3.10.1 - HOME: 'home/runner' - TRAVIS_REPO_SLUG: ${{ github.repository }} - GITHUB_USER: optibot - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - run: | - wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub - gem install cocoapods -v '1.9.3' - Scripts/run_prep.sh - - name: Check prepare for release failure - if: steps.prepare_for_release.outcome != 'success' - run: cat /tmp/build.out - - release: - runs-on: macos-latest - steps: - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: @@ -192,7 +52,7 @@ jobs: - name: Push to cocoapods.org env: VERSION: 3.10.1 + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} run: | - wget https://github.com/github/hub/releases/download/v2.11.2/hub-darwin-amd64-2.11.2.tgz -O /tmp/hub-darwin-amd64-2.11.2.tgz && tar -xvf /tmp/hub-darwin-amd64-2.11.2.tgz -C /usr/local/opt && ln -s /usr/local/opt/hub-darwin-amd64-2.11.2/bin/hub /usr/local/bin/hub gem install cocoapods -v '1.9.3' Scripts/run_release.sh diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 00000000..3e02b315 --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,86 @@ +name: Reusable action of Unit tests + +on: [workflow_call] + +jobs: + unittests: + runs-on: macos-10.15 + strategy: + fail-fast: false + matrix: + include: + - os: 14.4 + device: "iPhone 11" + scheme: "OptimizelySwiftSDK-iOS" + test_sdk: "iphonesimulator" + platform: "iOS Simulator" + os_type: "iOS" + simulator_xcode_version: 12.4 + - os: 13.3 + device: "iPhone 8" + scheme: "OptimizelySwiftSDK-iOS" + test_sdk: "iphonesimulator" + platform: "iOS Simulator" + os_type: "iOS" + simulator_xcode_version: 11.3.1 + - os: 12.4 + device: "iPad Air" + scheme: "OptimizelySwiftSDK-iOS" + test_sdk: "iphonesimulator" + platform: "iOS Simulator" + os_type: "iOS" + simulator_xcode_version: 10.3 + - os: 12.4 + device: "Apple TV 4K" + scheme: "OptimizelySwiftSDK-tvOS" + test_sdk: "appletvsimulator" + platform: "tvOS Simulator" + os_type: "tvOS" + simulator_xcode_version: 10.3 + steps: + - uses: actions/checkout@v3 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 12.4 + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - id: unit_tests + env: + COVERAGE_DIR: ./COVERAGE + SCHEME: ${{ matrix.scheme }} + TEST_SDK: ${{ matrix.test_sdk }} + PLATFORM: ${{ matrix.platform }} + OS: ${{ matrix.os }} + OS_TYPE: ${{ matrix.os_type }} + SIMULATOR_XCODE_VERSION: ${{ matrix.simulator_xcode_version }} + NAME: ${{ matrix.device }} + COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + run: | + gem install coveralls-lcov + gem install cocoapods -v '1.9.3' + pod repo update + pod install + HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq + SIMULATOR_UDID=$(Scripts/prepare_simulator.sh) + xcrun simctl boot $SIMULATOR_UDID && sleep 30 + xcrun simctl list | grep Booted + Scripts/run_unit_tests.sh + - name: Check on failures + if: steps.unit_tests.outcome != 'success' + run: | + sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash + artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) + artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" + - name: Check on success + if: steps.unit_tests.outcome == 'success' + run: | + Scripts/upload_coveralls.sh + sleep 5 \ No newline at end of file diff --git a/Scripts/start_simulator.sh b/Scripts/prepare_simulator.sh similarity index 80% rename from Scripts/start_simulator.sh rename to Scripts/prepare_simulator.sh index caede98a..8d7cae59 100755 --- a/Scripts/start_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -8,6 +8,7 @@ set -eou pipefail # OS_TYPE (eg. iOS) # SIMULATOR_XCODE_VERSION (Which Xcode's simulator to use) # Since github actions only provide limit simulators with each xcode, we need to link simulators from other versions of xcode to be used by current xcode. +# We must use old simulators with current xcode since old xcode doesnot support swift 5 required by Swift SDK. # More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then @@ -16,11 +17,11 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then name="${NAME// /-}" sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes - + # Check if device is Apple tv, update os_folder for linking purposes - if [ "$NAME" == "Apple TV 4K" ] + if [[ "$NAME" = "Apple TV"* ]] then - name="${name}-4K" + name="${name}-1080p" os_folder="AppleTVOS" fi @@ -35,11 +36,10 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" - CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" + UDID="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" else echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file - CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) + UDID=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) fi -xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30 -xcrun simctl list | grep Booted +echo "$UDID" diff --git a/Scripts/test_all.sh b/Scripts/test_all.sh index 36e12d96..5cf36ed1 100755 --- a/Scripts/test_all.sh +++ b/Scripts/test_all.sh @@ -1,13 +1,16 @@ -echo 'Testing OptimizelySwiftSDK-iOS (iPhone 8,OS=12.1)' -xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.1' test -echo 'Testing OptimizelySwiftSDK-iOS (iPhone SE,OS=11.1)' -xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone SE,OS=11.1' test -echo 'Testing OptimizelySwiftSDK-iOS (iPhone XS,OS=13.2)' -xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone XS,OS=13.2' test +deviceModels=("iPhone SE" "iPhone 8" "iPhone 11", "Apple TV" "Apple TV" "Apple TV 4K") +osVersions=("12.4" "13.3" "14.4", "12.4", "13.3", "14.3") +xcodeVersions=("10.3" "11.3.1" "12.4", "10.3", "11.3.1", "12.4") +platforms=("iOS" "iOS" "iOS", "tvOS", "tvOS", "tvOS") +testSdks=("iphonesimulator" "iphonesimulator" "iphonesimulator", "appletvsimulator", "appletvsimulator", "appletvsimulator") -echo 'Testing OptimizelySwiftSDK-tvOS (Apple TV,OS=11.1)' -xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV,OS=11.1' test -echo 'Testing OptimizelySwiftSDK-tvOS (Apple TV,OS=12.1)' -xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV,OS=12.1' test -echo 'Testing OptimizelySwiftSDK-tvOS (Apple TV 4K,OS=13.2)' -xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme OptimizelySwiftSDK-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV 4K,OS=13.2' test +for i in ${!deviceModels[@]}; do + PLATFORM="${platforms[$i]} Simulator" + OS="${osVersions[$i]}" + NAME="${deviceModels[$i]}" + OS_TYPE="${platforms[$i]}" + SIMULATOR_XCODE_VERSION="${xcodeVersions[$i]}" + Scripts/prepare_simulator.sh + echo "Testing OptimizelySwiftSDK-${platforms[$i]} (${deviceModels[$i]},OS=${osVersions[$i]})" + xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme "OptimizelySwiftSDK-${platforms[$i]}" -sdk "${testSdks[$i]}" -destination "platform=${platforms[$i]} Simulator,name=${deviceModels[$i]},OS=${osVersions[$i]}" test +done \ No newline at end of file From 1082cd66fc8b9aec5347a443cc9705e0b677009b Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 15:19:47 +0500 Subject: [PATCH 48/83] fixes. --- .github/workflows/integration_tests.yml | 8 +++++++- .github/workflows/prepare_for_release.yml | 6 +++++- .github/workflows/swift.yml | 7 +++++++ .github/workflows/unit_tests.yml | 6 +++++- Scripts/prepare_simulator.sh | 9 +++------ 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 88bdf97f..a4871b63 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -1,6 +1,12 @@ name: Reusable action of Integration tests -on: [workflow_call] +on: + workflow_call: + secrets: + CI_USER_TOKEN: + required: true + TRAVIS_COM_TOKEN: + required: true jobs: integration_tests: diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml index c549b8d3..91df7af9 100644 --- a/.github/workflows/prepare_for_release.yml +++ b/.github/workflows/prepare_for_release.yml @@ -1,6 +1,10 @@ name: Reusable action of Preparing for release -on: [workflow_call] +on: + workflow_call: + secrets: + CI_USER_TOKEN: + required: true jobs: prepare_for_release: diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 186ca3fa..7718ab57 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -13,6 +13,9 @@ jobs: integration_tests: uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} lint: runs-on: macos-latest @@ -30,9 +33,13 @@ jobs: unittests: uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction + secrets: + COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} prepare_for_release: uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} release: runs-on: macos-latest diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 3e02b315..c41820a5 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -1,6 +1,10 @@ name: Reusable action of Unit tests -on: [workflow_call] +on: + workflow_call: + secrets: + COVERALLS_TOKEN: + required: true jobs: unittests: diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index 8d7cae59..3cbc739f 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -36,10 +36,7 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" - UDID="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" -else - echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file - UDID=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) fi - -echo "$UDID" + +echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file +echo $( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) From 6cdda21aa81c0d3dd51925ef3031da360f40f03b Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 15:37:04 +0500 Subject: [PATCH 49/83] fixes. --- Scripts/prepare_simulator.sh | 13 ++++++++----- Scripts/test_all.sh | 23 ++++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index 3cbc739f..8f668350 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -19,9 +19,9 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes # Check if device is Apple tv, update os_folder for linking purposes - if [[ "$NAME" = "Apple TV"* ]] + if [ "$NAME" == "Apple TV 4K" ] then - name="${name}-1080p" + name="${name}-4K" os_folder="AppleTVOS" fi @@ -36,7 +36,10 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" + UDID="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" +else + echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file + UDID=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) fi - -echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file -echo $( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) + +echo "$UDID" diff --git a/Scripts/test_all.sh b/Scripts/test_all.sh index 5cf36ed1..4efa5f88 100755 --- a/Scripts/test_all.sh +++ b/Scripts/test_all.sh @@ -1,15 +1,16 @@ -deviceModels=("iPhone SE" "iPhone 8" "iPhone 11", "Apple TV" "Apple TV" "Apple TV 4K") -osVersions=("12.4" "13.3" "14.4", "12.4", "13.3", "14.3") -xcodeVersions=("10.3" "11.3.1" "12.4", "10.3", "11.3.1", "12.4") -platforms=("iOS" "iOS" "iOS", "tvOS", "tvOS", "tvOS") -testSdks=("iphonesimulator" "iphonesimulator" "iphonesimulator", "appletvsimulator", "appletvsimulator", "appletvsimulator") +#!/usr/bin/env bash +deviceModels=("iPhone SE" "iPhone 8" "iPhone 11" "Apple TV" "Apple TV" "Apple TV 4K") +osVersions=("12.4" "13.3" "14.4" "12.4" "13.3" "14.3") +xcodeVersions=("10.3" "11.3.1" "12.4" "10.3" "11.3.1" "12.4") +platforms=("iOS" "iOS" "iOS" "tvOS" "tvOS" "tvOS") +testSdks=("iphonesimulator" "iphonesimulator" "iphonesimulator" "appletvsimulator" "appletvsimulator" "appletvsimulator") -for i in ${!deviceModels[@]}; do - PLATFORM="${platforms[$i]} Simulator" - OS="${osVersions[$i]}" - NAME="${deviceModels[$i]}" - OS_TYPE="${platforms[$i]}" - SIMULATOR_XCODE_VERSION="${xcodeVersions[$i]}" +for i in "${!deviceModels[@]}"; do + export PLATFORM="${platforms[$i]} Simulator" + export OS="${osVersions[$i]}" + export NAME="${deviceModels[$i]}" + export OS_TYPE="${platforms[$i]}" + export SIMULATOR_XCODE_VERSION="${xcodeVersions[$i]}" Scripts/prepare_simulator.sh echo "Testing OptimizelySwiftSDK-${platforms[$i]} (${deviceModels[$i]},OS=${osVersions[$i]})" xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme "OptimizelySwiftSDK-${platforms[$i]}" -sdk "${testSdks[$i]}" -destination "platform=${platforms[$i]} Simulator,name=${deviceModels[$i]},OS=${osVersions[$i]}" test From a5cbf0ea8f91daaaa47485842d587124b683258a Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 15:50:10 +0500 Subject: [PATCH 50/83] testing. --- .github/workflows/prepare_for_release.yml | 2 +- .github/workflows/unit_tests.yml | 2 +- Scripts/prepare_simulator.sh | 7 +++++-- Scripts/test_all.sh | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml index 91df7af9..9437ca4b 100644 --- a/.github/workflows/prepare_for_release.yml +++ b/.github/workflows/prepare_for_release.yml @@ -34,7 +34,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} run: | gem install cocoapods -v '1.9.3' - Scripts/run_prep.sh + sh Scripts/run_prep.sh - name: Check prepare for release failure if: steps.prepare_for_release.outcome != 'success' run: cat /tmp/build.out \ No newline at end of file diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c41820a5..3d7530c9 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -73,7 +73,7 @@ jobs: pod repo update pod install HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq - SIMULATOR_UDID=$(Scripts/prepare_simulator.sh) + SIMULATOR_UDID=$(sh Scripts/prepare_simulator.sh) xcrun simctl boot $SIMULATOR_UDID && sleep 30 xcrun simctl list | grep Booted Scripts/run_unit_tests.sh diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index 8f668350..c03ee766 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -19,9 +19,9 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes # Check if device is Apple tv, update os_folder for linking purposes - if [ "$NAME" == "Apple TV 4K" ] + if [[ "$NAME" = "Apple TV"* ]] then - name="${name}-4K" + name="${name}-1080p" os_folder="AppleTVOS" fi @@ -33,6 +33,9 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="${os_folder}.platform/Library/Developer" fi + echo "=======================" + echo $SIMULATOR_XCODE_VERSION + # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" diff --git a/Scripts/test_all.sh b/Scripts/test_all.sh index 4efa5f88..f2ef0d64 100755 --- a/Scripts/test_all.sh +++ b/Scripts/test_all.sh @@ -11,7 +11,7 @@ for i in "${!deviceModels[@]}"; do export NAME="${deviceModels[$i]}" export OS_TYPE="${platforms[$i]}" export SIMULATOR_XCODE_VERSION="${xcodeVersions[$i]}" - Scripts/prepare_simulator.sh + sh Scripts/prepare_simulator.sh echo "Testing OptimizelySwiftSDK-${platforms[$i]} (${deviceModels[$i]},OS=${osVersions[$i]})" xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme "OptimizelySwiftSDK-${platforms[$i]}" -sdk "${testSdks[$i]}" -destination "platform=${platforms[$i]} Simulator,name=${deviceModels[$i]},OS=${osVersions[$i]}" test done \ No newline at end of file From d4f6e5b6dcf163adcc175d7d537679f97a7bfe56 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 16:03:55 +0500 Subject: [PATCH 51/83] testing --- Scripts/prepare_simulator.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index c03ee766..096f1ae6 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -33,8 +33,8 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="${os_folder}.platform/Library/Developer" fi - echo "=======================" - echo $SIMULATOR_XCODE_VERSION + printf "=======================" + printf "SIMULATOR_XCODE_VERSION: %s\n" "$SIMULATOR_XCODE_VERSION" # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime From de0a23be919c0f9c953d6ac00f9b8a4972fcff15 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 16:35:54 +0500 Subject: [PATCH 52/83] testing. --- .github/workflows/prepare_for_release.yml | 2 +- .github/workflows/unit_tests.yml | 2 +- Scripts/prepare_simulator.sh | 10 +++++++--- Scripts/test_all.sh | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml index 9437ca4b..91df7af9 100644 --- a/.github/workflows/prepare_for_release.yml +++ b/.github/workflows/prepare_for_release.yml @@ -34,7 +34,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} run: | gem install cocoapods -v '1.9.3' - sh Scripts/run_prep.sh + Scripts/run_prep.sh - name: Check prepare for release failure if: steps.prepare_for_release.outcome != 'success' run: cat /tmp/build.out \ No newline at end of file diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 3d7530c9..c41820a5 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -73,7 +73,7 @@ jobs: pod repo update pod install HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq - SIMULATOR_UDID=$(sh Scripts/prepare_simulator.sh) + SIMULATOR_UDID=$(Scripts/prepare_simulator.sh) xcrun simctl boot $SIMULATOR_UDID && sleep 30 xcrun simctl list | grep Booted Scripts/run_unit_tests.sh diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index 096f1ae6..41d4f896 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash -e set -eou pipefail # expects the following environment variables defined @@ -33,8 +33,12 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="${os_folder}.platform/Library/Developer" fi - printf "=======================" - printf "SIMULATOR_XCODE_VERSION: %s\n" "$SIMULATOR_XCODE_VERSION" + printf "\n=======================" + printf "\nSIMULATOR_XCODE_VERSION: %s" "$SIMULATOR_XCODE_VERSION" + printf "\n=======================" + printf "\nOS: %s" "$OS" + printf "\n=======================" + printf "\nNAME: %s" "$NAME" # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime diff --git a/Scripts/test_all.sh b/Scripts/test_all.sh index f2ef0d64..4efa5f88 100755 --- a/Scripts/test_all.sh +++ b/Scripts/test_all.sh @@ -11,7 +11,7 @@ for i in "${!deviceModels[@]}"; do export NAME="${deviceModels[$i]}" export OS_TYPE="${platforms[$i]}" export SIMULATOR_XCODE_VERSION="${xcodeVersions[$i]}" - sh Scripts/prepare_simulator.sh + Scripts/prepare_simulator.sh echo "Testing OptimizelySwiftSDK-${platforms[$i]} (${deviceModels[$i]},OS=${osVersions[$i]})" xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme "OptimizelySwiftSDK-${platforms[$i]}" -sdk "${testSdks[$i]}" -destination "platform=${platforms[$i]} Simulator,name=${deviceModels[$i]},OS=${osVersions[$i]}" test done \ No newline at end of file From f5a6cff23f7028cfc6da60c471717bb6832e2079 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 16:41:11 +0500 Subject: [PATCH 53/83] testing. --- Scripts/prepare_simulator.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index 41d4f896..d1bde3db 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -33,12 +33,7 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="${os_folder}.platform/Library/Developer" fi - printf "\n=======================" - printf "\nSIMULATOR_XCODE_VERSION: %s" "$SIMULATOR_XCODE_VERSION" - printf "\n=======================" - printf "\nOS: %s" "$OS" - printf "\n=======================" - printf "\nNAME: %s" "$NAME" + echo "=======$SIMULATOR_XCODE_VERSION========" # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime From ef4a3abc587175275058efc29f4639898982d521 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 16:46:09 +0500 Subject: [PATCH 54/83] fixes. --- Scripts/build_all.sh | 2 +- Scripts/prepare_simulator.sh | 2 -- Scripts/run_prep.sh | 2 +- Scripts/run_unit_tests.sh | 2 +- Scripts/test_all.sh | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Scripts/build_all.sh b/Scripts/build_all.sh index d5e7b960..a01bc8d0 100755 --- a/Scripts/build_all.sh +++ b/Scripts/build_all.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e ################################################################ # buildall.sh ################################################################ diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index d1bde3db..d6362a24 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -33,8 +33,6 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="${os_folder}.platform/Library/Developer" fi - echo "=======$SIMULATOR_XCODE_VERSION========" - # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" diff --git a/Scripts/run_prep.sh b/Scripts/run_prep.sh index 7209e9ca..d83e8ebf 100755 --- a/Scripts/run_prep.sh +++ b/Scripts/run_prep.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash -e set -e # Because `hub` is used, this script expects the following environment variables defined in travis job settings: diff --git a/Scripts/run_unit_tests.sh b/Scripts/run_unit_tests.sh index bea41425..1a7e63f4 100755 --- a/Scripts/run_unit_tests.sh +++ b/Scripts/run_unit_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # run xcode unit tests # diff --git a/Scripts/test_all.sh b/Scripts/test_all.sh index 4efa5f88..1de656c3 100755 --- a/Scripts/test_all.sh +++ b/Scripts/test_all.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash -e deviceModels=("iPhone SE" "iPhone 8" "iPhone 11" "Apple TV" "Apple TV" "Apple TV 4K") osVersions=("12.4" "13.3" "14.4" "12.4" "13.3" "14.3") xcodeVersions=("10.3" "11.3.1" "12.4" "10.3" "11.3.1" "12.4") From 1cb750454aad0888d56e41d1d6ac3bf55a23173d Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 17:32:37 +0500 Subject: [PATCH 55/83] testing. --- .github/workflows/swift.yml | 63 +++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 7718ab57..ebc4be6a 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -1,10 +1,15 @@ name: Swift - on: push: branches: [ master ] pull_request: branches: [ master ] + workflow_dispatch: + inputs: + SNAPSHOT: + required: false + type: boolean + description: Set SNAPSHOT true to publish jobs: @@ -12,6 +17,7 @@ jobs: uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction integration_tests: + if: ${{ (secrets.RUN_COMPAT_SUITE == true) && (secrets.PREP == null) && (secrets.RELEASE == null) }} uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} @@ -32,34 +38,37 @@ jobs: curl -sSL https://download.sourceclear.com/ci.sh | bash unittests: + if: ${{ (secrets.PREP == null) && (secrets.RELEASE == null) }} uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction secrets: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - prepare_for_release: - uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction - secrets: - CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + # prepare_for_release: + # if: ${{ (secrets.PREP == true) && (github.event.inputs.SNAPSHOT == 'true') && (github.event_name == 'workflow_dispatch') }} + # uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction + # secrets: + # CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} - release: - runs-on: macos-latest - steps: - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - uses: actions/checkout@v3 - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '12.4' - - name: Push to cocoapods.org - env: - VERSION: 3.10.1 - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - run: | - gem install cocoapods -v '1.9.3' - Scripts/run_release.sh + # release: + # if: ${{ (secrets.RELEASE == true) && (github.event.inputs.SNAPSHOT == 'true') && (github.event_name == 'workflow_dispatch') }} + # runs-on: macos-latest + # steps: + # - name: set SDK Branch if PR + # if: ${{ github.event_name == 'pull_request' }} + # run: | + # echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + # - name: set SDK Branch if not pull request + # if: ${{ github.event_name != 'pull_request' }} + # run: | + # echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + # - uses: actions/checkout@v3 + # - uses: maxim-lobanov/setup-xcode@v1 + # with: + # xcode-version: '12.4' + # - name: Push to cocoapods.org + # env: + # VERSION: 3.10.1 + # GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + # run: | + # gem install cocoapods -v '1.9.3' + # Scripts/run_release.sh From c452932f4b324ddedc844c6d11024a797dd718c5 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 17:35:01 +0500 Subject: [PATCH 56/83] fixes --- .github/workflows/swift.yml | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index ebc4be6a..17c15539 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -43,32 +43,32 @@ jobs: secrets: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - # prepare_for_release: - # if: ${{ (secrets.PREP == true) && (github.event.inputs.SNAPSHOT == 'true') && (github.event_name == 'workflow_dispatch') }} - # uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction - # secrets: - # CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + prepare_for_release: + if: ${{ (secrets.PREP == true) && (github.event.inputs.SNAPSHOT == 'true') && (github.event_name == 'workflow_dispatch') }} + uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} - # release: - # if: ${{ (secrets.RELEASE == true) && (github.event.inputs.SNAPSHOT == 'true') && (github.event_name == 'workflow_dispatch') }} - # runs-on: macos-latest - # steps: - # - name: set SDK Branch if PR - # if: ${{ github.event_name == 'pull_request' }} - # run: | - # echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - # - name: set SDK Branch if not pull request - # if: ${{ github.event_name != 'pull_request' }} - # run: | - # echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - # - uses: actions/checkout@v3 - # - uses: maxim-lobanov/setup-xcode@v1 - # with: - # xcode-version: '12.4' - # - name: Push to cocoapods.org - # env: - # VERSION: 3.10.1 - # GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - # run: | - # gem install cocoapods -v '1.9.3' - # Scripts/run_release.sh + release: + if: ${{ (secrets.RELEASE == true) && (github.event.inputs.SNAPSHOT == 'true') && (github.event_name == 'workflow_dispatch') }} + runs-on: macos-latest + steps: + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: actions/checkout@v3 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '12.4' + - name: Push to cocoapods.org + env: + VERSION: 3.10.1 + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + run: | + gem install cocoapods -v '1.9.3' + Scripts/run_release.sh From b9739f73c5119fdec86658453a56b0bb3e720dcf Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 17:37:44 +0500 Subject: [PATCH 57/83] fixes. --- .github/workflows/swift.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 17c15539..c9cd0053 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -1,4 +1,5 @@ name: Swift + on: push: branches: [ master ] @@ -7,7 +8,6 @@ on: workflow_dispatch: inputs: SNAPSHOT: - required: false type: boolean description: Set SNAPSHOT true to publish @@ -17,7 +17,7 @@ jobs: uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction integration_tests: - if: ${{ (secrets.RUN_COMPAT_SUITE == true) && (secrets.PREP == null) && (secrets.RELEASE == null) }} + if: ${{ secrets.RUN_COMPAT_SUITE == 'true' && secrets.PREP == null && secrets.RELEASE == null }} uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} @@ -44,13 +44,13 @@ jobs: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} prepare_for_release: - if: ${{ (secrets.PREP == true) && (github.event.inputs.SNAPSHOT == 'true') && (github.event_name == 'workflow_dispatch') }} + if: ${{ secrets.PREP == true && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} release: - if: ${{ (secrets.RELEASE == true) && (github.event.inputs.SNAPSHOT == 'true') && (github.event_name == 'workflow_dispatch') }} + if: ${{ secrets.RELEASE == true && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} runs-on: macos-latest steps: - name: set SDK Branch if PR From f3eabe7f0f5ee046354d8743b0d34d21d15550d7 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 17:40:56 +0500 Subject: [PATCH 58/83] fixes --- .github/workflows/swift.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index c9cd0053..b9e01cb0 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -8,8 +8,9 @@ on: workflow_dispatch: inputs: SNAPSHOT: + required: false type: boolean - description: Set SNAPSHOT true to publish + description: 'Set SNAPSHOT true to publish' jobs: @@ -17,7 +18,7 @@ jobs: uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction integration_tests: - if: ${{ secrets.RUN_COMPAT_SUITE == 'true' && secrets.PREP == null && secrets.RELEASE == null }} + # if: ${{ secrets.RUN_COMPAT_SUITE == 'true' && secrets.PREP == null && secrets.RELEASE == null }} uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} @@ -44,13 +45,13 @@ jobs: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} prepare_for_release: - if: ${{ secrets.PREP == true && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + # if: ${{ secrets.PREP == true && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} release: - if: ${{ secrets.RELEASE == true && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + # if: ${{ secrets.RELEASE == true && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} runs-on: macos-latest steps: - name: set SDK Branch if PR From c16d6e6832b5c4232b73e86f6aef0b3e6cf914d8 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 17:43:33 +0500 Subject: [PATCH 59/83] fixes --- .github/workflows/swift.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index b9e01cb0..6f8cccba 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -8,9 +8,9 @@ on: workflow_dispatch: inputs: SNAPSHOT: - required: false + required: false type: boolean - description: 'Set SNAPSHOT true to publish' + description: Set SNAPSHOT true to publish jobs: @@ -39,7 +39,7 @@ jobs: curl -sSL https://download.sourceclear.com/ci.sh | bash unittests: - if: ${{ (secrets.PREP == null) && (secrets.RELEASE == null) }} + # if: ${{ secrets.PREP == null && secrets.RELEASE == null }} uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction secrets: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} From 14d79731b32479797c007dd4e7b464f716bae759 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 18:07:51 +0500 Subject: [PATCH 60/83] fixes. --- .github/workflows/integration_tests.yml | 12 ++++- .github/workflows/prepare_for_release.yml | 40 ----------------- .github/workflows/swift.yml | 55 ++++++++++++++++++----- .github/workflows/unit_tests.yml | 8 ++++ 4 files changed, 64 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/prepare_for_release.yml diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index a4871b63..cfb2e9f0 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -7,10 +7,20 @@ on: required: true TRAVIS_COM_TOKEN: required: true + RUN_COMPAT_SUITE: + required: true + PREP: + required: true + RELEASE: + required: true jobs: integration_tests: - if: ${{ github.event.inputs.SNAPSHOT != 'true' }} + env: + PREP: ${{ secrets.PREP }} + RELEASE: ${{ secrets.RELEASE }} + RUN_COMPAT_SUITE: ${{ secrets.RUN_COMPAT_SUITE }} + if: ${{ env.RUN_COMPAT_SUITE == 'true' && env.PREP == '' && env.RELEASE == '' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml deleted file mode 100644 index 91df7af9..00000000 --- a/.github/workflows/prepare_for_release.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Reusable action of Preparing for release - -on: - workflow_call: - secrets: - CI_USER_TOKEN: - required: true - -jobs: - prepare_for_release: - runs-on: macos-latest - steps: - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - uses: maxim-lobanov/setup-xcode@v1 - - uses: actions/checkout@v3 - with: - xcode-version: '12.4' - - id: prepare_for_release - name: Prepare for release - env: - VERSION: 3.10.1 - HOME: 'home/runner' - TRAVIS_REPO_SLUG: ${{ github.repository }} - GITHUB_USER: optibot - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - run: | - gem install cocoapods -v '1.9.3' - Scripts/run_prep.sh - - name: Check prepare for release failure - if: steps.prepare_for_release.outcome != 'success' - run: cat /tmp/build.out \ No newline at end of file diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 6f8cccba..bc8169fd 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -18,11 +18,14 @@ jobs: uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction integration_tests: - # if: ${{ secrets.RUN_COMPAT_SUITE == 'true' && secrets.PREP == null && secrets.RELEASE == null }} + if: ${{ github.event.inputs.SNAPSHOT != 'true' }} uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + RUN_COMPAT_SUITE: ${{ secrets.RUN_COMPAT_SUITE }} + PREP: ${{ secrets.PREP }} + RELEASE: ${{ secrets.RELEASE }} lint: runs-on: macos-latest @@ -38,20 +41,52 @@ jobs: pod spec lint --quick curl -sSL https://download.sourceclear.com/ci.sh | bash - unittests: - # if: ${{ secrets.PREP == null && secrets.RELEASE == null }} + unittests: uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction secrets: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + PREP: ${{ secrets.PREP }} + RELEASE: ${{ secrets.RELEASE }} - prepare_for_release: - # if: ${{ secrets.PREP == true && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} - uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction - secrets: - CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + prepare_for_release: + env: + PREP: ${{ secrets.PREP }} + if: ${{ env.PREP == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + runs-on: macos-latest + steps: + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: maxim-lobanov/setup-xcode@v1 + - uses: actions/checkout@v3 + with: + xcode-version: '12.4' + - id: prepare_for_release + name: Prepare for release + env: + VERSION: 3.10.1 + HOME: 'home/runner' + TRAVIS_REPO_SLUG: ${{ github.repository }} + GITHUB_USER: optibot + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + run: | + gem install cocoapods -v '1.9.3' + Scripts/run_prep.sh + - name: Check prepare for release failure + if: steps.prepare_for_release.outcome != 'success' + run: cat /tmp/build.out - release: - # if: ${{ secrets.RELEASE == true && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + release: + env: + RELEASE: ${{ secrets.RELEASE }} + if: ${{ env.RELEASE == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} runs-on: macos-latest steps: - name: set SDK Branch if PR diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c41820a5..e751cda6 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -5,9 +5,17 @@ on: secrets: COVERALLS_TOKEN: required: true + PREP: + required: true + RELEASE: + required: true jobs: unittests: + env: + PREP: ${{ secrets.PREP }} + RELEASE: ${{ secrets.RELEASE }} + if: ${{ env.PREP == '' && env.RELEASE == '' }} runs-on: macos-10.15 strategy: fail-fast: false From 86c6b88d1122577391c3615e8e425664a910cda1 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 18:15:19 +0500 Subject: [PATCH 61/83] fixes. --- .github/workflows/integration_tests.yml | 2 +- .github/workflows/swift.yml | 4 ++-- .github/workflows/unit_tests.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index cfb2e9f0..2db972fb 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -20,7 +20,7 @@ jobs: PREP: ${{ secrets.PREP }} RELEASE: ${{ secrets.RELEASE }} RUN_COMPAT_SUITE: ${{ secrets.RUN_COMPAT_SUITE }} - if: ${{ env.RUN_COMPAT_SUITE == 'true' && env.PREP == '' && env.RELEASE == '' }} + if: "${{ env.RUN_COMPAT_SUITE == 'true' && env.PREP == '' && env.RELEASE == '' }}" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index bc8169fd..8be1415f 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -51,7 +51,7 @@ jobs: prepare_for_release: env: PREP: ${{ secrets.PREP }} - if: ${{ env.PREP == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + if: "${{ env.PREP == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" runs-on: macos-latest steps: - name: set SDK Branch if PR @@ -86,7 +86,7 @@ jobs: release: env: RELEASE: ${{ secrets.RELEASE }} - if: ${{ env.RELEASE == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + if: "${{ env.RELEASE == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" runs-on: macos-latest steps: - name: set SDK Branch if PR diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index e751cda6..6eeaa33e 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -15,7 +15,7 @@ jobs: env: PREP: ${{ secrets.PREP }} RELEASE: ${{ secrets.RELEASE }} - if: ${{ env.PREP == '' && env.RELEASE == '' }} + if: "${{ env.PREP == '' && env.RELEASE == '' }}" runs-on: macos-10.15 strategy: fail-fast: false From 0fdf4c5fb9f043e5850ae66cb325418aa43db3fa Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 18:32:36 +0500 Subject: [PATCH 62/83] fixes --- .github/workflows/integration_tests.yml | 9 ++++----- .github/workflows/swift.yml | 5 ++--- .github/workflows/unit_tests.yml | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 2db972fb..895b9910 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -16,11 +16,6 @@ on: jobs: integration_tests: - env: - PREP: ${{ secrets.PREP }} - RELEASE: ${{ secrets.RELEASE }} - RUN_COMPAT_SUITE: ${{ secrets.RUN_COMPAT_SUITE }} - if: "${{ env.RUN_COMPAT_SUITE == 'true' && env.PREP == '' && env.RELEASE == '' }}" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -59,6 +54,10 @@ jobs: TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} EVENT_MESSAGE: ${{ github.event.message }} HOME: 'home/runner' + PREP: ${{ secrets.PREP }} + RELEASE: ${{ secrets.RELEASE }} + RUN_COMPAT_SUITE: ${{ secrets.RUN_COMPAT_SUITE }} + if: "${{ env.RUN_COMPAT_SUITE == 'true' && env.PREP == '' && env.RELEASE == '' }}" run: | echo "$GITHUB_CONTEXT" home/runner/travisci-tools/trigger-script-with-status-update.sh \ No newline at end of file diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 8be1415f..22760cfb 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -49,9 +49,6 @@ jobs: RELEASE: ${{ secrets.RELEASE }} prepare_for_release: - env: - PREP: ${{ secrets.PREP }} - if: "${{ env.PREP == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" runs-on: macos-latest steps: - name: set SDK Branch if PR @@ -76,6 +73,8 @@ jobs: TRAVIS_REPO_SLUG: ${{ github.repository }} GITHUB_USER: optibot GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + PREP: ${{ secrets.PREP }} + if: "${{ env.PREP == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" run: | gem install cocoapods -v '1.9.3' Scripts/run_prep.sh diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 6eeaa33e..09e4283e 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -12,10 +12,6 @@ on: jobs: unittests: - env: - PREP: ${{ secrets.PREP }} - RELEASE: ${{ secrets.RELEASE }} - if: "${{ env.PREP == '' && env.RELEASE == '' }}" runs-on: macos-10.15 strategy: fail-fast: false @@ -66,6 +62,8 @@ jobs: echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - id: unit_tests env: + PREP: ${{ secrets.PREP }} + RELEASE: ${{ secrets.RELEASE }} COVERAGE_DIR: ./COVERAGE SCHEME: ${{ matrix.scheme }} TEST_SDK: ${{ matrix.test_sdk }} @@ -75,6 +73,7 @@ jobs: SIMULATOR_XCODE_VERSION: ${{ matrix.simulator_xcode_version }} NAME: ${{ matrix.device }} COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + if: "${{ env.PREP == '' && env.RELEASE == '' }}" run: | gem install coveralls-lcov gem install cocoapods -v '1.9.3' From 3b3e1572c17763cd4818f4876dffbd5fe718f19f Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 18:34:27 +0500 Subject: [PATCH 63/83] fixes. --- .github/workflows/swift.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 22760cfb..f32eb6c7 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -83,9 +83,6 @@ jobs: run: cat /tmp/build.out release: - env: - RELEASE: ${{ secrets.RELEASE }} - if: "${{ env.RELEASE == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" runs-on: macos-latest steps: - name: set SDK Branch if PR @@ -104,6 +101,8 @@ jobs: env: VERSION: 3.10.1 GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + RELEASE: ${{ secrets.RELEASE }} + if: "${{ env.RELEASE == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" run: | gem install cocoapods -v '1.9.3' Scripts/run_release.sh From 8b0cd39f9816dc4268ef89f23a196b3f3304bfea Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 19:16:54 +0500 Subject: [PATCH 64/83] debug. --- .github/workflows/swift.yml | 6 +++--- Scripts/prepare_simulator.sh | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index f32eb6c7..c0da0343 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -65,7 +65,8 @@ jobs: - uses: actions/checkout@v3 with: xcode-version: '12.4' - - id: prepare_for_release + - if: "${{ env.PREP == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" + id: prepare_for_release name: Prepare for release env: VERSION: 3.10.1 @@ -74,12 +75,11 @@ jobs: GITHUB_USER: optibot GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} PREP: ${{ secrets.PREP }} - if: "${{ env.PREP == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" run: | gem install cocoapods -v '1.9.3' Scripts/run_prep.sh - name: Check prepare for release failure - if: steps.prepare_for_release.outcome != 'success' + if: steps.prepare_for_release.conclusion == 'failure' run: cat /tmp/build.out release: diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index d6362a24..c4d48c81 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -33,6 +33,8 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="${os_folder}.platform/Library/Developer" fi + echo "====$SIMULATOR_XCODE_VERSION====$name====$os_folder====$OS_TYPE====$os" + # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" From 1ffdadafe64b8bf8c72acb951e3bcfe55661dde9 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 19:21:20 +0500 Subject: [PATCH 65/83] fixes. --- Scripts/prepare_simulator.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index c4d48c81..b96ac537 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -33,15 +33,10 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="${os_folder}.platform/Library/Developer" fi - echo "====$SIMULATOR_XCODE_VERSION====$name====$os_folder====$OS_TYPE====$os" - # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" - UDID="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" -else - echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file - UDID=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) fi -echo "$UDID" +echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file +echo $( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) From 76f75ade994eb6d845f853599ef114acd483e14f Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 19:27:47 +0500 Subject: [PATCH 66/83] testing. --- Scripts/prepare_simulator.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index b96ac537..38fd8736 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -38,5 +38,17 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" fi +# prep jq arg because it doesnt allow parameter expansion within its single quotes echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file -echo $( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) +simulator=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) +xcrun xctrace list devices + +if [ -z $simulator ]; then + echo "The requested simulator ($PLATFORM $OS $NAME) cannot be found." + #xcrun instruments -s device + xcrun xctrace list devices + sleep 3 + exit 1 +fi + +echo "$simulator" From c53ba93d9f64bde98d69cb95552bac6ad422cdf8 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 19:41:56 +0500 Subject: [PATCH 67/83] fixes. --- Scripts/prepare_simulator.sh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index 38fd8736..3d21e918 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -35,20 +35,8 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime - xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" + echo $(xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os") fi -# prep jq arg because it doesnt allow parameter expansion within its single quotes echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file -simulator=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) -xcrun xctrace list devices - -if [ -z $simulator ]; then - echo "The requested simulator ($PLATFORM $OS $NAME) cannot be found." - #xcrun instruments -s device - xcrun xctrace list devices - sleep 3 - exit 1 -fi - -echo "$simulator" +echo $( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) From 49c1fd8b52c2cdaaee48fb44d0cdf844dcf8b12a Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 19:47:34 +0500 Subject: [PATCH 68/83] testing. --- .github/workflows/unit_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 09e4283e..03d0cb53 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -80,7 +80,7 @@ jobs: pod repo update pod install HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq - SIMULATOR_UDID=$(Scripts/prepare_simulator.sh) + SIMULATOR_UDID="$(Scripts/prepare_simulator.sh)" xcrun simctl boot $SIMULATOR_UDID && sleep 30 xcrun simctl list | grep Booted Scripts/run_unit_tests.sh From 8cfa44891fe30440392506425c5b686ff9c9c4ea Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 18 Apr 2022 20:32:59 +0500 Subject: [PATCH 69/83] testing. --- .github/workflows/unit_tests.yml | 4 +--- Scripts/prepare_simulator.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 03d0cb53..c0863644 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -80,9 +80,7 @@ jobs: pod repo update pod install HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq - SIMULATOR_UDID="$(Scripts/prepare_simulator.sh)" - xcrun simctl boot $SIMULATOR_UDID && sleep 30 - xcrun simctl list | grep Booted + Scripts/prepare_simulator.sh Scripts/run_unit_tests.sh - name: Check on failures if: steps.unit_tests.outcome != 'success' diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index 3d21e918..51664476 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -35,8 +35,11 @@ if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then # Link and create simulators from older xcode versions which are not part of the current xcode version sudo ln -s /Applications/Xcode_$SIMULATOR_XCODE_VERSION.app/Contents/Developer/Platforms/$os_folder/CoreSimulator/Profiles/Runtimes/$OS_TYPE.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/$OS_TYPE\ $OS.simruntime - echo $(xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os") + xcrun simctl create "custom-device" "com.apple.CoreSimulator.SimDeviceType.$name" "com.apple.CoreSimulator.SimRuntime.$OS_TYPE-$os" + CUSTOM_SIMULATOR="$(instruments -s devices | grep -m 1 'custom-device' | awk -F'[][]' '{print $2}')" +else + echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file + CUSTOM_SIMULATOR=$( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) fi - -echo ".devices.\"com.apple.CoreSimulator.SimRuntime.${PLATFORM/ Simulator/}-${OS/./-}\"" > /tmp/jq_file -echo $( xcrun simctl list --json devices | jq -f /tmp/jq_file | jq -r '.[] | select(.name==env.NAME) | .udid' ) +xcrun simctl boot $CUSTOM_SIMULATOR && sleep 30 +xcrun simctl list | grep Booted From 2c8415c28f58a18a33085d29c3792f708339b32b Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Tue, 19 Apr 2022 12:57:46 +0500 Subject: [PATCH 70/83] fixes --- .github/workflows/integration_tests.yml | 6 ++-- .github/workflows/prepare_for_release.yml | 44 +++++++++++++++++++++++ .github/workflows/swift.yml | 42 +++++----------------- .github/workflows/unit_tests.yml | 4 +-- Scripts/build_all.sh | 2 +- Scripts/prepare_simulator.sh | 5 +-- Scripts/test_all.sh | 5 +++ 7 files changed, 66 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/prepare_for_release.yml diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 895b9910..6e3b2abd 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -10,9 +10,9 @@ on: RUN_COMPAT_SUITE: required: true PREP: - required: true + required: false RELEASE: - required: true + required: false jobs: integration_tests: @@ -29,7 +29,7 @@ jobs: if: ${{ github.event_name == 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml new file mode 100644 index 00000000..a31803ba --- /dev/null +++ b/.github/workflows/prepare_for_release.yml @@ -0,0 +1,44 @@ +name: Reusable action of Release preparation + +on: + workflow_call: + secrets: + CI_USER_TOKEN: + required: true + PREP: + required: false + +jobs: + prepare_for_release: + runs-on: macos-latest + steps: + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: maxim-lobanov/setup-xcode@v1 + - uses: actions/checkout@v3 + with: + xcode-version: '12.4' + - id: prepare_for_release + name: Prepare for release + env: + VERSION: 3.10.1 + HOME: 'home/runner' + TRAVIS_REPO_SLUG: ${{ github.repository }} + GITHUB_USER: optibot + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + PREP: ${{ secrets.PREP }} + if: "${{ env.PREP == 'true' }}" + run: | + gem install cocoapods -v '1.9.3' + Scripts/run_prep.sh + - name: Check prepare for release failure + if: steps.prepare_for_release.conclusion == 'failure' + run: cat /tmp/build.out \ No newline at end of file diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index c0da0343..dd711cd9 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -48,41 +48,15 @@ jobs: PREP: ${{ secrets.PREP }} RELEASE: ${{ secrets.RELEASE }} - prepare_for_release: - runs-on: macos-latest - steps: - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - - uses: maxim-lobanov/setup-xcode@v1 - - uses: actions/checkout@v3 - with: - xcode-version: '12.4' - - if: "${{ env.PREP == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" - id: prepare_for_release - name: Prepare for release - env: - VERSION: 3.10.1 - HOME: 'home/runner' - TRAVIS_REPO_SLUG: ${{ github.repository }} - GITHUB_USER: optibot - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - PREP: ${{ secrets.PREP }} - run: | - gem install cocoapods -v '1.9.3' - Scripts/run_prep.sh - - name: Check prepare for release failure - if: steps.prepare_for_release.conclusion == 'failure' - run: cat /tmp/build.out + prepare_for_release: + if: "${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" + uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction + secrets: + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + PREP: ${{ secrets.PREP }} release: + if: "${{github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" runs-on: macos-latest steps: - name: set SDK Branch if PR @@ -102,7 +76,7 @@ jobs: VERSION: 3.10.1 GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} RELEASE: ${{ secrets.RELEASE }} - if: "${{ env.RELEASE == 'true' && github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" + if: "${{ env.RELEASE == 'true' }}" run: | gem install cocoapods -v '1.9.3' Scripts/run_release.sh diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c0863644..c75c26ec 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -6,9 +6,9 @@ on: COVERALLS_TOKEN: required: true PREP: - required: true + required: false RELEASE: - required: true + required: false jobs: unittests: diff --git a/Scripts/build_all.sh b/Scripts/build_all.sh index a01bc8d0..d5e7b960 100755 --- a/Scripts/build_all.sh +++ b/Scripts/build_all.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash ################################################################ # buildall.sh ################################################################ diff --git a/Scripts/prepare_simulator.sh b/Scripts/prepare_simulator.sh index 51664476..3f2dba41 100755 --- a/Scripts/prepare_simulator.sh +++ b/Scripts/prepare_simulator.sh @@ -7,9 +7,10 @@ set -eou pipefail # NAME (eg. iPad Air) # OS_TYPE (eg. iOS) # SIMULATOR_XCODE_VERSION (Which Xcode's simulator to use) -# Since github actions only provide limit simulators with each xcode, we need to link simulators from other versions of xcode to be used by current xcode. -# We must use old simulators with current xcode since old xcode doesnot support swift 5 required by Swift SDK. +# Since github actions only provides limit simulators with each xcode, we need to link simulators from other versions of xcode to be used by current xcode. +# We must use old simulators with current xcode since older xcode versions do not support swift 5 which is required by Swift SDK. # More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md +# https://github.com/actions/virtual-environments/issues/551 if [ "$SIMULATOR_XCODE_VERSION" != 12.4 ]; then os_folder="iPhoneOS" diff --git a/Scripts/test_all.sh b/Scripts/test_all.sh index 1de656c3..08c1f58c 100755 --- a/Scripts/test_all.sh +++ b/Scripts/test_all.sh @@ -1,4 +1,9 @@ #!/bin/bash -e +# Since github actions only provides limit simulators with each xcode, we need to link simulators from other versions of xcode to be used by current xcode. +# We must use old simulators with current xcode since older xcode versions do not support swift 5 which is required by Swift SDK. +# More about XCode and its compatible simulators can be found here: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md +# https://github.com/actions/virtual-environments/issues/551 + deviceModels=("iPhone SE" "iPhone 8" "iPhone 11" "Apple TV" "Apple TV" "Apple TV 4K") osVersions=("12.4" "13.3" "14.4" "12.4" "13.3" "14.3") xcodeVersions=("10.3" "11.3.1" "12.4" "10.3" "11.3.1" "12.4") From b6a9634258926633b6c5648da5ea6f76b36c96eb Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Tue, 19 Apr 2022 13:18:36 +0500 Subject: [PATCH 71/83] cleanup. --- .github/workflows/integration_tests.yml | 5 +---- .github/workflows/swift.yml | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 6e3b2abd..862c4303 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -7,8 +7,6 @@ on: required: true TRAVIS_COM_TOKEN: required: true - RUN_COMPAT_SUITE: - required: true PREP: required: false RELEASE: @@ -56,8 +54,7 @@ jobs: HOME: 'home/runner' PREP: ${{ secrets.PREP }} RELEASE: ${{ secrets.RELEASE }} - RUN_COMPAT_SUITE: ${{ secrets.RUN_COMPAT_SUITE }} - if: "${{ env.RUN_COMPAT_SUITE == 'true' && env.PREP == '' && env.RELEASE == '' }}" + if: "${{ env.PREP == '' && env.RELEASE == '' }}" run: | echo "$GITHUB_CONTEXT" home/runner/travisci-tools/trigger-script-with-status-update.sh \ No newline at end of file diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index dd711cd9..d45e207e 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -23,7 +23,6 @@ jobs: secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - RUN_COMPAT_SUITE: ${{ secrets.RUN_COMPAT_SUITE }} PREP: ${{ secrets.PREP }} RELEASE: ${{ secrets.RELEASE }} From 39b7edd1ccec3c115dace76c858caa1214ce27ef Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Wed, 20 Apr 2022 12:50:11 +0500 Subject: [PATCH 72/83] Suggested changes made. --- .github/workflows/integration_tests.yml | 11 +------- .github/workflows/lint_markdown.yml | 2 +- .github/workflows/prepare_for_release.yml | 17 ++----------- .github/workflows/source_clear_cron.yml | 2 +- .github/workflows/swift.yml | 31 ++++++++--------------- .github/workflows/unit_tests.yml | 11 +------- 6 files changed, 17 insertions(+), 57 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 862c4303..3ac839bb 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -7,10 +7,6 @@ on: required: true TRAVIS_COM_TOKEN: required: true - PREP: - required: false - RELEASE: - required: false jobs: integration_tests: @@ -41,7 +37,6 @@ jobs: TESTAPP_BRANCH: master GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_EVENT_TYPE: ${{ github.event_name }} - GITHUB_CONTEXT: ${{ toJson(github) }} TRAVIS_REPO_SLUG: ${{ github.repository }} TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} UPSTREAM_REPO: ${{ github.repository }} @@ -52,9 +47,5 @@ jobs: TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} EVENT_MESSAGE: ${{ github.event.message }} HOME: 'home/runner' - PREP: ${{ secrets.PREP }} - RELEASE: ${{ secrets.RELEASE }} - if: "${{ env.PREP == '' && env.RELEASE == '' }}" run: | - echo "$GITHUB_CONTEXT" - home/runner/travisci-tools/trigger-script-with-status-update.sh \ No newline at end of file + home/runner/travisci-tools/trigger-script-with-status-update.sh diff --git a/.github/workflows/lint_markdown.yml b/.github/workflows/lint_markdown.yml index cf002b7f..e3e90314 100644 --- a/.github/workflows/lint_markdown.yml +++ b/.github/workflows/lint_markdown.yml @@ -6,7 +6,7 @@ jobs: lint_markdown: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml index a31803ba..418a5a35 100644 --- a/.github/workflows/prepare_for_release.yml +++ b/.github/workflows/prepare_for_release.yml @@ -5,23 +5,11 @@ on: secrets: CI_USER_TOKEN: required: true - PREP: - required: false jobs: prepare_for_release: runs-on: macos-latest steps: - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - uses: maxim-lobanov/setup-xcode@v1 - uses: actions/checkout@v3 with: @@ -32,13 +20,12 @@ jobs: VERSION: 3.10.1 HOME: 'home/runner' TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_BRANCH: ${{ github.ref_name }} GITHUB_USER: optibot GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - PREP: ${{ secrets.PREP }} - if: "${{ env.PREP == 'true' }}" run: | gem install cocoapods -v '1.9.3' Scripts/run_prep.sh - name: Check prepare for release failure if: steps.prepare_for_release.conclusion == 'failure' - run: cat /tmp/build.out \ No newline at end of file + run: cat /tmp/build.out diff --git a/.github/workflows/source_clear_cron.yml b/.github/workflows/source_clear_cron.yml index 884cd2f0..4a9b2dcf 100644 --- a/.github/workflows/source_clear_cron.yml +++ b/.github/workflows/source_clear_cron.yml @@ -11,7 +11,7 @@ jobs: source_clear: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Source clear scan env: SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }} diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index d45e207e..e7628d37 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -7,10 +7,14 @@ on: branches: [ master ] workflow_dispatch: inputs: - SNAPSHOT: + PREP: required: false type: boolean - description: Set SNAPSHOT true to publish + description: prepare to release + RELEASE: + required: false + type: boolean + description: release jobs: @@ -18,13 +22,11 @@ jobs: uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction integration_tests: - if: ${{ github.event.inputs.SNAPSHOT != 'true' }} + if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}" uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} - PREP: ${{ secrets.PREP }} - RELEASE: ${{ secrets.RELEASE }} lint: runs-on: macos-latest @@ -41,31 +43,21 @@ jobs: curl -sSL https://download.sourceclear.com/ci.sh | bash unittests: + if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}" uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction secrets: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - PREP: ${{ secrets.PREP }} - RELEASE: ${{ secrets.RELEASE }} prepare_for_release: - if: "${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" + if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}" uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} - PREP: ${{ secrets.PREP }} release: - if: "${{github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}" + if: "${{github.event.inputs.RELEASE == 'true' && github.event_name == 'workflow_dispatch' }}" runs-on: macos-latest steps: - - name: set SDK Branch if PR - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - - name: set SDK Branch if not pull request - if: ${{ github.event_name != 'pull_request' }} - run: | - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: @@ -74,8 +66,7 @@ jobs: env: VERSION: 3.10.1 GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - RELEASE: ${{ secrets.RELEASE }} - if: "${{ env.RELEASE == 'true' }}" + TRAVIS_BRANCH: ${{ github.ref_name }} run: | gem install cocoapods -v '1.9.3' Scripts/run_release.sh diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c75c26ec..629501bd 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -5,10 +5,6 @@ on: secrets: COVERALLS_TOKEN: required: true - PREP: - required: false - RELEASE: - required: false jobs: unittests: @@ -53,17 +49,13 @@ jobs: - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | - echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | - echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - id: unit_tests env: - PREP: ${{ secrets.PREP }} - RELEASE: ${{ secrets.RELEASE }} COVERAGE_DIR: ./COVERAGE SCHEME: ${{ matrix.scheme }} TEST_SDK: ${{ matrix.test_sdk }} @@ -73,7 +65,6 @@ jobs: SIMULATOR_XCODE_VERSION: ${{ matrix.simulator_xcode_version }} NAME: ${{ matrix.device }} COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - if: "${{ env.PREP == '' && env.RELEASE == '' }}" run: | gem install coveralls-lcov gem install cocoapods -v '1.9.3' @@ -92,4 +83,4 @@ jobs: if: steps.unit_tests.outcome == 'success' run: | Scripts/upload_coveralls.sh - sleep 5 \ No newline at end of file + sleep 5 From f0e90c6a89e44068fb7517544f46b466ca5da330 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Wed, 20 Apr 2022 16:17:30 +0500 Subject: [PATCH 73/83] fix coveralls. --- .github/workflows/unit_tests.yml | 5 +++++ Scripts/upload_coveralls.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 629501bd..3c21f66f 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -80,6 +80,11 @@ jobs: artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" - name: Check on success + env: + COVERAGE_DIR: ./COVERAGE + PLATFORM: ${{ matrix.platform }} + NAME: ${{ matrix.device }} + COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} if: steps.unit_tests.outcome == 'success' run: | Scripts/upload_coveralls.sh diff --git a/Scripts/upload_coveralls.sh b/Scripts/upload_coveralls.sh index c74239c1..ebe37e7b 100755 --- a/Scripts/upload_coveralls.sh +++ b/Scripts/upload_coveralls.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # upload_coveralls.sh # From c97248d77267d936c45ba0b68ecdce79a761697e Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 21 Apr 2022 11:49:14 +0500 Subject: [PATCH 74/83] Testing coveralls. --- .github/workflows/swift.yml | 2 +- .github/workflows/unit_tests.yml | 16 ++++++++++------ ..._coveralls.sh => prepare_coveralls_report.sh} | 7 ++----- 3 files changed, 13 insertions(+), 12 deletions(-) rename Scripts/{upload_coveralls.sh => prepare_coveralls_report.sh} (84%) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index e7628d37..fb88c719 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -46,7 +46,7 @@ jobs: if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}" uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction secrets: - COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} prepare_for_release: if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}" diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 3c21f66f..471e9f27 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -3,7 +3,7 @@ name: Reusable action of Unit tests on: workflow_call: secrets: - COVERALLS_TOKEN: + CI_USER_TOKEN: required: true jobs: @@ -64,7 +64,6 @@ jobs: OS_TYPE: ${{ matrix.os_type }} SIMULATOR_XCODE_VERSION: ${{ matrix.simulator_xcode_version }} NAME: ${{ matrix.device }} - COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} run: | gem install coveralls-lcov gem install cocoapods -v '1.9.3' @@ -79,13 +78,18 @@ jobs: sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" - - name: Check on success + - if: steps.unit_tests.outcome == 'success' + id: coveralls + name: Check on success env: COVERAGE_DIR: ./COVERAGE PLATFORM: ${{ matrix.platform }} NAME: ${{ matrix.device }} - COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - if: steps.unit_tests.outcome == 'success' run: | - Scripts/upload_coveralls.sh + Scripts/prepare_coveralls_report.sh sleep 5 + - if: steps.coveralls.outcome == 'success' + name: Upload coveralls report + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.CI_USER_TOKEN }} diff --git a/Scripts/upload_coveralls.sh b/Scripts/prepare_coveralls_report.sh similarity index 84% rename from Scripts/upload_coveralls.sh rename to Scripts/prepare_coveralls_report.sh index ebe37e7b..2a61f7d6 100755 --- a/Scripts/upload_coveralls.sh +++ b/Scripts/prepare_coveralls_report.sh @@ -1,9 +1,9 @@ #!/bin/bash -e -# upload_coveralls.sh +# prepare_coveralls_report.sh # # Usage: -# $ ./upload_coveralls.sh +# $ ./prepare_coveralls_report.sh # # [coveralls] @@ -15,7 +15,4 @@ then mkdir xccov2lcov && cd xccov2lcov && git init && git fetch --depth=1 https://github.com/trax-retail/xccov2lcov.git && git checkout FETCH_HEAD xcrun xccov view --report --json ../$COVERAGE_DIR/Logs/Test/*.xcresult > coverage.json swift run xccov2lcov coverage.json > lcov.info - - cd .. - coveralls-lcov -v --repo-token $COVERALLS_TOKEN xccov2lcov/lcov.info fi From 1915d0127483f3139a38ec2837b55381092af07a Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 21 Apr 2022 12:08:46 +0500 Subject: [PATCH 75/83] testing coveralls. --- .github/workflows/unit_tests.yml | 11 +++++++---- Scripts/prepare_coveralls_report.sh | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 471e9f27..73900019 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -78,9 +78,11 @@ jobs: sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" - - if: steps.unit_tests.outcome == 'success' - id: coveralls + - # - report coverage for PR and iPhone 11 only (avoid redundant ones) + # - use Xcode12.4+ (older Xcode reports a wrong number) name: Check on success + id: coveralls + if: ${{ steps.unit_tests.outcome == 'success' && env.TRAVIS_BRANCH == "master" && env.PLATFORM == "iOS Simulator" && env.NAME == "iPhone 11" }} env: COVERAGE_DIR: ./COVERAGE PLATFORM: ${{ matrix.platform }} @@ -88,8 +90,9 @@ jobs: run: | Scripts/prepare_coveralls_report.sh sleep 5 - - if: steps.coveralls.outcome == 'success' - name: Upload coveralls report + - name: Upload coveralls report + if: steps.coveralls.outcome == 'success' uses: coverallsapp/github-action@master with: github-token: ${{ secrets.CI_USER_TOKEN }} + path-to-lcov: ./xccov2lcov/lcov.info diff --git a/Scripts/prepare_coveralls_report.sh b/Scripts/prepare_coveralls_report.sh index 2a61f7d6..af49b917 100755 --- a/Scripts/prepare_coveralls_report.sh +++ b/Scripts/prepare_coveralls_report.sh @@ -8,11 +8,11 @@ # [coveralls] # - exclude coverage for Test codes by setting OptimizelySwiftSDK-iOS scheme > Test > Options > Gather coverage for selected targets -# - report coverage for PR and iPhone 11 only (avoid redundant ones) -# - use Xcode12.4+ (older Xcode reports a wrong number) -if [[ "$TRAVIS_BRANCH" == "master" && "$PLATFORM" == "iOS Simulator" && "$NAME" == "iPhone 11" ]] +if [[ ]] then - mkdir xccov2lcov && cd xccov2lcov && git init && git fetch --depth=1 https://github.com/trax-retail/xccov2lcov.git && git checkout FETCH_HEAD - xcrun xccov view --report --json ../$COVERAGE_DIR/Logs/Test/*.xcresult > coverage.json - swift run xccov2lcov coverage.json > lcov.info + fi +mkdir xccov2lcov && cd xccov2lcov && git init && git fetch --depth=1 https://github.com/trax-retail/xccov2lcov.git && git checkout FETCH_HEAD +xcrun xccov view --report --json ../$COVERAGE_DIR/Logs/Test/*.xcresult > coverage.json +swift run xccov2lcov coverage.json > lcov.info +cd .. \ No newline at end of file From 12c43c4b5a1f6ffeab0b49efd075c48b38172a9d Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 21 Apr 2022 12:10:57 +0500 Subject: [PATCH 76/83] nits fixed. --- .github/workflows/unit_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 73900019..795d8453 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -82,7 +82,7 @@ jobs: # - use Xcode12.4+ (older Xcode reports a wrong number) name: Check on success id: coveralls - if: ${{ steps.unit_tests.outcome == 'success' && env.TRAVIS_BRANCH == "master" && env.PLATFORM == "iOS Simulator" && env.NAME == "iPhone 11" }} + if: ${{ steps.unit_tests.outcome == 'success' && env.TRAVIS_BRANCH == 'master' && env.PLATFORM == 'iOS Simulator' && env.NAME == 'iPhone 11' }} env: COVERAGE_DIR: ./COVERAGE PLATFORM: ${{ matrix.platform }} From fb5acbc0c83e971e0a6508290bea7254561fbbb1 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 21 Apr 2022 13:06:40 +0500 Subject: [PATCH 77/83] fixes. --- Scripts/prepare_coveralls_report.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Scripts/prepare_coveralls_report.sh b/Scripts/prepare_coveralls_report.sh index af49b917..e5f8626c 100755 --- a/Scripts/prepare_coveralls_report.sh +++ b/Scripts/prepare_coveralls_report.sh @@ -8,10 +8,6 @@ # [coveralls] # - exclude coverage for Test codes by setting OptimizelySwiftSDK-iOS scheme > Test > Options > Gather coverage for selected targets -if [[ ]] -then - -fi mkdir xccov2lcov && cd xccov2lcov && git init && git fetch --depth=1 https://github.com/trax-retail/xccov2lcov.git && git checkout FETCH_HEAD xcrun xccov view --report --json ../$COVERAGE_DIR/Logs/Test/*.xcresult > coverage.json swift run xccov2lcov coverage.json > lcov.info From ada51b2a9be8eec3fe774f862aa3a0496e7ae4e0 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 21 Apr 2022 13:36:17 +0500 Subject: [PATCH 78/83] fixes. --- .github/workflows/swift.yml | 2 +- .github/workflows/unit_tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index fb88c719..4e63c81e 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -46,7 +46,7 @@ jobs: if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}" uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction secrets: - CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} prepare_for_release: if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}" diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 795d8453..0204afed 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -3,7 +3,7 @@ name: Reusable action of Unit tests on: workflow_call: secrets: - CI_USER_TOKEN: + GITHUB_TOKEN: required: true jobs: @@ -94,5 +94,5 @@ jobs: if: steps.coveralls.outcome == 'success' uses: coverallsapp/github-action@master with: - github-token: ${{ secrets.CI_USER_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: ./xccov2lcov/lcov.info From 2648b0f9fc2a15cb72134703ab9b37663e1ad2fc Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Thu, 21 Apr 2022 13:41:17 +0500 Subject: [PATCH 79/83] fixes --- .github/workflows/swift.yml | 2 -- .github/workflows/unit_tests.yml | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 4e63c81e..44b0bd83 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -45,8 +45,6 @@ jobs: unittests: if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}" uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction - secrets: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} prepare_for_release: if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}" diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 0204afed..f2b1db3f 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -1,10 +1,6 @@ name: Reusable action of Unit tests -on: - workflow_call: - secrets: - GITHUB_TOKEN: - required: true +on: [workflow_call] jobs: unittests: From 97f59b311a50a93d9ecd5cfc8039b968289173e9 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 25 Apr 2022 12:58:23 +0500 Subject: [PATCH 80/83] suggested changes made. --- .github/workflows/prepare_for_release.yml | 10 +++++++--- .github/workflows/swift.yml | 8 ++++++-- .github/workflows/unit_tests.yml | 21 +++++++++++---------- README.md | 2 +- Scripts/run_prep.sh | 20 ++++++++------------ Scripts/run_release.sh | 4 ++-- Scripts/run_unit_tests.sh | 2 +- 7 files changed, 36 insertions(+), 31 deletions(-) diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml index 418a5a35..0de30aeb 100644 --- a/.github/workflows/prepare_for_release.yml +++ b/.github/workflows/prepare_for_release.yml @@ -5,6 +5,10 @@ on: secrets: CI_USER_TOKEN: required: true + inputs: + VERSION: + required: true + type: number jobs: prepare_for_release: @@ -17,10 +21,10 @@ jobs: - id: prepare_for_release name: Prepare for release env: - VERSION: 3.10.1 + VERSION: ${{ inputs.VERSION }} HOME: 'home/runner' - TRAVIS_REPO_SLUG: ${{ github.repository }} - TRAVIS_BRANCH: ${{ github.ref_name }} + REPO_SLUG: ${{ github.repository }} + BRANCH: ${{ github.ref_name }} GITHUB_USER: optibot GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} run: | diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 44b0bd83..f5494c73 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -16,6 +16,9 @@ on: type: boolean description: release +env: + VERSION: 3.10.1 + jobs: lint_markdown_files: @@ -49,6 +52,8 @@ jobs: prepare_for_release: if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}" uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction + with: + VERSION: ${{ env.VERSION }} secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} @@ -62,9 +67,8 @@ jobs: xcode-version: '12.4' - name: Push to cocoapods.org env: - VERSION: 3.10.1 GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - TRAVIS_BRANCH: ${{ github.ref_name }} + BRANCH: ${{ github.ref_name }} run: | gem install cocoapods -v '1.9.3' Scripts/run_release.sh diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index f2b1db3f..36a9b8b7 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -2,6 +2,9 @@ name: Reusable action of Unit tests on: [workflow_call] +env: + COVERAGE_DIR: ./COVERAGE + jobs: unittests: runs-on: macos-10.15 @@ -45,14 +48,13 @@ jobs: - name: set SDK Branch if PR if: ${{ github.event_name == 'pull_request' }} run: | - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | - echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - id: unit_tests env: - COVERAGE_DIR: ./COVERAGE SCHEME: ${{ matrix.scheme }} TEST_SDK: ${{ matrix.test_sdk }} PLATFORM: ${{ matrix.platform }} @@ -68,19 +70,18 @@ jobs: HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq Scripts/prepare_simulator.sh Scripts/run_unit_tests.sh - - name: Check on failures + - name: Check on failures (Archive Test Results) + uses: actions/upload-artifact@v3 if: steps.unit_tests.outcome != 'success' - run: | - sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log) - artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput" + with: + name: build-logs-${{ matrix.device }}-${{ matrix.os }} + path: build/Logs - # - report coverage for PR and iPhone 11 only (avoid redundant ones) # - use Xcode12.4+ (older Xcode reports a wrong number) name: Check on success id: coveralls - if: ${{ steps.unit_tests.outcome == 'success' && env.TRAVIS_BRANCH == 'master' && env.PLATFORM == 'iOS Simulator' && env.NAME == 'iPhone 11' }} + if: ${{ steps.unit_tests.outcome == 'success' && env.BRANCH == 'master' && env.PLATFORM == 'iOS Simulator' && env.NAME == 'iPhone 11' }} env: - COVERAGE_DIR: ./COVERAGE PLATFORM: ${{ matrix.platform }} NAME: ${{ matrix.device }} run: | diff --git a/README.md b/README.md index 01b50fc8..bffeb3f5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # SWIFT SDK [![Apache 2.0](https://img.shields.io/github/license/nebula-plugins/gradle-extra-configurations-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/carthage/carthage) -[![Build Status](https://travis-ci.com/optimizely/swift-sdk.svg?branch=master)](https://travis-ci.com/optimizely/swift-sdk) +[![Build Status](https://github.com/optimizely/swift-sdk/actions/workflows/swift.yml/badge.svg?branch=yasir/gitAction)](https://github.com/optimizely/swift-sdk/actions) [![Coverage Status](https://coveralls.io/repos/github/optimizely/swift-sdk/badge.svg?branch=master)](https://coveralls.io/github/optimizely/swift-sdk?branch=master) [![Platforms](https://img.shields.io/cocoapods/p/OptimizelySwiftSDK.svg)](https://img.shields.io/cocoapods/p/OptimizelySwiftSDK.svg) [![Podspec](https://img.shields.io/cocoapods/v/OptimizelySwiftSDK.svg)](https://cocoapods.org/pods/OptimizelySwiftSDK) diff --git a/Scripts/run_prep.sh b/Scripts/run_prep.sh index d83e8ebf..f387d54a 100755 --- a/Scripts/run_prep.sh +++ b/Scripts/run_prep.sh @@ -1,19 +1,16 @@ #!/bin/bash -e -set -e -# Because `hub` is used, this script expects the following environment variables defined in travis job settings: +# Because `hub` is used, this script expects the following environment variables: # GITHUB_TOKEN - github api token with repo permissions (display value in build log setting: OFF) # GITHUB_USER - github username that GITHUB_TOKEN is associated with (display value in build log setting: ON) # Additionally, it needs the following environment variables: -# VERSION - defined in .travis.yml - -# Variables starting with TRAVIS_ are default environment variables available to all Travis CI builds +# VERSION - defined in swift.yml COLOR_RESET='\033[0m' COLOR_MAGENTA='\033[0;35m' COLOR_CYAN='\033[0;36m' -MYREPO=${HOME}/workdir/${TRAVIS_REPO_SLUG} +MYREPO=${HOME}/workdir/${REPO_SLUG} AUTOBRANCH=${GITHUB_USER}/prepareRelease${VERSION} BUILD_OUTPUT=/tmp/build.out touch $BUILD_OUTPUT @@ -21,7 +18,7 @@ touch $BUILD_OUTPUT function prep_workspace { rm -rf ${MYREPO} mkdir -p ${MYREPO} - git clone -b ${TRAVIS_BRANCH} https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG} ${MYREPO} + git clone -b ${BRANCH} https://${GITHUB_TOKEN}@github.com/${REPO_SLUG} ${MYREPO} cd ${MYREPO} git checkout -b ${AUTOBRANCH} } @@ -38,7 +35,6 @@ function error_handler() { } function do_stuff { - # keepalive for Travis while :; do sleep 10; echo -n .; done & trap "kill $!" EXIT trap 'error_handler' ERR @@ -64,7 +60,7 @@ function push_changes { git config user.name "${GITHUB_USER}" git add --all # this is like a try/catch - git commit -m "ci(travis): auto release prep for $VERSION" || + git commit -m "ci(git-action): auto release prep for $VERSION" || { case $? in 1 ) @@ -77,10 +73,10 @@ function push_changes { ;; esac } - git push https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG} ${AUTOBRANCH} - PR_URL=$(hub pull-request --no-edit -b ${TRAVIS_BRANCH}) + git push https://${GITHUB_TOKEN}@github.com/${REPO_SLUG} ${AUTOBRANCH} + PR_URL=$(hub pull-request --no-edit -b ${BRANCH}) echo -e "${COLOR_CYAN}ATTENTION:${COLOR_RESET} review and merge ${COLOR_CYAN}${PR_URL}${COLOR_RESET}" - echo "then to release to cocoapods use Travis CI's Trigger build with the following payload:" + echo "then to release to cocoapods use Git action's Trigger build with the following payload:" echo -e "${COLOR_MAGENTA}env:${COLOR_RESET}" echo -e "${COLOR_MAGENTA} - RELEASE=true${COLOR_RESET}" } diff --git a/Scripts/run_release.sh b/Scripts/run_release.sh index c10724b6..a62bc9b6 100755 --- a/Scripts/run_release.sh +++ b/Scripts/run_release.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -# Because `hub` is used, this script expects the following environment variables defined in travis job settings: +# Because `hub` is used, this script expects the following environment variables: # GITHUB_TOKEN - github api token with repo permissions (display value in build log setting: OFF) # GITHUB_USER - github username that GITHUB_TOKEN is associated with (display value in build log setting: ON) @@ -22,7 +22,7 @@ function release_github { DESCRIPTION=$(awk "/^${NEW_VERSION}$/,/^${LAST_VERSION:-nothingmatched}$/" ${CHANGELOG} | grep -v "^${LAST_VERSION:-nothingmatched}$") - hub release create v${VERSION} -m "Release ${VERSION}" -m "${DESCRIPTION}" -t "${TRAVIS_BRANCH}" + hub release create v${VERSION} -m "Release ${VERSION}" -m "${DESCRIPTION}" -t "${BRANCH}" } diff --git a/Scripts/run_unit_tests.sh b/Scripts/run_unit_tests.sh index 1a7e63f4..4541b654 100755 --- a/Scripts/run_unit_tests.sh +++ b/Scripts/run_unit_tests.sh @@ -7,7 +7,7 @@ # # unit tests for PR only -if [[ "$TRAVIS_BRANCH" == "master" ]] +if [[ "$BRANCH" == "master" ]] then xcodebuild test -derivedDataPath $COVERAGE_DIR -workspace OptimizelySwiftSDK.xcworkspace -scheme $SCHEME -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk $TEST_SDK -destination "platform=$PLATFORM,OS=$OS,name=$NAME" ONLY_ACTIVE_ARCH=YES | tee buildoutput | xcpretty && test ${PIPESTATUS[0]} -eq 0 fi From 2adb67c20ea1386c840146442af88192d9603c2c Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 25 Apr 2022 13:42:34 +0500 Subject: [PATCH 81/83] fixing env issues --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index f5494c73..c1d0eb83 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -53,7 +53,7 @@ jobs: if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}" uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction with: - VERSION: ${{ env.VERSION }} + VERSION: 3.10.1 # env variables cannot be used for reusable workflows secrets: CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} From baccced8c5227ce440eb23d2412e818138a67fed Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Mon, 25 Apr 2022 13:43:50 +0500 Subject: [PATCH 82/83] fixing env issues --- .github/workflows/prepare_for_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml index 0de30aeb..f906b63f 100644 --- a/.github/workflows/prepare_for_release.yml +++ b/.github/workflows/prepare_for_release.yml @@ -8,7 +8,7 @@ on: inputs: VERSION: required: true - type: number + type: string jobs: prepare_for_release: From 6b83858d3c1597ffaf1415dab3989d58c8a2e2f7 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Wed, 27 Apr 2022 12:44:58 +0500 Subject: [PATCH 83/83] suggested changes made. --- .github/workflows/integration_tests.yml | 1 - .github/workflows/prepare_for_release.yml | 35 ----------------------- .github/workflows/swift.yml | 25 ++++++++++++---- Scripts/build_all.sh | 1 - Scripts/prepare_coveralls_report.sh | 2 +- Scripts/test_all.sh | 2 +- 6 files changed, 22 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/prepare_for_release.yml diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 3ac839bb..36eeb989 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -23,7 +23,6 @@ jobs: if: ${{ github.event_name == 'pull_request' }} run: | echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV - echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - name: set SDK Branch if not pull request if: ${{ github.event_name != 'pull_request' }} run: | diff --git a/.github/workflows/prepare_for_release.yml b/.github/workflows/prepare_for_release.yml deleted file mode 100644 index f906b63f..00000000 --- a/.github/workflows/prepare_for_release.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Reusable action of Release preparation - -on: - workflow_call: - secrets: - CI_USER_TOKEN: - required: true - inputs: - VERSION: - required: true - type: string - -jobs: - prepare_for_release: - runs-on: macos-latest - steps: - - uses: maxim-lobanov/setup-xcode@v1 - - uses: actions/checkout@v3 - with: - xcode-version: '12.4' - - id: prepare_for_release - name: Prepare for release - env: - VERSION: ${{ inputs.VERSION }} - HOME: 'home/runner' - REPO_SLUG: ${{ github.repository }} - BRANCH: ${{ github.ref_name }} - GITHUB_USER: optibot - GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} - run: | - gem install cocoapods -v '1.9.3' - Scripts/run_prep.sh - - name: Check prepare for release failure - if: steps.prepare_for_release.conclusion == 'failure' - run: cat /tmp/build.out diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index c1d0eb83..1ac7229d 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -50,12 +50,27 @@ jobs: uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction prepare_for_release: + runs-on: macos-latest if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}" - uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction - with: - VERSION: 3.10.1 # env variables cannot be used for reusable workflows - secrets: - CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} + steps: + - uses: actions/checkout@v3 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '12.4' + - id: prepare_for_release + name: Prepare for release + env: + HOME: 'home/runner' + REPO_SLUG: ${{ github.repository }} + BRANCH: ${{ github.ref_name }} + GITHUB_USER: optibot + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + run: | + gem install cocoapods -v '1.9.3' + Scripts/run_prep.sh + - name: Check prepare for release failure + if: steps.prepare_for_release.conclusion == 'failure' + run: cat /tmp/build.out release: if: "${{github.event.inputs.RELEASE == 'true' && github.event_name == 'workflow_dispatch' }}" diff --git a/Scripts/build_all.sh b/Scripts/build_all.sh index d5e7b960..5b728397 100755 --- a/Scripts/build_all.sh +++ b/Scripts/build_all.sh @@ -35,4 +35,3 @@ main() { } main - diff --git a/Scripts/prepare_coveralls_report.sh b/Scripts/prepare_coveralls_report.sh index e5f8626c..adfb0eba 100755 --- a/Scripts/prepare_coveralls_report.sh +++ b/Scripts/prepare_coveralls_report.sh @@ -11,4 +11,4 @@ mkdir xccov2lcov && cd xccov2lcov && git init && git fetch --depth=1 https://github.com/trax-retail/xccov2lcov.git && git checkout FETCH_HEAD xcrun xccov view --report --json ../$COVERAGE_DIR/Logs/Test/*.xcresult > coverage.json swift run xccov2lcov coverage.json > lcov.info -cd .. \ No newline at end of file +cd .. diff --git a/Scripts/test_all.sh b/Scripts/test_all.sh index 08c1f58c..75f7f589 100755 --- a/Scripts/test_all.sh +++ b/Scripts/test_all.sh @@ -19,4 +19,4 @@ for i in "${!deviceModels[@]}"; do Scripts/prepare_simulator.sh echo "Testing OptimizelySwiftSDK-${platforms[$i]} (${deviceModels[$i]},OS=${osVersions[$i]})" xcrun xcodebuild -workspace OptimizelySwiftSDK.xcworkspace -scheme "OptimizelySwiftSDK-${platforms[$i]}" -sdk "${testSdks[$i]}" -destination "platform=${platforms[$i]} Simulator,name=${deviceModels[$i]},OS=${osVersions[$i]}" test -done \ No newline at end of file +done