Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: removed travis yml and added git action support #454

Merged
merged 83 commits into from
Apr 28, 2022
Merged

Conversation

yasirfolio3
Copy link
Contributor

@yasirfolio3 yasirfolio3 commented Apr 14, 2022

Summary

  • We remove travis yaml from swift-sdk and moved all the stages to git action.
  • Not tested release and pre-release sections.

Test plan

All tests should pass

Result

https://github.com/optimizely/swift-sdk/runs/6074478472?check_suite_focus=true

NOTE

@coveralls
Copy link

coveralls commented Apr 14, 2022

Coverage Status

Coverage remained the same at 95.687% when pulling 6b83858 on yasir/gitAction into 193cc00 on master.

@yasirfolio3 yasirfolio3 reopened this Apr 14, 2022
Comment on lines +34 to +35
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these variables doesn't seem correct to set with refname.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref_name has the The branch or tag name that triggered the workflow run. as per the official documentation, in case build was not triggered by pull request. This is required by travisci-tools/trigger-script-with-status-update.sh.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it, we don't have any relation with the current repo to trigger-script-with-status-update.sh

RELEASE: ${{ secrets.RELEASE }}
if: "${{ env.PREP == '' && env.RELEASE == '' }}"
run: |
echo "$GITHUB_CONTEXT"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need of it.

@yasirfolio3 yasirfolio3 force-pushed the yasir/gitAction branch 2 times, most recently from ee964ca to 39b7edd Compare April 20, 2022 11:06
@yasirfolio3 yasirfolio3 requested a review from jaeopt April 22, 2022 18:31
Copy link
Collaborator

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see all the previous issue cleaned up. I have a few more suggestions.

Comment on lines 1 to 2
#!/bin/bash -e
set -e
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both "bash -e" and "set -e"?

xcode-version: '12.4'
- name: Push to cocoapods.org
env:
VERSION: 3.10.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SDK version may be confusing - one for "prepare-for-release" is defined in the workflow-call and the same for "release" is defined in this top level.
It'll be great if we can find a way to share a single variable at the top level and pass it to "prepare-for-release" as a parameter.

env:
VERSION: 3.10.1
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_BRANCH: ${{ github.ref_name }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still use "TRAVIS" in the names? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all env variables with previs TRAVIS_ leaving only those which are required by trigger-script-with-status-update script of travis-ci-tools.

- id: prepare_for_release
name: Prepare for release
env:
VERSION: 3.10.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value (SDK release version) should be passed as a parameter from the top level

Copy link
Contributor Author

@yasirfolio3 yasirfolio3 Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into it and have tried to make it a global env. For using reusable_workflows, we cannot pass env variables to them. Because of this, version is declared twice in swift.yml.

Comment on lines +37 to +44
# 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}')"
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you spent a lot of efforts to figure out all these mappings :) Not a good support from github. I'm concerned if we need to adjust the versions and paths whenever Apple releases new iOS versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using runs-on: macos-10.15, these values will not change. Simulators and xcode versions are released along with macos versions by git actions. If we intend to move to newer versions of simulators, we would just need to update the runs-on: value and update the simulator versions as per the new documentation in unit_tests.yml.

@yasirfolio3 yasirfolio3 requested a review from jaeopt April 25, 2022 09:11
Copy link
Collaborator

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! One last change we can consider.

@yasirfolio3
Copy link
Contributor Author

Looks great! One last change we can consider.

Hey @jaeopt , i am unable to see the change request 👍

Copy link
Collaborator

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what happened to my prev comments :) Here we go again.

@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now see the limitation of sharing var. I wonder if we can bring "prepare_for_release" back to "swift.yml" and share a single VERSION for both "release" and "prepare_for_release". Any reason we keep only one of them in the separate workflow?

@yasirfolio3 yasirfolio3 requested a review from jaeopt April 27, 2022 08:18
Copy link
Collaborator

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@msohailhussain msohailhussain marked this pull request as ready for review April 28, 2022 20:47
@msohailhussain msohailhussain requested a review from a team as a code owner April 28, 2022 20:47
Copy link
Contributor

@msohailhussain msohailhussain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jaeopt jaeopt merged commit df91547 into master Apr 28, 2022
@jaeopt jaeopt deleted the yasir/gitAction branch April 28, 2022 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants