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

iOS CircleCI to GitHub Actions reusable workflow conversion #67

Merged
merged 59 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
c4d1179
Create composable action that helps set up iOS dependencies
timkimadobe Aug 8, 2024
04c8d2a
Create reusable workflow for iOS build and test checks for PR validation
timkimadobe Aug 8, 2024
f8613b5
Add flags for jobs to run
timkimadobe Aug 8, 2024
c6e3794
Create custom command build and test workflow
timkimadobe Aug 8, 2024
519064c
Update repo and branch to adobe main
timkimadobe Aug 8, 2024
e66e41d
Rename directory and workflow to be platform specific
timkimadobe Oct 30, 2024
213073a
Update title
timkimadobe Oct 30, 2024
61169a4
Update action versions to latest
timkimadobe Oct 30, 2024
23a5079
Testing calling remote action directly
timkimadobe Oct 30, 2024
4cea9e8
TEST: using remote composite action
timkimadobe Nov 5, 2024
3e673cd
Remove outdated input workflow_tag
timkimadobe Nov 5, 2024
ae10e89
Update all steps to use remote dependency setup composite action
timkimadobe Nov 5, 2024
402a665
Remove branch conditionals on job steps to allow caller repos to cont…
timkimadobe Nov 5, 2024
97181e6
TEST: add support for matrix device and os
timkimadobe Nov 5, 2024
1ec45a7
Update iOS dependencies action to better handle explicit save step ba…
timkimadobe Nov 5, 2024
6c46355
Add quotes to handle spaces in device names
timkimadobe Nov 5, 2024
54b8614
Fix missing if checks for job steps to run
timkimadobe Nov 5, 2024
4d2eac2
Update inputs for test device matrix to have defaults and non-mandato…
timkimadobe Nov 5, 2024
b65cefc
Update custom command workflow to use composable action and optional …
timkimadobe Nov 5, 2024
8c157da
Add logic to run matrix without validation if validation is not used
timkimadobe Nov 5, 2024
36bcd3b
try different bool check
timkimadobe Nov 5, 2024
2519ff0
Test using custom command
timkimadobe Nov 6, 2024
f9b3b05
Fix input names
timkimadobe Nov 6, 2024
fa2b56d
Test splitting actions into smaller workflows
timkimadobe Nov 6, 2024
53af8ee
Add names to custom command workflow jobs
timkimadobe Nov 6, 2024
514a58b
Add names to ios build and test workflow
timkimadobe Nov 6, 2024
4073275
Add matrix device and os info to name
timkimadobe Nov 6, 2024
fd74a5b
Update validate code job name
timkimadobe Nov 6, 2024
187a509
Remove fluff from job names
timkimadobe Nov 6, 2024
a9d9ea1
Try combining into single step
timkimadobe Nov 6, 2024
e6a7c4f
Test combining into single step
timkimadobe Nov 6, 2024
e719152
Update default matrix values
timkimadobe Nov 6, 2024
2c02a81
try using include instead
timkimadobe Nov 6, 2024
ef3472f
Update defaults
timkimadobe Nov 6, 2024
7901c09
Update to handle default matrix values
timkimadobe Nov 6, 2024
7ea19df
Clean up code and update names
timkimadobe Nov 6, 2024
907898e
Remove outdated if check
timkimadobe Nov 6, 2024
3d9d190
Add tvOS integration test step
timkimadobe Nov 6, 2024
60801a2
Test using codecov action
timkimadobe Nov 6, 2024
9d386bf
Explicitly pass token
timkimadobe Nov 6, 2024
9844fd1
Try passing secrets using inherit
timkimadobe Nov 6, 2024
8826545
Try specifying yaml path
timkimadobe Nov 6, 2024
c4e9710
Add verbose output for debugging
timkimadobe Nov 6, 2024
7ab55fa
Test passing directory
timkimadobe Nov 6, 2024
f475618
disable test run - only codecov
timkimadobe Nov 6, 2024
1276c6d
Fix pass through directory
timkimadobe Nov 7, 2024
d8df135
Reduce matrix runner parallelism to 1
timkimadobe Nov 7, 2024
3a4cff3
Test wildcard xcresult
timkimadobe Nov 7, 2024
c5c5c77
try moving to dervieddata folder
timkimadobe Nov 7, 2024
6da50be
test different directory
timkimadobe Nov 7, 2024
f374766
test ls
timkimadobe Nov 7, 2024
e94e87f
update to run test
timkimadobe Nov 7, 2024
549a8c5
Remove codecov directory input
timkimadobe Nov 7, 2024
f49410f
Create toggle for enabling codecov with default to true
timkimadobe Nov 7, 2024
00c7d83
Apply production configuration values
timkimadobe Nov 7, 2024
759b74c
Merge branch 'main' into ios-circleci-to-github
timkimadobe Nov 8, 2024
58fee35
Update workflow README with iOS build and test workflow requirements
timkimadobe Nov 8, 2024
7eb0a4d
Update build and test Makefile docs for matrix compatibility
timkimadobe Nov 8, 2024
2dcd4b8
Update iOS release workflow README
timkimadobe Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/actions/ios-setup-dependencies-action/action.yml
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') }}
139 changes: 139 additions & 0 deletions .github/workflows/ios-build-and-test.yml
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:
Copy link
Contributor

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?

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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated! Using the major version aligned tag: gha-ios-5.0.0


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
Copy link
Contributor

@praveek praveek Nov 6, 2024

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
131 changes: 131 additions & 0 deletions .github/workflows/ios-custom-command-build-and-test.yml
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 }}"
19 changes: 19 additions & 0 deletions .github/workflows/ios-validate-code.yml
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