Commit Graph

542 Commits

Author SHA1 Message Date
Yuta Saito 2fa2568a16
Exit non-zero status when test fail on browser (#370)
* Add crash test case

* Exit non-zero status when test fail

also handle JS exception
2022-07-19 01:28:40 +09:00
Max Desiatov 2c5cf34e0c
Update SwiftPM dependencies (#368) 2022-06-26 13:45:03 +02:00
Max Desiatov 097b99290a
Update SwiftPM dependencies (#366) 2022-06-19 12:30:37 +02:00
Yuta Saito 1de809e223 Update carton compatibility matrix 2022-06-15 23:08:43 +09:00
Yuta Saito 29a9b587b2 Bump version to 0.16.0, update `CHANGELOG.md` 2022-06-15 23:03:41 +09:00
Max Desiatov c92f85c543
Revert "Use `--static-swift-stdlib` for easier distribution on Linux" (#365)
Revert "Use `--static-swift-stdlib` for easier distribution on Linux (#343)"

This reverts commit 78d023587c.

As reported previously:

> after adding --static-swift-stdlib, carton init and other commands started hanging.
> It seems something wrong in Foundation or global executor. The min repro for the hang is here
> https://gist.github.com/kateinoigakukun/a3ee55fa2480a46959211c53de862131
2022-06-15 10:02:07 +02:00
Max Desiatov 0db2416c1b
Update SwiftPM dependencies (#363) 2022-06-12 14:41:34 +01: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
Max Desiatov 48c9179fa0
Update SwiftPM dependencies (#360)
- Dependency updates

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request
2022-06-05 13:45:58 +02:00
Geordie J eef2825f78
Add option to disable wasm optimizations (#359)
I am trying to implement an `esbuild` plugin that calls into `carton`. My plan was to call `carton bundle --debug` to get a quick development build and then extract that command's output for use in our esbuild project.

Unfortunately, `carton bundle` still runs `wasm-opt` even on a debug build, which takes 5-10s for our project. The only alternative I can see is `carton dev`, but that runs the dev server / watcher, which we don't want either for a one-off build.

Since changing the behaviour of `carton bundle --debug` to _not_ run `wasm-opt` may cause issues with backwards compatibility, @MaxDesiatov suggested we add a command line option `--wasm-optimizations {size, none}` instead, allowing users to specifically opt out of this behaviour.
2022-06-02 18:40:00 +01:00
Max Desiatov 78d023587c
Use `--static-swift-stdlib` for easier distribution on Linux (#343)
In theory, this should allow us to distribute self-contained binaries on Linux. These wouldn't be statically linked completely, but at least they should no longer depend on a separate dynamic library file with Swift stdlib.

Related to https://github.com/swiftwasm/carton/issues/336.
2022-05-31 11:29:41 +01:00
Yuta Saito 70b06afad8 Add short description for --prebuilt-test-bundle-path 2022-05-31 01:59:14 +09:00
Yuta Saito 820c2afab7
Add --bundle-path option to `carton test` (#358)
* Add --skip-build option to carton test to delegate building to users

* Add test case for --skip-build

* Rename --skip-build to --bundle-path to allow specifying binary path

* Update Sources/CartonCLI/Commands/Test.swift

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

* Rename --bundle-path to --prebuilt-test-bundle-path

* Update Sources/CartonCLI/Commands/Test.swift

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

Co-authored-by: Max Desiatov <max@desiatov.com>
2022-05-30 16:04:03 +00:00
Max Desiatov 75fc15266f
Update SwiftPM dependencies (#357)
- Dependency updates

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request
2022-05-29 11:58:36 +01:00
Max Desiatov 7ef43954cc
Fix linter error in `Builder.swift` (#356) 2022-05-28 20:27:06 +09:00
Yuta Saito 154149b6ea
Clean up integration tests and fixtures (#355) 2022-05-28 09:33:27 +00:00
Yuta Saito 25da29b475 Bump version to 0.15.3, update `CHANGELOG.md` 2022-05-25 00:17:25 +09:00
Yuta Saito c295a21df0
Stop limiting WS frame size to 16kb for large number of test suites (#353) 2022-05-24 07:30:42 +09:00
Carson Katri 7b4c35fc6a
Use standards mode in default index page (#351) 2022-05-23 16:08:47 +00:00
Max Desiatov 0926035d4a
Remove broken job from `release.yml` 2022-05-23 16:52:18 +01:00
Max Desiatov 8b44aa18b5 Bump version to 0.15.2, update `CHANGELOG.md` 2022-05-23 16:07:28 +01:00
Max Desiatov 0e2e4cfdd8
Add missing check for Node.js entrypoint (#350)
Because of the lack of this check the entrypoint files weren't unpacked when missing on `carton test --environment node` runs.
2022-05-23 14:50:50 +00:00
Max Desiatov 4314a92adc Bump version to 0.15.1, update `CHANGELOG.md` 2022-05-23 10:47:13 +01:00
Max Desiatov b5680cbfb7
Fix symlinks not fully cleaned up in Node.js tests (#349)
`FileSystem.isDirectory` returns `false` when running it on broken symlinks, which breaks Node.js tests flow. We should be able to clean up all symlinks, even broken ones. Other we can't create new correct symlinks because broken symlinks already exist at those paths.
2022-05-23 10:37:12 +01:00
Max Desiatov 8130899628
Fix typo in `README.md` 2022-05-20 15:29:43 +01:00
Max Desiatov da99573894
Fix typo in `CHANGELOG.md` 2022-05-20 15:29:20 +01:00
Max Desiatov 683e3e0759
Bump version to 0.15.0, update `CHANGELOG.md` (#348) 2022-05-20 15:27:53 +01:00
Max Desiatov 53bc06c23d
Fix watcher breakage on failed builds (#347)
After switching to `async`/`await` the value of `isBuildCurrentlyRunning` wasn't correctly reset, which led to issues. By resetting the variable in `defer` we guarantee that it will be reset even when errors are thrown.

Resolves #339.
2022-05-20 13:03:34 +00:00
Max Desiatov c834751074
Re-read custom `index.html` on updates (#342)
We were reading custom `index.html` only once on launch, which meant people had to restart `carton dev` every time they've updated `index.html` during the build process to see changes they've made.
2022-05-20 12:42:23 +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 ad9f73ceb1
Embed static.zip in Swift code instead of downloading from remote (#334)
* Embed static.zip in Swift code instead of downloading from remote

* Make base64 decode logic failure

* Add rationale for the use of base64
2022-05-11 15:42:45 +00:00
Max Desiatov cd7377fb49
Clarify `--environment` option for `carton test` in `README.md` (#333)
Resolves https://github.com/swiftwasm/carton/issues/322.
2022-05-11 14:40:15 +00:00
Max Desiatov fd11ff0140
Add `carton`/SwiftWasm/JSKit compat matrix to `README.md` (#332)
This should make it easier for people to use older versions if they'd like to.
2022-05-11 15:36:47 +01:00
Antonio Candinho 505a9b81a2
Add support for running tests using NodeJS (#328)
### 🎩 What is the goal?

Implement NodeJS as another test runner. 

### 📄 How is it being implemented?

In this PR, I include the following changes:

 - Create an abstraction for the different Test Runners (Wasmer, browser and now Node)
 - Implement the new Node test runner (quite similar to the Wasmer one)
 - Unify Javascript client code, so we can make sure we apply the same patches and load in the same way all the different targets
 - Create a new entry point for testing with node
 - Add that new entry point to the static bundle
 
### 👀 Any consideration?

The Node test runner does not use the TestsParser as it heavily impacts execution time. I will try to figure out what's going on later.
 
###  How can it be tested?

Testing is automated 🤖 . You can also check this in your own project by running:

```bash
carton test --environment node
```
2022-05-11 13:52:44 +00:00
Max Desiatov 7392e1bb17
Serve all available resources with `dev`/`bundle` (#330)
Resolves https://github.com/swiftwasm/carton/issues/175.

I initially thought we should parse `Package.swift` manifests of the whole dependency tree to collect paths to resources from them, but now I'm not even sure that SwiftPM provides an API for this.

Much simpler solution is to serve with `dev` and copy with `bundle` all directories with `.resources` suffixes in the build directory. I think it's quite impossible to stumble upon unrelated directories with this approach, while it still resolves the issue as intended, in my opinion.
2022-05-11 08:10:07 +01:00
Jed Fox 8790e10161
Update to v2 of Contributor Covenant in shared GitHub repo (#329) 2022-05-10 18:10:54 +00:00
Max Desiatov 8461f26f1b
Fix 5.6 template: use `executableTarget` (#325) 2022-05-03 13:59:47 +01:00
Max Desiatov 6e3dfe62cd
Set `compatibleJSKitVersion` to 0.14.0 2022-05-03 12:25:20 +01:00
Max Desiatov 0f3f39ebe3
Update SwiftPM dependencies (#324) 2022-05-01 11:22:03 +01:00
Max Desiatov 0b44e11222 Update entrypoint hashes and `static.zip` URL 2022-04-30 11:43:48 +01:00
Max Desiatov d7c4ebe693 Bump version to 0.14.2, update `CHANGELOG.md` 2022-04-30 11:17:53 +01:00
Francisco Javier Trujillo Mata 04cce448a3
Override clock_res_get function from wasi to fix memory issue (#323)
Applies the same patch that was done in the WasmTransformer repo. https://github.com/swiftwasm/WasmTransformer/blob/main/Fixtures/index.js#L4-L27
Closes #321.
2022-04-27 13:00:19 +01:00
Max Desiatov 5c4c1d8120
Update SwiftPM dependencies (#320) 2022-04-24 11:00:44 +03:00
Max Desiatov fc408b1832
Update SwiftPM dependencies (#319) 2022-04-17 11:38:21 +01:00
Max Desiatov b375fcd2d5
Remove broken job from `release.yml` 2022-04-12 13:11:32 +01:00
Max Desiatov 8a73ca9a87
Bump version to 0.14.1 and update `CHANGELOG.md` (#316) 2022-04-12 12:57:14 +01:00
Yuta Saito 1f2aeffcc8
Enable reactor model only when not building as a command (#314) 2022-04-11 10:20:21 +01:00
Max Desiatov 45ba9f6d3c
Update `ENV CARTON_DEFAULT_TOOLCHAIN` in `Dockerfile` 2022-04-10 16:40:08 +01:00
Max Desiatov 228044faf9
Use `5.6-focal` base image in `Dockerfile` 2022-04-10 15:13:47 +01:00