def test() -> None: ui.info_1("Running tests") config_path = ci.tanker_configs.get_path() ci.run( "./gradlew", "tanker-bindings:testRelease", f"-DTANKER_CONFIG_FILEPATH={config_path}", "-DTANKER_CONFIG_NAME=dev", )
def deploy(*, git_tag: str) -> None: version = ci.version_from_git_tag(git_tag) ci.bump_files(version) build(native_from_sources=False) test() ui.info_1("Deploying SDK to maven.tanker.io") ci.gcp.GcpProject("tanker-prod").auth() ci.run("./gradlew", "tanker-bindings:publish")
def build_and_test_pod(self) -> None: ui.info_2("building pod and launching tests") generate_test_config(self.pod_path / "Tests", config_name="dev") ci.run("pod", "lib", "lint", "--verbose", "--allow-warnings", cwd=self.pod_path)
def generate_archive(self) -> Path: version = self.get_version_from_spec() ui.info_1("Generating archive, version:", version) archive_name = "tanker-ios-sdk-%s.tar.gz" % version with self.dest_path: ci.run("tar cfvz %s *" % archive_name, shell=True) shutil.copy(archive_name, self.src_path) res = self.src_path / archive_name ui.info_2("Generated", res) return res
def build_pod(self) -> None: # fmt: off ci.run( "pod", "spec", "lint", "Tanker/Tanker.podspec", "--verbose", "--allow-warnings", "--skip-tests", cwd=self.src_path, )
def generate_fat_libraries(self) -> None: ui.info_1("Generating fat libraries") self.libraries_path.rmtree_p() self.libraries_path.makedirs_p() for lib_name, libs in self.get_all_dependency_libs().items(): output = self.libraries_path / lib_name ci.run("lipo", "-create", "-output", output, *libs, cwd=self.conan_out_path)
def publish_pod(self) -> None: # fmt: off ci.run( "pod", "repo", "push", "tanker", "Tanker/Tanker.podspec", "--skip-tests", "--verbose", "--allow-warnings", cwd=self.src_path, )
def run_android_tests(src_path): config_path = write_server_config() ci.run("./gradlew", "assembleLocalhost", cwd=src_path) ci.run("./gradlew", "assembleAndroidTest", cwd=src_path) apk_folder = src_path / "app/build/outputs/apk" app_url = send_app(apk_folder) test_url = send_tests(apk_folder) ci.run("yarn") devices = [ "Google Pixel 3-9.0", "Samsung Galaxy S9-8.0", "Samsung Galaxy S6-5.0" ] config = { "devices": devices, "app": app_url, "deviceLogs": "true", "testSuite": test_url, "local": "true", } with ci.run_in_background("BrowserStackLocal", "--key", get_browserstack_key()): # Wait for the tunnel to BrowserStack to be established time.sleep(5) with ci.run_in_background("yarn", "start", "--config", config_path): build_id = start_build(config) success = poll_build_status(build_id, devices) if not success: raise Exception("Timeout: BrowserStack tests are still running")
def build(*, native_from_sources: bool) -> None: ui.info_1("build everything") if native_from_sources: ci.run("./gradlew", "tanker-bindings:buildNativeRelease") else: ci.run("./gradlew", "tanker-bindings:useDeployedNativeRelease") ci.run("./gradlew", "tanker-bindings:assembleRelease")
def main() -> None: parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(title="subcommands", dest="command") build_and_test_parser = subparsers.add_parser("build-and-test") build_and_test_parser.add_argument("--profile", dest="profile", required=True) deploy_parser = subparsers.add_parser("mirror") args = parser.parse_args() if args.command == "build-and-test": build_path = Path.getcwd() / "build" / args.profile build_path.makedirs_p() src_path = Path.getcwd() ci.cpp.update_conan_config(sys.platform.lower()) # fmt: off ci.cpp.run_conan("install", src_path, "--profile", args.profile, "--install-folder", build_path) # fmt: on ci.run("cmake", src_path, "-G", "Ninja", cwd=build_path) # fmt: off ctest_flags = [ "--build-and-test", src_path, build_path, "--build-generator", "Ninja", "--output-on-failure", "--test-command", "bin/test_tconcurrent" ] # fmt: on if args.profile == "macos": # When a macOS runner runs the tests, the ones waiting for a specific time will wait longer than requested. # Thus the tests fail. Funny thing is that they pass when running them by hand, on the slave... ctest_flags.append("--test-case-exclude=*[waiting]*") ci.run("ctest", *ctest_flags, cwd=build_path) elif args.command == "mirror": ci.git.mirror(github_url="[email protected]:TankerHQ/tconcurrent") else: parser.print_help() sys.exit(1)
def compile_notepad_ios(): src_path = get_src_path() / "client/ios/notepad/" ci.run("pod", "deintegrate", cwd=src_path) ci.run("pod", "install", "--repo-update", cwd=src_path) # fmt: off ci.run("xcodebuild", "build", "-workspace", "notepad.xcworkspace", "-allowProvisioningUpdates", "-configuration", "Release", "-scheme", "notepad", cwd=src_path)
def run_server_tests(): src_path = get_src_path() ci.run("yarn", "test", check=True, cwd=src_path / "server")
def run_linters(): src_path = get_src_path() ci.run("yarn") ci.run("yarn", "lint", cwd=src_path / "server") ci.run("yarn", "lint", cwd=src_path / "client/web/notepad")
def compile_notepad_android(src_path): ci.run("./gradlew", "assembleRelease", cwd=src_path)
def upload_archive(self, archive_path: Path) -> None: ci.gcp.GcpProject("tanker-prod").enable() ci.run("gsutil", "cp", archive_path, "gs://cocoapods.tanker.io/ios/")
def handle_ios_deps(self) -> None: ui.info_2("Installing Tanker pod dependencies") ci.run("pod", "deintegrate", cwd=self.example_path) ci.run("pod", "install", "--repo-update", cwd=self.example_path)