Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,9 @@ executors:
macos:
macos:
xcode: "15.1"
resource_class: macos.m1.medium.gen1
resource_class: m4pro.medium

jobs:
Check Swift formatting:
executor: macos
steps:
- full-checkout
- run: brew install swiftlint swiftformat
- run: ./automation/tests.py swiftlint
- run: ./automation/tests.py swiftformat
Check Rust formatting:
executor: docker
resource_class: small
Expand Down Expand Up @@ -258,7 +251,7 @@ jobs:
- run: ./automation/tests.py rust-min-version-tests
- save-sccache-cache

iOS test:
iOS artifacts:
executor: macos
steps:
- full-checkout
Expand All @@ -268,11 +261,8 @@ jobs:
- setup-ios-environment
- setup-sccache
- run:
name: Run XCode tests
command: ./automation/tests.py ios-tests
- store_artifacts:
path: raw_xcodetest.log
destination: logs/raw_xcodetest.log
name: Build Swift artifacts
command: ./automation/tests.py ios-artifacts
- save-sccache-cache:
path: "~/Library/Caches/Mozilla.sccache"
- store_artifacts:
Expand All @@ -291,9 +281,6 @@ jobs:

workflows:
version: 2
swiftlint:
jobs:
- Check Swift formatting
check-formatting:
jobs:
- Check Rust formatting
Expand All @@ -309,6 +296,6 @@ workflows:
run-tests-min-supported-version:
jobs:
- Rust tests - min supported rust version
ios-test:
ios-artifacts:
jobs:
- iOS test
- iOS artifacts
2 changes: 1 addition & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ queue_rules:
- label=checkin-needed
- check-success=Decision Task
- check-success=run-tests
- check-success=ios-test-and-artifacts
- check-success=ios-artifacts
- check-success=clippy
- check-success=check-formatting
- "#check-success>=5"
Expand Down
41 changes: 0 additions & 41 deletions .swiftlint.yml

This file was deleted.

20 changes: 20 additions & 0 deletions automation/build_ios_artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -eu


SOURCE_ROOT=$(pwd)
export SOURCE_ROOT
export PROJECT=MozillaRustComponentsWrapper

# Glean deletes everything in the folder it outputs, so we keep them in their own dir
./components/external/glean/glean-core/ios/sdk_generator.sh \
-g Glean \
-o ./megazords/ios-rust/Sources/MozillaRustComponentsWrapper/Generated/Glean \
"${SOURCE_ROOT}"/components/nimbus/metrics.yaml \
"${SOURCE_ROOT}"/components/logins/metrics.yaml \
"${SOURCE_ROOT}"/components/sync_manager/metrics.yaml \
"${SOURCE_ROOT}"/components/sync_manager/pings.yaml

# Build the XCFramework
./megazords/ios-rust/build-xcframework.sh --generate-swift-sources --build-profile release
71 changes: 0 additions & 71 deletions automation/run_ios_tests.sh

This file was deleted.

81 changes: 9 additions & 72 deletions automation/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
- rust-clippy
- rust-fmt
- ktlint
- swiftlint
- swiftformat
- nss-bindings
- gradle
- ios-tests
- ios-artifacts
- python-tests
"""

Expand Down Expand Up @@ -364,39 +363,13 @@ def run_ktlint():
run_command([GRADLE, "ktlint", "detekt"])


def run_swiftlint():
if on_darwin():
run_command(["swiftlint", "--strict"])
elif not docker_installed():
print("WARNING: On non-Darwin hosts, docker is required to run swiftlint")
print("WARNING: skipping swiftlint on non-Darwin host")
else:
cwd = os.getcwd()

run_command(
[
"docker",
"run",
"-it",
"--rm",
"-v",
f"{cwd}:{cwd}",
"-w",
cwd,
"ghcr.io/realm/swiftlint:latest",
"swiftlint",
"--strict",
]
)


def run_gradle_tests():
run_command([GRADLE, "test"])


def run_ios_tests():
def build_ios_artifacts():
if on_darwin():
run_command([AUTOMATION_DIR / "run_ios_tests.sh"])
run_command([AUTOMATION_DIR / "build_ios_artifacts.sh"])
else:
print("WARNING: skipping iOS tests on non-Darwin host")

Expand Down Expand Up @@ -430,41 +403,6 @@ def cargo_fmt(package=None, fix_issues=False):
run_command(cmdline)


def swift_format():
swift_format_args = [
"megazords",
"--exclude",
"**/Generated",
"--exclude",
"megazords/ios-rust/Sources/MozillaRustComponentsWrapper/Nimbus/Utils",
"--lint",
"--swiftversion",
"5",
]
if on_darwin():
run_command(["swiftformat", *swift_format_args])
elif not docker_installed():
print("WARNING: On non-Darwin hosts, docker is required to run swiftformat")
print("WARNING: skipping swiftformat on non-Darwin host")
else:
cwd = os.getcwd()

run_command(
[
"docker",
"run",
"-it",
"--rm",
"-v",
f"{cwd}:{cwd}",
"-w",
cwd,
"ghcr.io/nicklockwood/swiftformat:latest",
*swift_format_args,
]
)


def check_for_fmt_changes(branch_changes):
print()
if branch_changes.has_unstanged_changes():
Expand Down Expand Up @@ -556,14 +494,13 @@ def calc_steps(args):
yield Step("cargo fmt", cargo_fmt)
elif args.mode == "ktlint":
yield Step("ktlint", run_ktlint)
elif args.mode == "swiftlint":
yield Step("swiftlint", run_swiftlint)
elif args.mode == "swiftformat":
yield Step("swiftformat", swift_format)
elif args.mode == "nss-bindings":
print_rust_environment()
yield Step("NSS bindings test", run_nss_bindings_test)
elif args.mode == "gradle":
yield Step("gradle tests", run_gradle_tests)
elif args.mode == "ios-tests":
yield Step("ios tests", run_ios_tests)
elif args.mode == "ios-artifacts":
yield Step("ios artifacts", build_ios_artifacts)
elif args.mode == "python-tests":
yield Step("python tests", run_python_tests)
else:
Expand Down
4 changes: 2 additions & 2 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ Configure maven to use the native windows maven repository - then, when doing `.
1. Run `./libs/verify-ios-environment.sh` to check your setup and environment
variables.
- Make any corrections recommended by the script and re-run.
1. Run `./automation/run_ios_tests.sh` to build all the binaries and run tests using the local SPM setup.
1. Run `./automation/build_ios_artifacts.sh` to build all the binaries, UniFFi bindings, Glean metrics generation

> Note: This is mainly for testing the rust components, the artifact generated in the above steps should be all you need for building application with application-services
> Note: The artifacts generated in the above steps can then be used in any consuming product



Expand Down
1 change: 0 additions & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Before submitting a PR:
- Consult the [testing guide](./howtos/testing-a-rust-component.md) for some tips on writing effective tests.
- Your code should pass all the automated tests before you submit your PR for review.
- Before pushing your changes, run `./automation/tests.py changes`. The script will calculate which components were changed and run test suites, linters and formatters against those components. Because the script runs a limited set of tests, the script should execute in a fairly reasonable amount of time.
- If you have modified any Swift code, also run `swiftformat --swiftversion 5` on the modified code.
- Your patch should include a changelog entry in [CHANGELOG.md](https://github.com/mozilla/application-services/blob/main/CHANGELOG.md) or an explanation of why
it does not need one. Any breaking changes to Swift or Kotlin binding APIs should be noted explicitly.
- If your patch adds new dependencies, they must follow our [dependency management guidelines](./dependency-management.md).
Expand Down
Loading