IGListKit/.github/workflows/CI.yml
Tim Oliver e5bc6bcae6 Remove using CocoaPods to build IGListKit's test suite (#1641)
Summary:
## Changes in this pull request

[As was announced in late 2024](https://blog.cocoapods.org/CocoaPods-Specs-Repo/), CocoaPods will be eventually sunset with the tentative end date being at the end of 2026.

While we had already migrated all of IGListKit's sample apps to use SPM, the main Xcode project was still relying on CocoaPods to import OCMock as a dependency of running its test suite.

In order to get ahead of this eventual shut down, this PR completely removes CocoaPods as a dependency of running any of the projects in this repo and moves OCMock over to an SPM import. This ends up actually being a better experience since now, all anyone needs to do is open `IGListKit.xcodeproj` without needing to run anything beforehand, and Xcode will automatically handle the rest.

Please note this doesn't remove IGListKit from CocoaPods itself. IGListKit will still be available as a CocoaPods dependency.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1641

Test Plan:
All GitHub pipelines still working:

 {F1982500959}

Reviewed By: fabiomassimo

Differential Revision: D83946914

Pulled By: TimOliver

fbshipit-source-id: 3542451379b57c87c88fc95684fb3595a09c8fd6
2025-10-06 08:21:43 -07:00

260 lines
9.7 KiB
YAML

name: "IGListKit CI"
on:
push:
branches:
- main
pull_request:
branches:
- '*'
jobs:
macOS:
name: Unit Test macOS
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode.app
PROJECT_NAME: IGListKit.xcodeproj
SCHEME_NAME: IGListKit-macOS
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Run unit tests for macOS
run: |
set -o pipefail
xcodebuild build build-for-testing -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "platform=macOS" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
xcodebuild analyze test-without-building -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "platform=macOS" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
iOS:
name: Unit Test iOS
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode.app
PROJECT_NAME: IGListKit.xcodeproj
SCHEME_NAME: IGListKit
strategy:
matrix:
destination: ["platform=iOS Simulator,name=iPhone Air,OS=26.0"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: iOS - ${{ matrix.destination }}
run: |
set -o pipefail
xcodebuild build build-for-testing -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "${{ matrix.destination }}" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
xcodebuild analyze test-without-building -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "${{ matrix.destination }}" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
- name: Upload code coverage
run: bundle exec slather
env:
COVERAGE_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_PULL_REQUEST: ${{ github.event.number }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
CocoaPods:
name: CocoaPods Lint
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode.app
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Run IGListDiffKit podspec lint
run: bundle exec pod lib lint IGListDiffKit.podspec --allow-warnings
- name: Run IGListKit podspec lint
run: bundle exec pod lib lint IGListKit.podspec --allow-warnings "--include-podspecs=IGListDiffKit.podspec"
- name: Run IGListSwiftKit podspec lint
run: bundle exec pod lib lint IGListSwiftKit.podspec --allow-warnings "--include-podspecs=*.podspec"
SPM-layout-generator:
name: Verify generate_spm_sources_layout.sh is not broken
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode.app
PROJECT_NAME: IGListKit.xcodeproj
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone Air,OS=26.0"
SPM_IG_LIST_DIFF_KIT_PUBLIC_HEADERS_PATH: "spm/Sources/IGListDiffKit/include"
SPM_IG_LIST_DIFF_KIT_SOURCES_PATH: "spm/Sources/IGListDiffKit"
SPM_IG_LIST_KIT_PUBLIC_HEADERS_PATH: "spm/Sources/IGListKit/include"
SPM_IG_LIST_KIT_SOURCES_PATH: "spm/Sources/IGListKit"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Manually clean SPM Sources folder
run: |
rm -rf "${{ env.SPM_IG_LIST_DIFF_KIT_PUBLIC_HEADERS_PATH }}/*.*"
rm -rf "${{ env.SPM_IG_LIST_DIFF_KIT_SOURCES_PATH }}/*.*"
rm -rf "${{ env.SPM_IG_LIST_KIT_PUBLIC_HEADERS_PATH }}/*.*"
rm -rf "${{ env.SPM_IG_LIST_KIT_SOURCES_PATH }}/*.*"
- name: Regenerate SPM layout
run: sh scripts/generate_spm_sources_layout.sh
- name: Clean project's ${{ env.PROJECT_NAME }}
run: |
rm -rf "${{ env.PROJECT_NAME }}"
- name: Verify IGListKit can be build using Package.swift which was generated by 'scripts/generate_spm_sources_layout.sh'
run: xcodebuild -scheme "IGListKit" build -destination "${{ env.IOS_DESTINATION }}" | xcpretty
SPM-build-from-Package:
name: Verify SPM build by invoking `xcodebuild` on Package.swift
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode.app
PROJECT_NAME: IGListKit.xcodeproj
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone Air,OS=26.0"
strategy:
matrix:
schemeName: ["IGListDiffKit",
"IGListKit",
"IGListSwiftKit"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clean project's ${{ env.PROJECT_NAME }}
run: |
rm -rf "${{ env.PROJECT_NAME }}"
- name: Run ${{ matrix.schemeName}} using Package.swift
run: xcodebuild -scheme "${{ matrix.schemeName}}" build -destination "${{ env.IOS_DESTINATION }}" | xcpretty
Carthage-XCFramework:
name: Verify Carthage build XCFramework
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode.app
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Carthage build framework
run: carthage build --no-skip-current --use-xcframeworks
Build-Examples:
name: Build Examples and UI tests.
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode.app
IOS_EXAMPLE_XCODEPROJ: Examples/Examples-iOS/IGListKitExamples.xcodeproj
TVOS_EXAMPLE_XCODEPROJ: Examples/Examples-tvOS/IGListKitExamples.xcodeproj
MACOS_EXAMPLE_XCODEPROJ: Examples/Examples-macOS/IGListKitExamples.xcodeproj
EXAMPLE_SCHEME: IGListKitExamples
strategy:
matrix:
iosDestination: ["platform=iOS Simulator,name=iPhone Air,OS=26.0"]
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV 4K (3rd generation)"]
macOSDestination: ["platform=macOS"]
macCatalystDestination: ["platform=macOS,variant=Mac Catalyst"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Preboot iOS Simulator
uses: futureware-tech/simulator-action@v2
with:
model: 'iPhone Air'
os_version: '=26.0'
- name: Build iOS Example - ${{ matrix.iosDestination }}
run: |
set -o pipefail
xcodebuild build build-for-testing -project "${{ env.IOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
- name: Run iOS Example's UI Tests - ${{ matrix.iosDestination }}
run: |
set -o pipefail
xcodebuild build test -project "${{ env.IOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
- name: Build tvOS Example - ${{ matrix.tvOSDestination }}
run: |
set -o pipefail
xcodebuild build -project "${{ env.TVOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
- name: Build macOS Example - ${{ matrix.macOSDestination }}
run: |
set -o pipefail
xcodebuild build -project "${{ env.MACOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
- name: Build Mac Catalyst Example - ${{ matrix.macCatalystDestination }}
run: |
set -o pipefail
xcodebuild build -project "${{ env.IOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.macCatalystDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
Danger:
name: Run Danger
if: github.event_name == 'pull_request'
runs-on: macos-26
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Run Danger
run: bundle exec danger --verbose