You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrating `swift-log` from XCTest to Swift Testing
### Motivation
Swift Testing is a modern alternative to XCTest. Swift Server Ecosystem
packages should serve as reference implementations for modern Swift
features and best practices.
### Modifications
- 1-to-1 migration of test suites, tests, and assertions to Swift
Testing syntax with XCTest import removed
- XCTest references removed from documentation
- `.trace` log level added to relevant tests
- `GlobalLoggerTest` suite serialized to handle global `LoggingSystem`
access (XCTest runs tests serially by default; Swift Testing runs in
parallel, so serializing this suite avoids requiring `swift test
--no-parallel` across all CI and development environments)
### Result
Successfully executes 52 tests with `swift test --disable-xctest`.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+26-18Lines changed: 26 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,34 +62,42 @@ We require that your commit messages match our template. The easiest way to do t
62
62
63
63
### Make sure Tests work on Linux
64
64
65
-
SwiftLog uses XCTest to run tests on both macOS and Linux. While the macOS version of XCTest is able to use the Objective-C runtime to discover tests at execution time, the Linux version is not.
66
-
For this reason, whenever you add new tests **you have to run a script** that generates the hooks needed to run those tests on Linux, or our CI will complain that the tests are not all present on Linux. To do this, merely execute `ruby ./scripts/generate_linux_tests.rb` at the root of the package and check the changes it made.
65
+
SwiftLog uses Swift Testing to run tests on all supported platforms.
67
66
68
-
### Run `./scripts/soundness.sh`
67
+
### Run CI checks locally
69
68
70
-
The scripts directory contains a [soundness.sh script](https://github.com/apple/swift-log/blob/main/scripts/soundness.sh)
71
-
that enforces additional checks, like license headers and formatting style.
69
+
You can run the Github Actions workflows locally using
70
+
[act](https://github.com/nektos/act). To run all the jobs that run on a pull
71
+
request, use the following command:
72
72
73
-
Please make sure to `./scripts/soundness.sh` before pushing a change upstream, otherwise it is likely the PR validation will fail
74
-
on minor changes such as a missing `self.` or similar formatting issues.
73
+
```
74
+
% act pull_request
75
+
```
75
76
76
-
> The script also executes the above mentioned `generate_linux_tests.rb`.
77
+
To run just a single job, use `workflow_call -j <job>`, and specify the inputs
78
+
the job expects. For example, to run just shellcheck:
77
79
78
-
For frequent contributors, we recommend adding the script as a [git pre-push hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks), which you can do via executing the following command in the project root directory:
0 commit comments