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

Swift Package Manager support #1465

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
82378a5
IGListDiffKit:
3a4oT Oct 9, 2020
48ff62b
IGListKit:
3a4oT Oct 9, 2020
c2caf74
IGListSwiftKit:
3a4oT Oct 9, 2020
7b111bc
more SPM
3a4oT Oct 10, 2020
b1845d2
symlinks
3a4oT Oct 11, 2020
f654020
Merge branch 'master' into spmBrain
3a4oT Oct 13, 2020
40b82dd
added spm support for IGListDiffKit
3a4oT Oct 7, 2020
d783d79
added SPM support for IGListKit
3a4oT Oct 7, 2020
26d6092
added spm support for IGListSwiftKit
3a4oT Oct 7, 2020
41833cc
fixed pod integration
3a4oT Oct 8, 2020
a746022
cxx11
3a4oT Oct 8, 2020
2632f6b
exp 1
3a4oT Oct 8, 2020
f8faa5d
podspec
3a4oT Oct 11, 2020
b48353c
Merge branch 'moreSPM' into spmBrain
3a4oT Oct 13, 2020
b5bf2af
dropped USE_PACKAGE_FROM_XCODE
3a4oT Oct 13, 2020
abc97a0
work with podspec
3a4oT Oct 13, 2020
961b4ca
cleanup Package.swift
3a4oT Oct 13, 2020
8d6d2ed
Merge branch 'master' into spmBrain
3a4oT Oct 19, 2020
d557d76
run iOS tests on Xcode12. fixed tvOS build on Xcode 12.
3a4oT Nov 11, 2020
df4fb90
added github CI workflow for Xcode12
3a4oT Nov 12, 2020
f7677da
Merge branch 'master' into spmBrain
3a4oT Nov 12, 2020
4c3dc95
Merge branch 'xcode12' into spmBrain
3a4oT Nov 12, 2020
5f5a1b2
fixed Xcode build
3a4oT Nov 12, 2020
8547433
c11
3a4oT Nov 12, 2020
c593f96
fixed yml
3a4oT Nov 13, 2020
a40f6c3
fixed tvOS
3a4oT Nov 17, 2020
be31a89
Merge branch 'xcode12' into spmBrain
3a4oT Nov 17, 2020
c8ce68d
added a test job which can verify SPM variant of build.
3a4oT Nov 17, 2020
af24a4f
adjusted new umbrella header path for jazzy docs
3a4oT Nov 17, 2020
e565ab3
fixed macOS tests
3a4oT Nov 17, 2020
f212406
remove redundent jobs.
3a4oT Nov 17, 2020
072e409
added test project to examples folder to track Xcode's spm integration
3a4oT Nov 18, 2020
d6367c5
filled Changelog
3a4oT Nov 19, 2020
5072642
try workaround CI issues for Carthage build
3a4oT Nov 19, 2020
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
224 changes: 224 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
name: "IGListKit CI"
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this since you created a separate PR here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just found out that all the files are deleted and re-added, this lost all the previous git history or blame, could you use the "git mv" or similar to mark the file as a move instead of "delete+add"? The goal is to keep the git history and blame for each file so that we know who was the original author. Thanks!

Sorry for the mess, it was a hard time put those together and I moved files around with different combinations. I think I found a better solution for it, please see #1487. I tried to keep changes as small as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PS. About CI: while there is another open #1478 only for CI support, this PR was based on it since I need some way to verify my changes. If I remove support (in #1487 I didn't add it at all, for now) how we will see the progress/status? Or your plan is to land #1478 first?


on:
push:
branches:
- master
pull_request:
branches:
- '*'

jobs:
macOS:
name: Unit Test macOS
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.1.1.app/Contents/Developer
WORKSPACE_NAME: IGListKit.xcworkspace
SCHEME_NAME: IGListKit-macOS
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache RubyGems
uses: actions/cache@v2
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
#DEBUG locally
# xcodebuild build build-for-testing -workspace "IGListKit.xcworkspace" -scheme "IGListKit-macOS" -destination "platform=macOS" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
# xcodebuild analyze test-without-building -workspace "IGListKit.xcworkspace" -scheme "IGListKit-macOS" -destination "platform=macOS" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
run: |
set -o pipefail
xcodebuild build build-for-testing -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "platform=macOS" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
xcodebuild analyze test-without-building -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "platform=macOS" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c

iOS:
name: Unit Test iOS
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.1.1.app/Contents/Developer
WORKSPACE_NAME: IGListKit.xcworkspace
SCHEME_NAME: IGListKit
strategy:
matrix:
destination: ["name=iPhone 12 Pro"]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache RubyGems
uses: actions/cache@v2
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 }}
#DEBUG locally
# xcodebuild build build-for-testing -workspace "IGListKit.xcworkspace" -scheme "IGListKit" -destination "OS=14.1,name=iPhone 12 Pro" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
# xcodebuild analyze test-without-building -workspace "IGListKit.xcworkspace" -scheme "IGListKit" -destination "OS=14.1,name=iPhone 12 Pro" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
run: |
set -o pipefail
xcodebuild build build-for-testing -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "${{ matrix.destination }}" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
xcodebuild analyze test-without-building -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "${{ matrix.destination }}" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c

Cocoapods:
name: Cocoapods Lint
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.1.1.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache RubyGems
uses: actions/cache@v2
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"

Carthage:
name: Verify Carthage build
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_11.7.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Remove Examples folder
run: rm -rf Examples/

- name: Carthage build framework
run: carthage build --no-skip-current

Build-Examples:
name: Build Examples and UI tests.
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.1.1.app/Contents/Developer
IOS_EXAMPLE_WORKSPACE: Examples/Examples-iOS/IGListKitExamples.xcworkspace
TVOS_EXAMPLE_WORKSPACE: Examples/Examples-tvOS/IGListKitExamples.xcworkspace
MACOS_EXAMPLE_WORKSPACE: Examples/Examples-macOS/IGListKitExamples.xcworkspace
EXAMPLE_SCHEME: IGListKitExamples
strategy:
matrix:
iosDestination: ["name=iPhone 12 Pro"]
tvOSDestination: ["name=Apple TV 4K"]
macOSDestination: ["platform=macOS"]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache RubyGems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Install ruby gems.
run: bundle install

- name: Prepare local pods
run: bash scripts/setup.sh

- name: Build iOS Example - ${{ matrix.iosDestination }}
run: |
set -o pipefail
xcodebuild build -workspace "${{ env.IOS_EXAMPLE_WORKSPACE }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.iosDestination }}" ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c

- name: Run iOS Example's UI Tests - ${{ matrix.iosDestination }}
run: |
set -o pipefail
xcodebuild build test -workspace "${{ env.IOS_EXAMPLE_WORKSPACE }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c

- name: Build tvOS Example - ${{ matrix.tvOSDestination }}
run: |
set -o pipefail
xcodebuild build -workspace "${{ env.TVOS_EXAMPLE_WORKSPACE }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.tvOSDestination }}" ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c

- name: Build macOS Example - ${{ matrix.macOSDestination }}
run: |
set -o pipefail
xcodebuild build -workspace "${{ env.MACOS_EXAMPLE_WORKSPACE }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.macOSDestination }}" ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c

SPM:
name: Build from SPM manifest
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.1.1.app/Contents/Developer
strategy:
matrix:
destination: ["platform=iOS Simulator,name=iPhone 12 Pro", "platform=macOS,variant=Mac Catalyst", "platform=tvOS Simulator,name=Apple TV 4k"]
scheme: ["IGListKit"]
steps:
- name: Checkout
uses: actions/checkout@v2

# Starting from Xcode 11 `xcodebuild` supports SwiftPM packages out of the box
# to test that we have valid swift package we need to remove existing *.xcodeproj/xcworkspace
# `xcodebuild` will invoke Package.swift.
- name: spm's xcodebuild - ${{ matrix.destination }}
run: |
set -o pipefail
rm -rf IGListKit.xcodeproj/
rm -rf IGListKit.xcworkspace/
xcodebuild clean build -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}"

Build-iOS-SPM-Xcode-Example:
name: Build iOS Example integrated via Xcode's SPM.
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.1.1.app/Contents/Developer
IOS_EXAMPLE_PROJECT: Examples/Examples-iOS-SPM-Xcode/Examples-iOS-SPM-Xcode.xcodeproj
EXAMPLE_SCHEME: Examples-iOS-SPM-Xcode
strategy:
matrix:
iosDestination: ["name=iPhone 12 Pro"]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache RubyGems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Install ruby gems.
run: bundle install

- name: Build iOS Example - ${{ matrix.iosDestination }}
run: |
set -o pipefail
xcodebuild clean build -project "${{ env.IOS_EXAMPLE_PROJECT }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Release ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/
.swiftpm/

# Carthage
#
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag

### Enhancements

- Added [Mac Catalyst](https://developer.apple.com/mac-catalyst/) support. [Petro Rovenskyy](https://github.com/3a4oT/)

- Introduce `IGListSwiftKit`, with Swift refinements for `dequeueReusableCellOfClass` methods. [Koen Punt](https://github.com/koenpunt) [(#1388)](https://github.com/Instagram/IGListKit/pull/1388).

- Added `APPLICATION_EXTENSION_API_ONLY` support for `IGListDiffKit` [Peter Meyers](https://github.com/pm-dev) [(#1422)](https://github.com/Instagram/IGListKit/pull/1422)
Expand All @@ -26,6 +28,8 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag

### Fixes

- Repaired Swift Package Manager support. [Petro Rovenskyy](https://github.com/3a4oT/)

- `IGListCollectionViewLayout` should get the section/index counts via `UICollectionView` to stay in sync, instead of the `dataSource` [Maxime Ollivier](https://github.com/maxolls) (tbd)

- Remove `[collectionView layoutIfNeeded]` before scrolling in `[IGListAdapter scrollToObject...]` to avoid creating off-screen cells. [Maxime Ollivier](https://github.com/maxolls) (tbd)
Expand Down
Loading