Commit Graph

71 Commits

Author SHA1 Message Date
dnrops f65aa01e50 Update Package.swift 2024-08-27 21:07:47 +08:00
dnrops 591a81532a Update Package.swift 2024-08-27 21:01:44 +08:00
dnrops aefa2fa0e1 Update Package.swift 2024-08-27 20:55:01 +08:00
dnrops 5cac4aa586 Update Package.swift 2024-08-27 20:49:25 +08:00
omochimetaru f734c39ed8
Verify if tests communicate with just spawned dev server (#479) 2024-06-06 14:46:43 +00:00
omochimetaru 305c204495
Check the output of wasm in dev subcommand test (#473) 2024-05-28 22:08:39 +09:00
omochimetaru f7d0b5640f
Combine the WebDriver setup process into WebDriverService and make it easier to reuse (#474) 2024-05-28 10:12:51 +09:00
omochimetaru eba0fdb76c
Add unit test for dev server (#466)
* make CartonCore module and move Environment

* refactor DevCommandTests.checkForExpectedContent

* add DevServerTestApp Fixture

* add FrontendDevServerTests
2024-05-22 11:31:19 +09:00
omochimetaru 7613683095
Import upstream changes of `TSC.Process` (#460) 2024-05-20 18:27:46 +09:00
omochimetaru bb9a91ce0b
Move carton command implementation into CartonDriver module (#459) 2024-05-20 14:31:00 +09:00
omochimetaru e7e0d1174c
Re-organize the naming convention of module, type, product, and file to have consistent project structure (#450)
* rename modules

* rename to CartonReleaseCommand

* call async overload

* fix commandName

* frontend name
2024-05-19 15:51:10 +09:00
Yuta Saito 9e93c85676 Emit warning when building package manifest
We also have a check in the plugin code but SwiftPM 5.9.1 and earlier
try to build some completely unsupported packages like swift-nio and
fail with a cryptic error message. Emitting a warning early on should
help users understand what's going on.
2024-02-27 02:23:12 +09:00
Yuta Saito 2e62088305 Version 1.0.0: SwiftPM Plugin Support
See CHANGELOG.md
2024-02-26 18:48:01 +09:00
STREGA f1d736efb1 Remove 5.9 code paths 2024-01-09 19:56:18 +09:00
STREGA 6726c74427 Add swift_version matrix support for ubuntu 2024-01-09 19:56:18 +09:00
STREGA 644a4c706a Target only 5.9 2024-01-09 19:56:18 +09:00
STREGA 4d852ccc86 Try scaling back changes 2024-01-09 19:56:18 +09:00
STREGA 22daf24f29 Try mimiking previous Package.resolved 2024-01-09 19:56:18 +09:00
STREGA 09b480c54c Revert Package.swift changes 2023-09-30 07:29:05 -04:00
furby™ 504e2d91e3
Swift 5.9 support (#402) 2023-09-30 06:59:29 -04:00
Yuta Saito b79fe9a260
Update SwiftPM branch to 5.8 and fix build errors (#395)
* Update SwiftPM branch to 5.8 and fix build errors

* Make swift-format 5.8 happy :)

* Make swift-format 5.8 happy for Tests

* Fix wrong formatting

* Resolve AbsolutePath(validating:) rename warnings

* Fix wrong formatting

* Resolve remaining deprecation warnings

* Fix Linux build failure
2023-05-04 18:40:16 +09:00
Yuta Saito 8b73e3d4fc
Strip autolink custom section (#390) 2023-03-31 01:10:19 +09:00
Yuta Saito daf152d93d
Update SwiftPM library version to 5.7 (#381) 2022-09-25 20:52:39 +09:00
Yuta Saito 734e333a43
Add 5.7 host toolchain matrix (#380) 2022-09-21 13:06:11 +09:00
Yuta Saito 646f1aef85
Headless test runner (#362)
* Add WebDriverClient for headless testing

* Launch new session with headless arg by default

* Add --headless option in carton test

* Improve logging message

* Apply formatter for WebDriverClient module

* Support MS Edge

* Add headless testing test

* Explicitly depend on NIOFoundationCompat

* Avoid public actor field as a 5.5 compiler crash workaround

* Add --headless description in README.md

* Update Sources/CartonCLI/Commands/Test.swift

Co-authored-by: Max Desiatov <max@desiatov.com>

* Apply suggestions from code review for wording

Co-authored-by: Max Desiatov <max@desiatov.com>

* Rename failedToFindDriver -> failedToFindWebDriver

* Rephrase diagnostic message

* Omit explicit internal keyword

* Remove unused goto.Response struct

* Add license header to Tests/WebDriverClientTests/WebDriverClientTests.swift

Co-authored-by: Max Desiatov <max@desiatov.com>

Co-authored-by: Max Desiatov <max@desiatov.com>
2022-06-10 16:42:20 +00:00
Yuta Saito 154149b6ea
Clean up integration tests and fixtures (#355) 2022-05-28 09:33:27 +00:00
Max Desiatov 1ba7dd5d82
Use JSKit runtime from SwiftPM resources (#335)
* Use JSKit runtime from SwiftPM resources

* Fix Node.js test runner

* Remove unused webpack npm packages

* Update Swift version in `.swiftformat`

* Fix browser and Node.js CJS/ESM handling

* Fix one of the tests, add CI time limit

* Use Tokamak `update-jskit` branch to fix tests

* Use latest Vapor with `.mjs` content-type fix

* Use dynamic import to detect JSKit presence

* Fix missing `runtimeConstructor` reference

* Update `StaticArchive.swift`

* Reduce the diff

* Address PR feedback

* Fix Node.js <-> JSKit integration test

* Update SwiftPM dependencies

* Fix comment typo in `testNode.js`

* Reuse `__stack_sanitizer` across entrypoints
2022-05-20 13:12:45 +01:00
Yuta Saito b9dab08e86
Fix JavaScriptBigIntSupport compatibility issue (#338)
* Refactoring the use of `DestinationEnvironment` and `Environment`

`Environment` shouldn't specify the concrete environment, but the type
of environments enough for build planning.

* Lower i64 imports only for WASI oriented things
2022-05-18 23:18:54 +09:00
Yuta Saito 9c4021d262
Several fixes for 5.6 toolchain (#310)
- Reactor model support
- Update sanitizer support object

This is required to resolve https://github.com/TokamakUI/Tokamak/pull/475
2022-04-09 13:37:34 +00:00
yonihemi b89d7c79dd
Use libSwiftPM 5.6 to parse manifests (#302)
* Upgrade SwiftPM to 5.6. Use libSwiftPM to parse manifests.

* Use SwiftWasm's swiftc
2022-03-28 18:13:23 +08:00
Max Desiatov 74a49c1aa8
Use `async`/`await` and actors instead of Combine (#283)
This makes our codebase smaller by ~80 lines and arguably more readable. Also removes OpenCombine dependency.

* Use `async`/`await` and actors instead of Combine

* Remove OpenCombine dependency

* Fix progress animation not updated

* Stop building with Swift 5.4, clean up terminal output

* Update requirements in `README.md`

* Add `description` to `InvalidResponseCode`

* Fix Linux build error

* Rename `main.swift` to `Main.swift`

* Work around IR/TDB warnings

* Pass IR/TDB arguments correctly to `swift build`

* Support `async` process runner in `carton-release`

* Use Xcode 13.2.1 on macOS

* Pass TDB/IR flags to `swift test` as well

* Make `Install` command async

* Add doc comments, handle subsequent rebuilds
2022-01-17 09:04:44 +00:00
yonihemi 81e390e725
Statically link with `SwiftPMDataModel` library (#275)
Resolves #274.

* Statically link with `SwiftPMDataModel`

* Use 5.6 upstream branches in `Package.swift`

* Update Swift Argument Parser to 1.0.2

* Use latest SwiftPM 5.5

* Avoid copying non-existent `.so` in `Dockerfile`

Co-authored-by: Max Desiatov <max@desiatov.com>
2022-01-15 16:01:08 +00:00
Max Desiatov db4e3ca202
Bump SwiftWasm to 5.5 in `Dockerfile`, bump AHC (#269)
Our `Dockerfile` should be updated to depend on SwiftWasm 5.5.

Additionally, Async HTTP Client has fixed the toolchain downloads issue in 1.8.1, I'm setting it as a minimum version in `Package.swift` here.
2021-12-01 13:48:34 +01:00
Max Desiatov 0e163ec9aa
Use SwiftWasm 5.5.0, bump version to 0.12.0 (#266)
`async-http-client` package is now pinned to 1.6.4, as 1.7.0 and later versions caused issues with toolchain downloads (see https://github.com/swift-server/async-http-client/issues/488 for more details).

I've also updated toolchain downloader code to bubble up download errors, which previously were hidden and made it very hard to diagnose these issues.

* Use SwiftWasm 5.5.0, bump version to 0.12.0

* Pin AHC to 1.8.0

* Pin AHC to 1.6.4, always remove downloaded archives

* Fix `defer` build issue
2021-11-24 17:14:42 +01:00
Max Desiatov 596730b005
Update dependencies, add support for SwiftWasm 5.5 (#263)
I've dropped support for Swift 5.2, and SwiftLint now requires Xcode 12.5.1, which is unavailable on macOS 10.15 with GitHub Actions. This makes it impossible to test with Swift 5.3 on CI, so I'm bumping the required version to Swift 5.4.

Resolves https://github.com/swiftwasm/carton/issues/262.

* Update dependencies, add support for SwiftWasm 5.5

* Bump dependencies in `.github/workflows/swift.yml`

* Add explicit dependency on `NIOFoundationCompat`

* Lower Splash version to 0.15 for Swift 5.3 compat

* Update DefaultToolchain.swift

* Update swift.yml

* Revert "Lower Splash version to 0.15 for Swift 5.3 compat"

This reverts commit 6e04a7f158.

* Require Swift 5.4 in `Package.swift`

* Update README.md

* Use older 5.5 snapshot, unblock tests on failure

* Update DefaultToolchain.swift

* Select correct CPU architecture when downloading

* Disable hanging test

* Use latest 5.5 toolchain

* Use 2021-11-16 snapshot of SwiftWasm 5.5

* Add missing linker flags, re-enable browser test

* Address PR feedback
2021-11-18 13:59:32 +01:00
Max Desiatov dd6439700f
Bump version to 0.11.0, update dependencies (#251)
* Bump version to 0.11.0, update dependencies

* Test on Big Sur with Xcode 12.5

* Update test fixture dependencies

* Remove `LinuxMain.swift` expectations

* Test with `wasm-5.4-SNAPSHOT-2021-08-26-a`

* Remove expectations for `XCTestManifests.swift`

* Enable debugging output

* Try the latest 5.4 toolchain

* print debug output

* More debug output

* Test on macOS 11 with Xcode 13

* Pipe errors to stdout

* Update DefaultToolchain.swift

* Revert "Update DefaultToolchain.swift"

This reverts commit 4ff15f938a.

* Remove Xcode 13 from the CI matrix

* Update DefaultToolchain.swift

* Reduce the diff
2021-09-01 15:07:00 +01:00
Max Desiatov ae8015413b
Fix `carton dev` crashing with SO sanitizer (#239)
Previously, the file we need to include with the build to enable the stack overflow sanitizer was written as a temporary file. This didn't happen though on watcher rebuilds with `carton dev` and caused crashes when a code line containing `try!` relying on this file to be present was executed.

I think it's easier and more efficient to bundle this file in the `static.zip` file that already includes our JS entrypoints. We require `static.zip` to be downloaded and unpacked successfully into `~/.carton/static` before every build anyway. It makes more sense to sense the sanitizer file in `~/.carton/static/so_sanitizer.wasm` and use that instead writing and deleting it at a temporary path on every build.

I've also updated the JSKit dependency and cleaned up some linter warnings by moving large tuple values into a separate `BuildDescription` type.
2021-05-24 12:03:38 +01:00
Yuta Saito 1acf9c3ad7
Integrate stack sanitizer (#230)
* Update WasmTransformer

* Add build flavor to determine build options

* Enable stack overflow sanitizer pass

* Embed import entry in binary

* Remove sanitize support from bundle command

* Update WasmTransformer and add --stack-first option

* Fix carton-release hash-archive for CartonKit renaming

* Run carton-release hash-archive

* Update WasmTransformer

* Use run-p

* Use matrix in CI

* Build and install pre-released resource

* Exclude fixture directory from linting

* Fix failing tests

* Turn off sanitizer on test command
2021-04-18 16:45:10 +09:00
yonihemi 4ef7b5339e
Use libSwiftPM instead of custom model types (#194)
* Use libSwiftPM instead of custom model types #120

* Update SwiftPM dependencies

* Add wrapper to handle discrepancy between encoded and decoded Manifest

* Try to fix 5.2 dependency resolving

* Try to fix 5.2 dependency resolving

Co-authored-by: Max Desiatov <max@desiatov.com>
2021-01-20 23:31:16 +08:00
thecb4 22165481bf
Add tests for `dev` and `bundle` commands (#196)
* carton dev and bundle default command tests

* removed tests_output

* removed .testfile

* carton dev and bundle default command tests

* removed localhost as localURL

* attempt to fix folder name issue

* removed Fixtures test folder

* added Fixtures test folder

* attempt to fix folder name issue

* attempt to fix server connect issue

* fixed dev testWithNoArguments with sleep delay

* Debugging bundle command for github actions

* Install wasmr prior to swift test

* Debug clean up

* Debug clean up

* Update Tests/CartonCommandTests/CommandTestHelper.swift

Co-authored-by: Max Desiatov <max@desiatov.com>

Co-authored-by: thecb4 <cavelle@tehcb4.io>
Co-authored-by: Max Desiatov <max@desiatov.com>
2020-12-28 13:13:27 -05:00
thecb4 d7352b5a25
Add Dev tests and fix hard coded paths (#192)
* Added Dev tests and fixed hard coded paths, fixes #183

* Fixed Path dependency in 5.2 Package

* Removed mxcl/Path dependency

* Removed mxcl/Path dependency, Added confirmation of file existence in Init test

* Added sdk install head of init command test

* Moved carton sdk install to static setup method for tests

* Moved carton sdk install to static setup method for tests

* Moved carton sdk install to static setup method for tests

* Moved carton sdk install to static setup method for tests

* Moved carton sdk install to static setup method for tests

* changed order of actions for github automations to support testing

* modified test run to exclude release

* changed sdk install to run per test

* adjusted github workflows to create carton sdk folders

* adjusted github workflows to use /home/runner instead of root

* adjusted test to wait for sdk installation

* adjusted ubuntu tests for passing

* adjusted Dockerfile to run tests

* added tmate session for debugging

* Removed tmate session, added directory creation for carton sdk and sym link

* Adjusted order of commands for runner

* Fixed mkdir from worker to runner

* Added more terminal output for debugging

* Added more terminal output for debugging

* Added more terminal output for debugging

* Added more terminal output for debugging

* Added more terminal output for debugging

* Fixed hard coded paths

* Removed test investigation fixtures

* Removed test investigation fixtures

Co-authored-by: thecb4 <cavelle@tehcb4.io>
2020-12-24 03:49:28 -05:00
thecb4 5fe8c8edac
Changes to project structure to allow for better testability (#191)
* Changed sources folder to separate the CLI from the 'Kit' to allow for testability of each command

* Fixed Swift 5.2 Support

* Removed Path.swift (for now)

* Fixed OpenCombine and other version issues for 5.2 support

* Removed Path.swift from test target dependency

Co-authored-by: thecb4 <cavelle@tehcb4.io>
2020-12-21 05:14:24 -05:00
Max Desiatov ef402e71e8
Use FileDownloadDelegate from the AHC package (#171)
`FileDownloadDelegate` was introduced in https://github.com/swift-server/async-http-client/pull/275, which almost directly mirrors the implementation in `carton`. Now that it's available in a released version of AHC, let's delete some code here and replace it with the version from that package.
2020-12-01 11:05:15 +00:00
Yuta Saito b9702ea285
Remove wabt dependency (#156)
* Use WasmTransformer.stripCustomSections

* Remove wabt dependency
2020-11-06 23:51:10 +09:00
Carson Katri 91ea98fa5b
Fix error message output (#142) 2020-10-26 10:52:05 -04:00
Max Desiatov 08956baf1d
Add separate Builder class, use WasmTransformer (#131)
Resolves #127.

* Add separate Builder class, use WasmTransformer

* Don't apply the transformer in non-browser environments

* Fix macOS Swift 5.2 build failure

* Fix Package.swift errors

* Fix cyclic dependency in `Package.swift`

* Bump WasmTransformer requirement to 0.0.1

* Rename `case wasmer` to `case other`
2020-10-21 08:48:03 +01:00
Max Desiatov 703078dd83
Bump toolchain, use `--enable-test-discovery` (#130)
In the latest 5.3 toolchain all known issues with IndexStoreDB and SwiftPM support were resolved.

Resolves the second point of #42.

Thanks to this you no longer need to maintain `LinuxMain.swift` and `XCTestManifests.swift` files in your test suites, so these are deleted from the test app `Tests` directory.
2020-10-20 09:29:25 +01:00
Carson Katri 97a7e4fbac
Pretty print diagnostics (#122) 2020-10-14 07:26:31 -04:00
Max Desiatov cd660a8d86
Use raw stdout if TerminalController is unavailable (#113)
TTY terminal output is unavailable on CI, or when users redirect output to a file or a pipe. In those cases `TerminalController` initializer returns `nil`. SwiftPM has a wrapper `InteractiveWriter` class for it, which writes output to stdout directly in that case. I've copied that, and replaced all uses of `TerminalController` with it. A VSCode task is added to test that.

In my testing it looks like download progress reporting is quite spammy, so it now has `removeDuplicates` Combine operator added to make it output only when values differ significantly from each other.

Additionally, SDK installs can hit GitHub API rate limit on CI nodes, so `carton` now reads `GITHUB_TOKEN` environment variable, which gives much higher limits to authenticated API users.

We can now also run various `carton` commands on CI for basic end-to-end testing.

Resolves #112.
2020-09-28 20:14:18 +01:00
Max Desiatov 4eb18d2f04
Bump dependencies and default toolchain snapshot (#111)
The latest SwiftWasm 5.3 snapshot requires users to use `import WASILibc` instead of `import Glibc`. This makes differences between platforms more explicit.
2020-09-26 19:53:39 +01:00