Skip to content

Commit 402f93d

Browse files
committed
Merge branch 'theo/m1_support' into 'master'
add M1 support See merge request TankerHQ/sdk-rust!49
2 parents d5c5098 + 3ecfee5 commit 402f93d

File tree

2 files changed

+103
-27
lines changed

2 files changed

+103
-27
lines changed

.gitlab-ci.yml

Lines changed: 72 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include:
22
project: TankerHQ/gitlab-ci-files
33
file: /rust.yml
4-
ref: a247a7f1fd9d33f89f95cce4f7c0105b1cc5d6b0
4+
ref: 2021-07-07-1
55

66
check/native-from-sources/linux:
77
extends:
@@ -19,21 +19,37 @@ check/native-from-sources/android:
1919
script:
2020
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile android-armv8-release-static --profile android-x86_64-release-static --profile android-x86-release-static --profile android-armv7-release-static
2121

22-
check/native-from-sources/macos:
22+
check/native-from-sources/macos/x86_64:
2323
extends:
2424
- .check
25-
- .tags/macos
25+
- .tags/macos/x86_64
2626
- .rules/native-from-sources
2727
script:
28-
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile macos-release
28+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile macos-x86_64-release
2929

30-
check/native-from-sources/ios:
30+
check/native-from-sources/macos/arm:
3131
extends:
3232
- .check
33-
- .tags/macos
33+
- .tags/macos/arm
3434
- .rules/native-from-sources
3535
script:
36-
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile ios-armv8-release --profile ios-x86_64-release
36+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile macos-armv8-release
37+
38+
check/native-from-sources/ios/x86_64:
39+
extends:
40+
- .check
41+
- .tags/macos/x86_64
42+
- .rules/native-from-sources
43+
script:
44+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile ios-armv8-release --profile ios-simulator-x86_64-release
45+
46+
check/native-from-sources/ios/arm:
47+
extends:
48+
- .check
49+
- .tags/macos/arm
50+
- .rules/native-from-sources
51+
script:
52+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile ios-armv8-release --profile ios-simulator-armv8-release
3753

3854
check/deployed-native/linux:
3955
extends:
@@ -53,23 +69,41 @@ check/deployed-native/android:
5369
script:
5470
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=deployed --tanker-ref=$SDK_NATIVE_LATEST_CONAN_REFERENCE --profile android-armv8-release-static --profile android-x86_64-release-static --profile android-x86-release-static --profile android-armv7-release-static
5571

56-
check/deployed-native/macos:
72+
check/deployed-native/macos/x86_64:
73+
extends:
74+
- .check
75+
- .tags/macos/x86_64
76+
- .rules/deployed-native/release-artifacts
77+
- .release-artifacts
78+
script:
79+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=deployed --tanker-ref=$SDK_NATIVE_LATEST_CONAN_REFERENCE --profile macos-x86_64-release
80+
81+
check/deployed-native/macos/arm:
5782
extends:
5883
- .check
59-
- .tags/macos
84+
- .tags/macos/arm
6085
- .rules/deployed-native/release-artifacts
6186
- .release-artifacts
6287
script:
63-
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=deployed --tanker-ref=$SDK_NATIVE_LATEST_CONAN_REFERENCE --profile macos-release
88+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=deployed --tanker-ref=$SDK_NATIVE_LATEST_CONAN_REFERENCE --profile macos-armv8-release
6489

65-
check/deployed-native/ios:
90+
check/deployed-native/ios/x86_64:
6691
extends:
6792
- .check
68-
- .tags/macos
93+
- .tags/macos/x86_64
6994
- .rules/deployed-native/release-artifacts
7095
- .release-artifacts
7196
script:
72-
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=deployed --tanker-ref=$SDK_NATIVE_LATEST_CONAN_REFERENCE --profile ios-armv8-release --profile ios-x86_64-release
97+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=deployed --tanker-ref=$SDK_NATIVE_LATEST_CONAN_REFERENCE --profile ios-armv8-release --profile ios-simulator-x86_64-release
98+
99+
check/deployed-native/ios/arm:
100+
extends:
101+
- .check
102+
- .tags/macos/arm
103+
- .rules/deployed-native/release-artifacts
104+
- .release-artifacts
105+
script:
106+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=deployed --tanker-ref=$SDK_NATIVE_LATEST_CONAN_REFERENCE --profile ios-armv8-release --profile ios-simulator-armv8-release
73107

74108
check/downstream/linux:
75109
extends:
@@ -89,23 +123,41 @@ check/downstream/android:
89123
script:
90124
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile android-armv8-release-static --profile android-x86_64-release-static --profile android-x86-release-static --profile android-armv7-release-static
91125

92-
check/downstream/ios:
126+
check/downstream/ios/x86_64:
127+
extends:
128+
- .check
129+
- .tags/macos/x86_64
130+
- .rules/check/downstream/ios
131+
- .before-script/download-artifacts
132+
script:
133+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile ios-armv8-release --profile ios-simulator-x86_64-release
134+
135+
check/downstream/ios/arm:
93136
extends:
94137
- .check
95-
- .tags/macos
138+
- .tags/macos/arm
96139
- .rules/check/downstream/ios
97140
- .before-script/download-artifacts
98141
script:
99-
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile ios-armv8-release --profile ios-x86_64-release
142+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile ios-armv8-release --profile ios-simulator-armv8-release
143+
144+
check/downstream/macos/x86_64:
145+
extends:
146+
- .check
147+
- .tags/macos/x86_64
148+
- .rules/check/downstream/macos/x86_64
149+
- .before-script/download-artifacts
150+
script:
151+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile macos-x86_64-release
100152

101-
check/downstream/macos:
153+
check/downstream/macos/arm:
102154
extends:
103155
- .check
104-
- .tags/macos
105-
- .rules/check/downstream/macos
156+
- .tags/macos/arm
157+
- .rules/check/downstream/macos/arm
106158
- .before-script/download-artifacts
107159
script:
108-
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile macos-release
160+
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile macos-armv8-release
109161

110162
deploy:
111163
extends:

run-ci.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
"x86_64-linux-android",
2222
"i686-linux-android",
2323
"aarch64-apple-ios",
24+
"aarch64-apple-ios-sim",
25+
"aarch64-apple-darwin",
2426
"x86_64-apple-ios",
2527
"x86_64-apple-darwin",
2628
"x86_64-unknown-linux-gnu",
2729
]
2830

2931

30-
def profile_to_rust_target(platform: str, arch: str) -> str:
32+
def profile_to_rust_target(platform: str, arch: str, sdk: Optional[str]) -> str:
3133
if platform == "Android":
3234
if arch == "armv7":
3335
return "armv7-linux-androideabi"
@@ -38,10 +40,17 @@ def profile_to_rust_target(platform: str, arch: str) -> str:
3840
elif arch == "x86":
3941
return "i686-linux-android"
4042
elif platform == "Macos":
41-
return "x86_64-apple-darwin"
43+
if arch == "x86_64":
44+
return "x86_64-apple-darwin"
45+
elif arch == "armv8":
46+
return "aarch64-apple-darwin"
4247
elif platform == "iOS":
4348
if arch == "armv8":
44-
return "aarch64-apple-ios"
49+
# TODO this is Tier 3, wait for a few weeks before being able to build for armv8 simulator
50+
if sdk == "iphonesimulator":
51+
return "aarch64-apple-ios-sim"
52+
else:
53+
return "aarch64-apple-ios"
4554
elif arch == "x86_64":
4655
return "x86_64-apple-ios"
4756
elif platform == "Linux":
@@ -100,8 +109,11 @@ def __init__(self, *, src_path: Path, tanker_source: TankerSource, profile: str)
100109
self.profile = profile
101110
self.tanker_source = tanker_source
102111
self.platform = tankerci.conan.get_profile_key("settings.os", profile)
112+
self.sdk = None
113+
if self.platform == "iOS":
114+
self.sdk = tankerci.conan.get_profile_key("settings.os.sdk", profile)
103115
self.arch = tankerci.conan.get_profile_key("settings.arch", profile)
104-
self.target_triplet = profile_to_rust_target(self.platform, self.arch)
116+
self.target_triplet = profile_to_rust_target(self.platform, self.arch, self.sdk)
105117

106118
def _is_android_target(self) -> bool:
107119
return self.platform == "Android"
@@ -197,9 +209,21 @@ def prepare(self, update: bool, tanker_ref: Optional[str] = None) -> None:
197209

198210
def test(self) -> None:
199211
if not self._is_host_target():
200-
tankerci.run(
201-
"cargo", "build", "--target", self.target_triplet, cwd=self.src_path
202-
)
212+
if self.target_triplet == "aarch64-apple-ios-sim":
213+
tankerci.run(
214+
"cargo",
215+
"+nightly",
216+
"build",
217+
"-Z",
218+
"build-std",
219+
"--target",
220+
self.target_triplet,
221+
cwd=self.src_path,
222+
)
223+
else:
224+
tankerci.run(
225+
"cargo", "build", "--target", self.target_triplet, cwd=self.src_path
226+
)
203227
ui.info(self.profile, "is a cross-compiled target, skipping tests")
204228
return
205229
tankerci.run("cargo", "fmt", "--", "--check", cwd=self.src_path)

0 commit comments

Comments
 (0)