-
Notifications
You must be signed in to change notification settings - Fork 8
130 lines (103 loc) · 4.17 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI
on:
push:
branches:
- develop
- master
pull_request:
branches:
- "*"
env:
CACHED_PACKAGE_DEPENDENCY_PATHS: ${{ github.workspace }}/Tuist/Dependencies
CACHED_CARTHAGE_DEPENDENCY_PATHS: ${{ github.workspace }}/Carthage
MASTER_KEY_PATH: Tuist/master.key
GOOGLE_SERVICE_INFO_PLIST_PATH: Projects/App/Resources/GoogleService-Info.plist
SECRET_XCCONFIG_PATH: Projects/App/XCConfig/Secrets.xcconfig
jobs:
prepare-ci:
name: ⚙️ Prepare CI
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer
- name: Compute package dependency cache key
id: compute_package_hash
run: echo "package_hash=${{ hashFiles('Package.swift') }}" >> $GITHUB_OUTPUT
- name: Check package dependency cache
uses: actions/cache@v3
id: cache_package_dependencies
with:
path: ${{ env.CACHED_PACKAGE_DEPENDENCY_PATHS }}
key: ${{ steps.compute_package_hash.outputs.package_hash }}
- name: Compute carthage dependency cache key
id: compute_carthage_hash
run: echo "carthage_hash=${{ hashFiles('Cartfile') }}" >> $GITHUB_OUTPUT
- name: Check carthage dependency cache
uses: actions/cache@v3
id: cache_carthage_dependencies
with:
path: ${{ env.CACHED_CARTHAGE_DEPENDENCY_PATHS }}
key: ${{ steps.compute_carthage_hash.outputs.carthage_hash }}
- uses: jdx/mise-action@v2
if: steps.cache_package_dependencies.outputs.cache-hit == '' || steps.cache_carthage_dependencies.outputs.cache-hit == ''
- name: Install tuist
if: steps.cache_package_dependencies.outputs.cache-hit == '' || steps.cache_carthage_dependencies.outputs.cache-hit == ''
run: |
brew install carthage
mise install tuist
- name: Install dependencies needs
if: steps.cache_package_dependencies.outputs.cache-hit == '' || steps.cache_carthage_dependencies.outputs.cache-hit == ''
run: make install
outputs:
package_dependency_cache_key: ${{ steps.compute_package_hash.outputs.package_hash }}
carthage_dependency_cache_key: ${{ steps.compute_carthage_hash.outputs.carthage_hash }}
test:
name: 🧪 Test
runs-on: macos-14
needs: prepare-ci
steps:
- uses: actions/checkout@v3
- name: List Xcode installations
run: sudo ls -1 /Applications | grep "Xcode"
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer
- name: Show swift version
run: swift --version
- uses: jdx/mise-action@v2
- name: Install tuist
run: |
brew install carthage
mise install tuist
- name: Check package dependency cache
uses: actions/cache@v3
id: cache_package_dependencies
with:
path: ${{ env.CACHED_PACKAGE_DEPENDENCY_PATHS }}
key: ${{ needs.prepare-ci.outputs.package_dependency_cache_key }}
- name: Check carthage dependency cache
uses: actions/cache@v3
id: cache_carthage_dependencies
with:
path: ${{ env.CACHED_CARTHAGE_DEPENDENCY_PATHS }}
key: ${{ needs.prepare-ci.outputs.carthage_dependency_cache_key }}
- name: Install needle
run: brew install needle
- name: Install dependencies needs
if: steps.cache_package_dependencies.outputs.cache-hit != 'true' || steps.cache_carthage_dependencies.outputs.cache-hit != 'true'
run: make install
- name: Make `Secrets.xcconfig`
run: |
mkdir Projects/App/XCConfig
touch ${{ env.SECRET_XCCONFIG_PATH }}
echo "" > ${{ env.SECRET_XCCONFIG_PATH }}
- name: Make `GoogleService-Info.plist`
run: |
touch ${{ env.GOOGLE_SERVICE_INFO_PLIST_PATH }}
echo "${{ secrets.GOOGLE_INFO_PLIST }}" > ${{ env.GOOGLE_SERVICE_INFO_PLIST_PATH }}
- name: Generate NeedleGenerated.swift
run: |
sh Scripts/NeedleRunScript.sh ci
echo finish NeedleRunScript
- name: Test with tuist
run: make test