Skip to content

Commit cbd4553

Browse files
committed
remove swiftlint, swiftformat, and update CI to reflect changes
1 parent 658da09 commit cbd4553

File tree

16 files changed

+44
-241
lines changed

16 files changed

+44
-241
lines changed

.circleci/config.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,9 @@ executors:
200200
macos:
201201
macos:
202202
xcode: "15.1"
203-
resource_class: macos.m1.medium.gen1
203+
resource_class: m4pro.medium
204204

205205
jobs:
206-
Check Swift formatting:
207-
executor: macos
208-
steps:
209-
- full-checkout
210-
- run: brew install swiftlint swiftformat
211-
- run: ./automation/tests.py swiftlint
212-
- run: ./automation/tests.py swiftformat
213206
Check Rust formatting:
214207
executor: docker
215208
resource_class: small
@@ -258,7 +251,7 @@ jobs:
258251
- run: ./automation/tests.py rust-min-version-tests
259252
- save-sccache-cache
260253

261-
iOS test:
254+
iOS artifacts:
262255
executor: macos
263256
steps:
264257
- full-checkout
@@ -268,11 +261,8 @@ jobs:
268261
- setup-ios-environment
269262
- setup-sccache
270263
- run:
271-
name: Run XCode tests
272-
command: ./automation/tests.py ios-tests
273-
- store_artifacts:
274-
path: raw_xcodetest.log
275-
destination: logs/raw_xcodetest.log
264+
name: Build Swift artifacts
265+
command: ./automation/tests.py ios-artifacts
276266
- save-sccache-cache:
277267
path: "~/Library/Caches/Mozilla.sccache"
278268
- store_artifacts:
@@ -291,9 +281,6 @@ jobs:
291281

292282
workflows:
293283
version: 2
294-
swiftlint:
295-
jobs:
296-
- Check Swift formatting
297284
check-formatting:
298285
jobs:
299286
- Check Rust formatting
@@ -309,6 +296,6 @@ workflows:
309296
run-tests-min-supported-version:
310297
jobs:
311298
- Rust tests - min supported rust version
312-
ios-test:
299+
ios-artifacts:
313300
jobs:
314-
- iOS test
301+
- iOS artifacts

.mergify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ queue_rules:
77
- label=checkin-needed
88
- check-success=Decision Task
99
- check-success=run-tests
10-
- check-success=ios-test-and-artifacts
10+
- check-success=ios-artifacts
1111
- check-success=clippy
1212
- check-success=check-formatting
1313
- "#check-success>=5"

.swiftlint.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

automation/build_ios_artifacts.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
6+
SOURCE_ROOT=$(pwd)
7+
export SOURCE_ROOT
8+
export PROJECT=MozillaRustComponentsWrapper
9+
10+
# Glean deletes everything in the folder it outputs, so we keep them in their own dir
11+
./components/external/glean/glean-core/ios/sdk_generator.sh \
12+
-g Glean \
13+
-o ./megazords/ios-rust/Sources/MozillaRustComponentsWrapper/Generated/Glean \
14+
"${SOURCE_ROOT}"/components/nimbus/metrics.yaml \
15+
"${SOURCE_ROOT}"/components/logins/metrics.yaml \
16+
"${SOURCE_ROOT}"/components/sync_manager/metrics.yaml \
17+
"${SOURCE_ROOT}"/components/sync_manager/pings.yaml
18+
19+
# Build the XCFramework
20+
./megazords/ios-rust/build-xcframework.sh --generate-swift-sources --build-profile release

automation/run_ios_tests.sh

Lines changed: 0 additions & 71 deletions
This file was deleted.

automation/tests.py

Lines changed: 9 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
- rust-clippy
2626
- rust-fmt
2727
- ktlint
28-
- swiftlint
29-
- swiftformat
28+
- nss-bindings
3029
- gradle
31-
- ios-tests
30+
- ios-artifacts
3231
- python-tests
3332
"""
3433

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

366365

367-
def run_swiftlint():
368-
if on_darwin():
369-
run_command(["swiftlint", "--strict"])
370-
elif not docker_installed():
371-
print("WARNING: On non-Darwin hosts, docker is required to run swiftlint")
372-
print("WARNING: skipping swiftlint on non-Darwin host")
373-
else:
374-
cwd = os.getcwd()
375-
376-
run_command(
377-
[
378-
"docker",
379-
"run",
380-
"-it",
381-
"--rm",
382-
"-v",
383-
f"{cwd}:{cwd}",
384-
"-w",
385-
cwd,
386-
"ghcr.io/realm/swiftlint:latest",
387-
"swiftlint",
388-
"--strict",
389-
]
390-
)
391-
392-
393366
def run_gradle_tests():
394367
run_command([GRADLE, "test"])
395368

396369

397-
def run_ios_tests():
370+
def build_ios_artifacts():
398371
if on_darwin():
399-
run_command([AUTOMATION_DIR / "run_ios_tests.sh"])
372+
run_command([AUTOMATION_DIR / "build_ios_artifacts.sh"])
400373
else:
401374
print("WARNING: skipping iOS tests on non-Darwin host")
402375

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

432405

433-
def swift_format():
434-
swift_format_args = [
435-
"megazords",
436-
"--exclude",
437-
"**/Generated",
438-
"--exclude",
439-
"megazords/ios-rust/Sources/MozillaRustComponentsWrapper/Nimbus/Utils",
440-
"--lint",
441-
"--swiftversion",
442-
"5",
443-
]
444-
if on_darwin():
445-
run_command(["swiftformat", *swift_format_args])
446-
elif not docker_installed():
447-
print("WARNING: On non-Darwin hosts, docker is required to run swiftformat")
448-
print("WARNING: skipping swiftformat on non-Darwin host")
449-
else:
450-
cwd = os.getcwd()
451-
452-
run_command(
453-
[
454-
"docker",
455-
"run",
456-
"-it",
457-
"--rm",
458-
"-v",
459-
f"{cwd}:{cwd}",
460-
"-w",
461-
cwd,
462-
"ghcr.io/nicklockwood/swiftformat:latest",
463-
*swift_format_args,
464-
]
465-
)
466-
467-
468406
def check_for_fmt_changes(branch_changes):
469407
print()
470408
if branch_changes.has_unstanged_changes():
@@ -556,14 +494,13 @@ def calc_steps(args):
556494
yield Step("cargo fmt", cargo_fmt)
557495
elif args.mode == "ktlint":
558496
yield Step("ktlint", run_ktlint)
559-
elif args.mode == "swiftlint":
560-
yield Step("swiftlint", run_swiftlint)
561-
elif args.mode == "swiftformat":
562-
yield Step("swiftformat", swift_format)
497+
elif args.mode == "nss-bindings":
498+
print_rust_environment()
499+
yield Step("NSS bindings test", run_nss_bindings_test)
563500
elif args.mode == "gradle":
564501
yield Step("gradle tests", run_gradle_tests)
565-
elif args.mode == "ios-tests":
566-
yield Step("ios tests", run_ios_tests)
502+
elif args.mode == "ios-artifacts":
503+
yield Step("ios artifacts", build_ios_artifacts)
567504
elif args.mode == "python-tests":
568505
yield Step("python tests", run_python_tests)
569506
else:

docs/building.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ Configure maven to use the native windows maven repository - then, when doing `.
140140
1. Run `./libs/verify-ios-environment.sh` to check your setup and environment
141141
variables.
142142
- Make any corrections recommended by the script and re-run.
143-
1. Run `./automation/run_ios_tests.sh` to build all the binaries and run tests using the local SPM setup.
143+
1. Run `./automation/build_ios_artifacts.sh` to build all the binaries, UniFFi bindings, Glean metrics generation
144144
145-
> 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
145+
> Note: The artifacts generated in the above steps can then be used in any consuming product
146146
147147
148148

docs/contributing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ Before submitting a PR:
3434
- Consult the [testing guide](./howtos/testing-a-rust-component.md) for some tips on writing effective tests.
3535
- Your code should pass all the automated tests before you submit your PR for review.
3636
- 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.
37-
- If you have modified any Swift code, also run `swiftformat --swiftversion 5` on the modified code.
3837
- 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
3938
it does not need one. Any breaking changes to Swift or Kotlin binding APIs should be noted explicitly.
4039
- If your patch adds new dependencies, they must follow our [dependency management guidelines](./dependency-management.md).

docs/howtos/adding-a-new-component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ To test your component:
140140
- Run the script:
141141

142142
```
143-
./automation/run_ios_tests.sh
143+
./automation/build_ios_artifacts.sh
144144
```
145145

146146
The script will:

libs/verify-ios-environment.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ fi
1818
"$(pwd)/libs/verify-ios-ci-environment.sh"
1919

2020
echo ""
21-
echo "Looks good! You can either:"
22-
echo ""
23-
echo "- Run the iOS tests via command line:"
24-
echo " ./automation/run_ios_tests.sh"
21+
echo "Looks good!"
2522
echo ""
2623
echo " If you want to just generate the rust binaries"
2724
echo "- Build the XCFramework:"

0 commit comments

Comments
 (0)