Skip to content

Commit

Permalink
Fix JS slices (rust-diplomat#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Nov 28, 2023
1 parent e2e9442 commit 4b07286
Show file tree
Hide file tree
Showing 68 changed files with 1,301 additions and 283 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,35 @@ jobs:
version: latest

- name: Run wasm tests
run: cargo make test-wasm
run: cargo make test-wasm

test-dart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Dart
uses: dart-lang/setup-dart@v1

# Cargo-make boilerplate
- name: Get cargo-make version
id: cargo-make-version
run: |
echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)"
shell: bash
- name: Attempt to load cached cargo-make
uses: actions/cache@v2
id: cargo-make-cache
with:
path: |
~/.cargo/bin/cargo-make
~/.cargo/bin/cargo-make.exe
key: ${{ runner.os }}-make-${{ steps.cargo-make-version.outputs.hash }}
- name: Install cargo-make
if: steps.cargo-make-cache.outputs.cache-hit != 'true'
uses: actions-rs/install@v0.1.2
with:
crate: cargo-make
version: latest

- name: Run Dart tests
run: cargo make test-dart
49 changes: 34 additions & 15 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ dependencies = [
category = "Tests"
dependencies = [
"test-dart-example",
"test-dart-example-app",
"test-dart-feature",
]
[tasks.test-example]
Expand Down Expand Up @@ -97,7 +96,7 @@ script = '''
exit_on_error true
cd example/cpp
rm tests/*.out
exec make
exec --fail-on-error make
'''

[tasks.test-cpp2-example]
Expand All @@ -108,7 +107,7 @@ script = '''
exit_on_error true
cd example/cpp2
rm tests/*.out
exec make
exec --fail-on-error make
'''

[tasks.test-cpp-feature]
Expand All @@ -119,7 +118,7 @@ script = '''
exit_on_error true
cd feature_tests/cpp
rm tests/*.out
exec make
exec --fail-on-error make
'''

[tasks.test-cpp2-feature]
Expand All @@ -130,7 +129,7 @@ script = '''
exit_on_error true
cd feature_tests/cpp2
rm tests/*.out
exec make
exec --fail-on-error make
'''

[tasks.test-c-example]
Expand All @@ -141,7 +140,7 @@ script = '''
exit_on_error true
cd example/c
rm *.out
exec make
exec --fail-on-error make
'''

[tasks.test-c2-example]
Expand All @@ -152,7 +151,7 @@ script = '''
exit_on_error true
cd example/c
rm *.out
exec make
exec --fail-on-error make
'''

[tasks.test-wasm-example]
Expand All @@ -164,8 +163,8 @@ exit_on_error true
cd example/js/
cp ../../target/wasm32-unknown-unknown/debug/diplomat_example.wasm lib/api/diplomat_example.wasm
cd lib
exec npm install
exec npm run test
exec --fail-on-error npm install
exec --fail-on-error npm run test
'''

[tasks.test-wasm-example-app]
Expand All @@ -177,8 +176,8 @@ exit_on_error true
cd example/js/
cp ../../target/wasm32-unknown-unknown/debug/diplomat_example.wasm lib/api/diplomat_example.wasm
cd app
exec npm install
exec npm run build
exec --fail-on-error npm install
exec --fail-on-error npm run build
'''

[tasks.test-wasm-feature]
Expand All @@ -190,8 +189,28 @@ exit_on_error true
cd feature_tests/js/
cp ../../target/wasm32-unknown-unknown/debug/diplomat_feature_tests.wasm api/diplomat_feature_tests.wasm
cd app
exec npm install
exec npm run test
exec --fail-on-error npm install
exec --fail-on-error npm run test
'''

[tasks.test-dart-example]
category = "Tests"
dependencies = ["build-example"]
script_runner = "@duckscript"
script = '''
exit_on_error true
cd example/dart/
exec --fail-on-error dart test
'''

[tasks.test-dart-feature]
category = "Tests"
dependencies = ["build-feature"]
script_runner = "@duckscript"
script = '''
exit_on_error true
cd feature_tests/dart/
exec --fail-on-error dart test
'''

[tasks.test-c2-example-self-contained]
Expand Down Expand Up @@ -393,7 +412,7 @@ script_runner = "@duckscript"
script = '''
exit_on_error true
!include_files ./support/functions.ds
generate_generic feature_tests dart lib
generate_generic feature_tests dart lib/src
'''

[tasks.gen-examples-dart]
Expand All @@ -402,7 +421,7 @@ script_runner = "@duckscript"
script = '''
exit_on_error true
!include_files ./support/functions.ds
generate_generic example dart lib
generate_generic example dart lib/src
'''

# Build deps
Expand Down
1 change: 1 addition & 0 deletions example/dart/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.dart_tool
1 change: 1 addition & 0 deletions example/dart/lib/lib.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
42 changes: 34 additions & 8 deletions example/dart/lib/lib.g.dart → example/dart/lib/src/lib.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4b07286

Please sign in to comment.