-
Notifications
You must be signed in to change notification settings - Fork 7
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
iOS CircleCI to GitHub Actions reusable workflow conversion #67
Changes from 38 commits
c4d1179
04c8d2a
f8613b5
c6e3794
519064c
e66e41d
213073a
61169a4
23a5079
4cea9e8
3e673cd
ae10e89
402a665
97181e6
1ec45a7
6c46355
54b8614
4d2eac2
b65cefc
8c157da
36bcd3b
2519ff0
f9b3b05
fa2b56d
53af8ee
514a58b
4073275
fd74a5b
187a509
a9d9ea1
e6a7c4f
e719152
2c02a81
ef3472f
7901c09
7ea19df
907898e
3d9d190
60801a2
9d386bf
9844fd1
8826545
c4e9710
7ab55fa
f475618
1276c6d
d8df135
3a4cff3
c5c5c77
6da50be
f374766
e94e87f
549a8c5
f49410f
00c7d83
759b74c
58fee35
7eb0a4d
2dcd4b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Setup Dependencies (iOS) | ||
description: Checkout and install dependencies | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Restore Gemfile cache | ||
id: cache-gems | ||
uses: actions/[email protected] | ||
with: | ||
path: vendor/bundle | ||
key: gems-${{ runner.os }}-${{ hashFiles('**/Gemfile.lock') }} | ||
|
||
- name: Configure bundler path and verify Cocoapods version | ||
run: | | ||
bundle config set path 'vendor/bundle' | ||
bundle check || bundle install | ||
shell: bash | ||
|
||
- name: Save Gemfile cache | ||
if: steps.cache-gems.outputs.cache-hit != 'true' | ||
uses: actions/cache/[email protected] | ||
with: | ||
path: vendor/bundle | ||
key: gems-${{ runner.os }}-${{ hashFiles('**/Gemfile.lock') }} | ||
|
||
- name: Restore CocoaPods cache | ||
id: cache-pods | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
Pods | ||
~/.cocoapods | ||
key: cocoapods-cache-v6-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('**/Podfile.lock') }} | ||
restore-keys: | | ||
cocoapods-cache-v6-${{ runner.os }}-${{ github.ref }} | ||
cocoapods-cache-v6 | ||
|
||
- name: Install CocoaPods | ||
run: make ci-pod-install | ||
shell: bash | ||
|
||
- name: Save CocoaPods cache | ||
if: steps.cache-pods.outputs.cache-hit != 'true' | ||
uses: actions/cache/[email protected] | ||
with: | ||
path: | | ||
Pods | ||
SampleApps/TestApp/Pods | ||
~/.cocoapods | ||
key: cocoapods-cache-v6-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('**/Podfile.lock') }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
name: Build and Test (iOS) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ios-device-names: | ||
description: | | ||
The iOS device names to use for testing. Must be formatted as a valid JSON array string. | ||
Example: '["iPhone 15", "iPhone 15 Pro"]' | ||
- Notice the use of single quotes to wrap the JSON array string, and double quotes for each array element. | ||
type: string | ||
default: '["iPhone 15"]' | ||
ios-versions: | ||
description: | | ||
The iOS versions to use for testing. Must be formatted as a valid JSON array string. | ||
Example: '["18.0", "18.1"]' | ||
- Notice the use of single quotes to wrap the JSON array string, and double quotes for each array element. | ||
type: string | ||
default: '["18.0"]' | ||
tvos-device-names: | ||
description: | | ||
The tvOS device names to use for testing. Must be formatted as a valid JSON array string. | ||
Example: '["Apple TV 4K (3rd generation)", "Apple TV"]' | ||
- Notice the use of single quotes to wrap the JSON array string, and double quotes for each array element. | ||
type: string | ||
default: '["Apple TV"]' | ||
tvos-versions: | ||
description: | | ||
The tvOS versions to use for testing. Must be formatted as a valid JSON array string. | ||
Example: '["18.0", "18.1"]' | ||
- Notice the use of single quotes to wrap the JSON array string, and double quotes for each array element. | ||
type: string | ||
default: '["18.0"]' | ||
# Flags for which tests to run | ||
run-test-ios-unit: | ||
type: boolean | ||
default: false | ||
run-test-ios-functional: | ||
type: boolean | ||
default: false | ||
run-test-ios-integration: | ||
type: boolean | ||
default: false | ||
run-test-tvos-unit: | ||
type: boolean | ||
default: false | ||
run-test-tvos-functional: | ||
type: boolean | ||
default: false | ||
run-test-tvos-integration: | ||
type: boolean | ||
default: false | ||
run-build-xcframework-and-app: | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
validate-code: | ||
name: Validate Code | ||
uses: timkimadobe/aepsdk-commons/.github/workflows/ios-validate-code.yml@ios-circleci-to-github | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you update all the references from your fork? It should also reference the same tag that the other repositories use to trigger this action. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated! Using the major version aligned tag: |
||
|
||
test-ios-unit: | ||
name: Unit Test (iOS) | ||
needs: validate-code | ||
if: inputs.run-test-ios-unit | ||
uses: timkimadobe/aepsdk-commons/.github/workflows/ios-custom-command-build-and-test.yml@ios-circleci-to-github | ||
with: | ||
ios-device-names: ${{ inputs.ios-device-names }} | ||
ios-versions: ${{ inputs.ios-versions }} | ||
command: make unit-test-ios | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also add one flag to enable codecov (with default=true) for the entire workflow and add necessary steps for uploading the coverage reports? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, added Codecov support for each test case with some caveats - please see the main PR description under Questions for reviewers section for more details. Also added an example of the Codecov enabled run under Example runs section |
||
|
||
test-ios-functional: | ||
name: Functional Test (iOS) | ||
needs: validate-code | ||
if: inputs.run-test-ios-functional | ||
uses: timkimadobe/aepsdk-commons/.github/workflows/ios-custom-command-build-and-test.yml@ios-circleci-to-github | ||
with: | ||
ios-device-names: ${{ inputs.ios-device-names }} | ||
ios-versions: ${{ inputs.ios-versions }} | ||
command: make functional-test-ios | ||
|
||
test-ios-integration: | ||
name: Integration Test (iOS) | ||
needs: validate-code | ||
if: inputs.run-test-ios-integration | ||
uses: timkimadobe/aepsdk-commons/.github/workflows/ios-custom-command-build-and-test.yml@ios-circleci-to-github | ||
with: | ||
ios-device-names: ${{ inputs.ios-device-names }} | ||
ios-versions: ${{ inputs.ios-versions }} | ||
command: make test-integration-upstream | ||
|
||
test-tvos-unit: | ||
name: Unit Test (tvOS) | ||
needs: validate-code | ||
if: inputs.run-test-tvos-unit | ||
uses: timkimadobe/aepsdk-commons/.github/workflows/ios-custom-command-build-and-test.yml@ios-circleci-to-github | ||
with: | ||
tvos-device-names: ${{ inputs.tvos-device-names }} | ||
tvos-versions: ${{ inputs.tvos-versions }} | ||
command: make unit-test-tvos | ||
|
||
test-tvos-functional: | ||
name: Functional Test (tvOS) | ||
needs: validate-code | ||
if: inputs.run-test-tvos-functional | ||
uses: timkimadobe/aepsdk-commons/.github/workflows/ios-custom-command-build-and-test.yml@ios-circleci-to-github | ||
with: | ||
tvos-device-names: ${{ inputs.tvos-device-names }} | ||
tvos-versions: ${{ inputs.tvos-versions }} | ||
command: make functional-test-tvos | ||
|
||
test-tvos-integration: | ||
name: Integration Test (tvOS) | ||
needs: validate-code | ||
if: inputs.run-test-tvos-integration | ||
uses: timkimadobe/aepsdk-commons/.github/workflows/ios-custom-command-build-and-test.yml@ios-circleci-to-github | ||
with: | ||
tvos-device-names: ${{ inputs.tvos-device-names }} | ||
tvos-versions: ${{ inputs.tvos-versions }} | ||
command: make integration-test-tvos | ||
|
||
build_xcframework_and_app: | ||
name: Build XCFramework and Test App | ||
runs-on: macos-latest | ||
needs: validate-code | ||
if: inputs.run-build-xcframework-and-app | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Dependencies | ||
uses: timkimadobe/aepsdk-commons/.github/actions/ios-setup-dependencies-action@ios-circleci-to-github | ||
|
||
- name: Build XCFramework | ||
run: make archive | ||
|
||
- name: Build Test App | ||
run: make build-app |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
name: Custom Command Build and Test (iOS) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ios-device-names: | ||
description: | | ||
The iOS device names to use for testing. Must be formatted as a valid JSON array string. | ||
Example: '["iPhone 15", "iPhone 15 Pro"]' | ||
- Notice the use of single quotes to wrap the JSON array string, and double quotes for each array element. | ||
type: string | ||
default: '' | ||
ios-versions: | ||
description: | | ||
The iOS versions to use for testing. Must be formatted as a valid JSON array string. | ||
Example: '["18.0", "18.1"]' | ||
- Notice the use of single quotes to wrap the JSON array string, and double quotes for each array element. | ||
type: string | ||
default: '' | ||
tvos-device-names: | ||
description: | | ||
The tvOS device names to use for testing. Must be formatted as a valid JSON array string. | ||
Example: '["Apple TV 4K (3rd generation)", "Apple TV"]' | ||
- Notice the use of single quotes to wrap the JSON array string, and double quotes for each array element. | ||
type: string | ||
default: '' | ||
tvos-versions: | ||
description: | | ||
The tvOS versions to use for testing. Must be formatted as a valid JSON array string. | ||
Example: '["18.0", "18.1"]' | ||
- Notice the use of single quotes to wrap the JSON array string, and double quotes for each array element. | ||
type: string | ||
default: '' | ||
command: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
define-matrix: | ||
name: Define Matrix | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ios-device-names: ${{ steps.define-matrix.outputs.ios-device-names }} | ||
ios-versions: ${{ steps.define-matrix.outputs.ios-versions }} | ||
tvos-device-names: ${{ steps.define-matrix.outputs.tvos-device-names }} | ||
tvos-versions: ${{ steps.define-matrix.outputs.tvos-versions }} | ||
is-default-ios-device: ${{ steps.define-matrix.outputs.is-default-ios-device }} | ||
is-default-ios: ${{ steps.define-matrix.outputs.is-default-ios }} | ||
is-default-tvos-device: ${{ steps.define-matrix.outputs.is-default-tvos-device }} | ||
is-default-tvos: ${{ steps.define-matrix.outputs.is-default-tvos }} | ||
steps: | ||
- name: Define Matrix | ||
id: define-matrix | ||
shell: bash | ||
run: | | ||
# Set default values | ||
default_ios_device_names='["iPhone 15"]' | ||
default_ios_versions='["18.0"]' | ||
default_tvos_device_names='["Apple TV"]' | ||
default_tvos_versions='["18.0"]' | ||
|
||
# Get inputs | ||
ios_device_names='${{ inputs.ios-device-names }}' | ||
ios_versions='${{ inputs.ios-versions }}' | ||
tvos_device_names='${{ inputs.tvos-device-names }}' | ||
tvos_versions='${{ inputs.tvos-versions }}' | ||
|
||
# Check and set default values | ||
if [ -z "$ios_device_names" ]; then | ||
ios_device_names="$default_ios_device_names" | ||
is_default_ios_device='true' | ||
else | ||
is_default_ios_device='false' | ||
fi | ||
|
||
if [ -z "$ios_versions" ]; then | ||
ios_versions="$default_ios_versions" | ||
is_default_ios='true' | ||
else | ||
is_default_ios='false' | ||
fi | ||
|
||
if [ -z "$tvos_device_names" ]; then | ||
tvos_device_names="$default_tvos_device_names" | ||
is_default_tvos_device='true' | ||
else | ||
is_default_tvos_device='false' | ||
fi | ||
|
||
if [ -z "$tvos_versions" ]; then | ||
tvos_versions="$default_tvos_versions" | ||
is_default_tvos='true' | ||
else | ||
is_default_tvos='false' | ||
fi | ||
|
||
# Set outputs | ||
echo "ios-device-names=$ios_device_names" >> "$GITHUB_OUTPUT" | ||
echo "ios-versions=$ios_versions" >> "$GITHUB_OUTPUT" | ||
echo "tvos-device-names=$tvos_device_names" >> "$GITHUB_OUTPUT" | ||
echo "tvos-versions=$tvos_versions" >> "$GITHUB_OUTPUT" | ||
|
||
echo "is-default-ios-device=$is_default_ios_device" >> "$GITHUB_OUTPUT" | ||
echo "is-default-ios=$is_default_ios" >> "$GITHUB_OUTPUT" | ||
echo "is-default-tvos-device=$is_default_tvos_device" >> "$GITHUB_OUTPUT" | ||
echo "is-default-tvos=$is_default_tvos" >> "$GITHUB_OUTPUT" | ||
run-custom-command: | ||
name: > | ||
${{ needs.define-matrix.outputs.is-default-ios-device != 'true' && matrix.ios-device || '' }} | ||
${{ needs.define-matrix.outputs.is-default-ios != 'true' && matrix.ios || '' }} | ||
${{ needs.define-matrix.outputs.is-default-tvos-device != 'true' && matrix.tvos-device || '' }} | ||
${{ needs.define-matrix.outputs.is-default-tvos != 'true' && matrix.tvos || '' }} | ||
runs-on: macos-latest | ||
needs: define-matrix | ||
strategy: | ||
max-parallel: 2 | ||
matrix: | ||
ios-device: ${{ fromJson(needs.define-matrix.outputs.ios-device-names) }} | ||
ios: ${{ fromJson(needs.define-matrix.outputs.ios-versions) }} | ||
tvos-device: ${{ fromJson(needs.define-matrix.outputs.tvos-device-names) }} | ||
tvos: ${{ fromJson(needs.define-matrix.outputs.tvos-versions) }} | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Dependencies | ||
uses: timkimadobe/aepsdk-commons/.github/actions/ios-setup-dependencies-action@ios-circleci-to-github | ||
|
||
- name: Run ${{ inputs.command }} | ||
run: ${{ inputs.command }} IOS_DEVICE_NAME="${{ matrix.ios-device }}" IOS_VERSION="${{ matrix.ios }}" TVOS_DEVICE_NAME="${{ matrix.tvos-device }}" TVOS_VERSION="${{ matrix.tvos }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Validate Code (iOS) | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
validate-code: | ||
name: Validate Code | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Dependencies | ||
uses: timkimadobe/aepsdk-commons/.github/actions/ios-setup-dependencies-action@ios-circleci-to-github | ||
|
||
- name: Lint Source Code | ||
run: make lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add
run-test-tvos-integration
?