Skip to content

Commit

Permalink
Merge branch 'theo/m1_support' into 'master'
Browse files Browse the repository at this point in the history
add M1 support

See merge request TankerHQ/sdk-rust!49
  • Loading branch information
theodelrieu committed Jul 7, 2021
2 parents d5c5098 + 3ecfee5 commit 402f93d
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 27 deletions.
92 changes: 72 additions & 20 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include:
project: TankerHQ/gitlab-ci-files
file: /rust.yml
ref: a247a7f1fd9d33f89f95cce4f7c0105b1cc5d6b0
ref: 2021-07-07-1

check/native-from-sources/linux:
extends:
Expand All @@ -19,21 +19,37 @@ check/native-from-sources/android:
script:
- 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

check/native-from-sources/macos:
check/native-from-sources/macos/x86_64:
extends:
- .check
- .tags/macos
- .tags/macos/x86_64
- .rules/native-from-sources
script:
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile macos-release
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile macos-x86_64-release

check/native-from-sources/ios:
check/native-from-sources/macos/arm:
extends:
- .check
- .tags/macos
- .tags/macos/arm
- .rules/native-from-sources
script:
- 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
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=same-as-branch --profile macos-armv8-release

check/native-from-sources/ios/x86_64:
extends:
- .check
- .tags/macos/x86_64
- .rules/native-from-sources
script:
- 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

check/native-from-sources/ios/arm:
extends:
- .check
- .tags/macos/arm
- .rules/native-from-sources
script:
- 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

check/deployed-native/linux:
extends:
Expand All @@ -53,23 +69,41 @@ check/deployed-native/android:
script:
- 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

check/deployed-native/macos:
check/deployed-native/macos/x86_64:
extends:
- .check
- .tags/macos/x86_64
- .rules/deployed-native/release-artifacts
- .release-artifacts
script:
- 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

check/deployed-native/macos/arm:
extends:
- .check
- .tags/macos
- .tags/macos/arm
- .rules/deployed-native/release-artifacts
- .release-artifacts
script:
- 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
- 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

check/deployed-native/ios:
check/deployed-native/ios/x86_64:
extends:
- .check
- .tags/macos
- .tags/macos/x86_64
- .rules/deployed-native/release-artifacts
- .release-artifacts
script:
- 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
- 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

check/deployed-native/ios/arm:
extends:
- .check
- .tags/macos/arm
- .rules/deployed-native/release-artifacts
- .release-artifacts
script:
- 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

check/downstream/linux:
extends:
Expand All @@ -89,23 +123,41 @@ check/downstream/android:
script:
- 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

check/downstream/ios:
check/downstream/ios/x86_64:
extends:
- .check
- .tags/macos/x86_64
- .rules/check/downstream/ios
- .before-script/download-artifacts
script:
- 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

check/downstream/ios/arm:
extends:
- .check
- .tags/macos
- .tags/macos/arm
- .rules/check/downstream/ios
- .before-script/download-artifacts
script:
- 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
- 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

check/downstream/macos/x86_64:
extends:
- .check
- .tags/macos/x86_64
- .rules/check/downstream/macos/x86_64
- .before-script/download-artifacts
script:
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile macos-x86_64-release

check/downstream/macos:
check/downstream/macos/arm:
extends:
- .check
- .tags/macos
- .rules/check/downstream/macos
- .tags/macos/arm
- .rules/check/downstream/macos/arm
- .before-script/download-artifacts
script:
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile macos-release
- poetry run python run-ci.py --isolate-conan-user-home build-and-test --use-tanker=upstream --profile macos-armv8-release

deploy:
extends:
Expand Down
38 changes: 31 additions & 7 deletions run-ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
"x86_64-linux-android",
"i686-linux-android",
"aarch64-apple-ios",
"aarch64-apple-ios-sim",
"aarch64-apple-darwin",
"x86_64-apple-ios",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
]


def profile_to_rust_target(platform: str, arch: str) -> str:
def profile_to_rust_target(platform: str, arch: str, sdk: Optional[str]) -> str:
if platform == "Android":
if arch == "armv7":
return "armv7-linux-androideabi"
Expand All @@ -38,10 +40,17 @@ def profile_to_rust_target(platform: str, arch: str) -> str:
elif arch == "x86":
return "i686-linux-android"
elif platform == "Macos":
return "x86_64-apple-darwin"
if arch == "x86_64":
return "x86_64-apple-darwin"
elif arch == "armv8":
return "aarch64-apple-darwin"
elif platform == "iOS":
if arch == "armv8":
return "aarch64-apple-ios"
# TODO this is Tier 3, wait for a few weeks before being able to build for armv8 simulator
if sdk == "iphonesimulator":
return "aarch64-apple-ios-sim"
else:
return "aarch64-apple-ios"
elif arch == "x86_64":
return "x86_64-apple-ios"
elif platform == "Linux":
Expand Down Expand Up @@ -100,8 +109,11 @@ def __init__(self, *, src_path: Path, tanker_source: TankerSource, profile: str)
self.profile = profile
self.tanker_source = tanker_source
self.platform = tankerci.conan.get_profile_key("settings.os", profile)
self.sdk = None
if self.platform == "iOS":
self.sdk = tankerci.conan.get_profile_key("settings.os.sdk", profile)
self.arch = tankerci.conan.get_profile_key("settings.arch", profile)
self.target_triplet = profile_to_rust_target(self.platform, self.arch)
self.target_triplet = profile_to_rust_target(self.platform, self.arch, self.sdk)

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

def test(self) -> None:
if not self._is_host_target():
tankerci.run(
"cargo", "build", "--target", self.target_triplet, cwd=self.src_path
)
if self.target_triplet == "aarch64-apple-ios-sim":
tankerci.run(
"cargo",
"+nightly",
"build",
"-Z",
"build-std",
"--target",
self.target_triplet,
cwd=self.src_path,
)
else:
tankerci.run(
"cargo", "build", "--target", self.target_triplet, cwd=self.src_path
)
ui.info(self.profile, "is a cross-compiled target, skipping tests")
return
tankerci.run("cargo", "fmt", "--", "--check", cwd=self.src_path)
Expand Down

0 comments on commit 402f93d

Please sign in to comment.