add ci
Seto Elkahfi committed
May 18, 2026 at 19:52 UTC
b5ddb94070d68b56d345b7c99fa9965638ef3eab
2 files changed
+253
.github/workflows/ci.yml
new
+98
@@ -0,0 +1,98 @@
1
+name: CI
2
+
3
+on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ workflow_dispatch:
9
+
10
+concurrency:
11
+ group: ci-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+jobs:
15
+ swift-package:
16
+ name: Swift package
17
+ runs-on: macos-15
18
+
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Select Xcode
24
+ uses: maxim-lobanov/setup-xcode@v1
25
+ with:
26
+ xcode-version: latest-stable
27
+
28
+ - name: Show toolchain
29
+ run: |
30
+ xcodebuild -version
31
+ swift --version
32
+
33
+ - name: Build package
34
+ run: |
35
+ xcodebuild \
36
+ -scheme JomloCollectionView \
37
+ -destination "platform=iOS Simulator,name=iPhone 16 Pro" \
38
+ CODE_SIGNING_ALLOWED=NO \
39
+ build
40
+
41
+ - name: Test package
42
+ run: |
43
+ xcodebuild \
44
+ -scheme JomloCollectionView \
45
+ -destination "platform=iOS Simulator,name=iPhone 16 Pro" \
46
+ CODE_SIGNING_ALLOWED=NO \
47
+ test
48
+
49
+ example:
50
+ name: Example app
51
+ runs-on: macos-15
52
+
53
+ strategy:
54
+ fail-fast: false
55
+ matrix:
56
+ include:
57
+ - scheme: JomloCV Example iOS
58
+ destination: platform=iOS Simulator,name=iPhone 16 Pro
59
+ - scheme: JomloCV Example tvOS
60
+ destination: platform=tvOS Simulator,name=Apple TV
61
+
62
+ steps:
63
+ - name: Checkout
64
+ uses: actions/checkout@v4
65
+
66
+ - name: Select Xcode
67
+ uses: maxim-lobanov/setup-xcode@v1
68
+ with:
69
+ xcode-version: latest-stable
70
+
71
+ - name: Build ${{ matrix.scheme }}
72
+ run: |
73
+ xcodebuild \
74
+ -project Example/JomloCollectionViewExample.xcodeproj \
75
+ -scheme "${{ matrix.scheme }}" \
76
+ -destination "${{ matrix.destination }}" \
77
+ CODE_SIGNING_ALLOWED=NO \
78
+ build
79
+
80
+ podspec:
81
+ name: CocoaPods podspec
82
+ runs-on: macos-15
83
+
84
+ steps:
85
+ - name: Checkout
86
+ uses: actions/checkout@v4
87
+
88
+ - name: Select Xcode
89
+ uses: maxim-lobanov/setup-xcode@v1
90
+ with:
91
+ xcode-version: latest-stable
92
+
93
+ - name: Lint podspec
94
+ run: |
95
+ pod lib lint JomloCollectionView.podspec \
96
+ --allow-warnings \
97
+ --platforms=ios,tvos \
98
+ --skip-import-validation
.github/workflows/release.yml
new
+155
@@ -0,0 +1,155 @@
1
+name: Release
2
+
3
+on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+ inputs:
9
+ tag:
10
+ description: "Release tag, for example v1.0.0"
11
+ required: true
12
+ type: string
13
+
14
+permissions:
15
+ contents: write
16
+
17
+concurrency:
18
+ group: release-${{ github.ref }}
19
+ cancel-in-progress: false
20
+
21
+jobs:
22
+ validate:
23
+ name: Validate release
24
+ runs-on: macos-15
25
+
26
+ outputs:
27
+ tag: ${{ steps.version.outputs.tag }}
28
+ version: ${{ steps.version.outputs.version }}
29
+
30
+ steps:
31
+ - name: Checkout
32
+ uses: actions/checkout@v4
33
+ with:
34
+ fetch-depth: 0
35
+ ref: ${{ github.event.inputs.tag || github.ref }}
36
+
37
+ - name: Select Xcode
38
+ uses: maxim-lobanov/setup-xcode@v1
39
+ with:
40
+ xcode-version: latest-stable
41
+
42
+ - name: Resolve version
43
+ id: version
44
+ run: |
45
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
46
+ TAG="${{ github.event.inputs.tag }}"
47
+ else
48
+ TAG="${GITHUB_REF_NAME}"
49
+ fi
50
+
51
+ VERSION="${TAG#v}"
52
+ PODSPEC_VERSION="$(ruby -e "content = File.read('JomloCollectionView.podspec'); puts content[/s\\.version\\s*=\\s*['\\\"]([^'\\\"]+)['\\\"]/, 1]")"
53
+
54
+ if [ -z "$VERSION" ] || [ "$VERSION" = "$TAG" ]; then
55
+ echo "Release tags must use the vMAJOR.MINOR.PATCH format, for example v1.0.0." >&2
56
+ exit 1
57
+ fi
58
+
59
+ if [ "$VERSION" != "$PODSPEC_VERSION" ]; then
60
+ echo "Tag version $VERSION does not match podspec version $PODSPEC_VERSION." >&2
61
+ exit 1
62
+ fi
63
+
64
+ echo "tag=$TAG" >> "$GITHUB_OUTPUT"
65
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
66
+
67
+ - name: Show toolchain
68
+ run: |
69
+ xcodebuild -version
70
+ swift --version
71
+
72
+ - name: Build package
73
+ run: |
74
+ xcodebuild \
75
+ -scheme JomloCollectionView \
76
+ -destination "platform=iOS Simulator,name=iPhone 16 Pro" \
77
+ CODE_SIGNING_ALLOWED=NO \
78
+ build
79
+
80
+ - name: Test package
81
+ run: |
82
+ xcodebuild \
83
+ -scheme JomloCollectionView \
84
+ -destination "platform=iOS Simulator,name=iPhone 16 Pro" \
85
+ CODE_SIGNING_ALLOWED=NO \
86
+ test
87
+
88
+ - name: Build iOS example
89
+ run: |
90
+ xcodebuild \
91
+ -project Example/JomloCollectionViewExample.xcodeproj \
92
+ -scheme "JomloCV Example iOS" \
93
+ -destination "platform=iOS Simulator,name=iPhone 16 Pro" \
94
+ CODE_SIGNING_ALLOWED=NO \
95
+ build
96
+
97
+ - name: Build tvOS example
98
+ run: |
99
+ xcodebuild \
100
+ -project Example/JomloCollectionViewExample.xcodeproj \
101
+ -scheme "JomloCV Example tvOS" \
102
+ -destination "platform=tvOS Simulator,name=Apple TV" \
103
+ CODE_SIGNING_ALLOWED=NO \
104
+ build
105
+
106
+ - name: Lint podspec
107
+ run: |
108
+ pod lib lint JomloCollectionView.podspec \
109
+ --allow-warnings \
110
+ --platforms=ios,tvos \
111
+ --skip-import-validation
112
+
113
+ github-release:
114
+ name: GitHub release
115
+ runs-on: ubuntu-latest
116
+ needs: validate
117
+
118
+ steps:
119
+ - name: Checkout
120
+ uses: actions/checkout@v4
121
+ with:
122
+ ref: ${{ needs.validate.outputs.tag }}
123
+
124
+ - name: Create release
125
+ uses: softprops/action-gh-release@v2
126
+ with:
127
+ tag_name: ${{ needs.validate.outputs.tag }}
128
+ name: JomloCollectionView ${{ needs.validate.outputs.version }}
129
+ generate_release_notes: true
130
+
131
+ cocoapods:
132
+ name: CocoaPods publish
133
+ runs-on: macos-15
134
+ needs:
135
+ - validate
136
+ - github-release
137
+ env:
138
+ COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
139
+
140
+ steps:
141
+ - name: Checkout
142
+ uses: actions/checkout@v4
143
+ with:
144
+ ref: ${{ needs.validate.outputs.tag }}
145
+
146
+ - name: Skip without trunk token
147
+ if: ${{ env.COCOAPODS_TRUNK_TOKEN == '' }}
148
+ run: echo "COCOAPODS_TRUNK_TOKEN is not configured; skipping CocoaPods publish."
149
+
150
+ - name: Publish pod
151
+ if: ${{ env.COCOAPODS_TRUNK_TOKEN != '' }}
152
+ run: |
153
+ pod trunk push JomloCollectionView.podspec \
154
+ --allow-warnings \
155
+ --skip-import-validation