diff --git a/Makefile b/Makefile index 4088f47..a822f40 100644 --- a/Makefile +++ b/Makefile @@ -128,6 +128,8 @@ test: @docker build --build-arg CACHE_INVALIDATE=${CACHE_INVALIDATE} -t metacall/distributable_test:python -f tests/python/Dockerfile . @docker build --build-arg CACHE_INVALIDATE=${CACHE_INVALIDATE} -t metacall/distributable_test:node -f tests/node/Dockerfile . @docker build --build-arg CACHE_INVALIDATE=${CACHE_INVALIDATE} -t metacall/distributable_test:typescript -f tests/typescript/Dockerfile . + # TODO: + # @docker build --build-arg CACHE_INVALIDATE=${CACHE_INVALIDATE} -t metacall/distributable_test:tsx -f tests/tsx/Dockerfile . @echo "Done" # Clear images and containers diff --git a/source/metacall.scm b/source/metacall.scm index 6c6fed4..c34a37c 100644 --- a/source/metacall.scm +++ b/source/metacall.scm @@ -358,12 +358,12 @@ a focus on simplicity and productivity.") (define-public metacall (package (name "metacall") - (version "0.4.1") + (version "0.4.2") (source (origin (method url-fetch) (uri (string-append "https://github.com/metacall/core/archive/v" version ".tar.gz")) - (sha256 (base32 "0bf8y0r1d6sikcqndgbggl15p4y3mflp844mq83xvrjfvc4mhayb")) + (sha256 (base32 "1631z28ymbadr28s27y17yxwww24wm5xvwjgkld5dzs94i7aavsi")) ) ) (build-system cmake-build-system) diff --git a/tests/tsx/Dockerfile b/tests/tsx/Dockerfile new file mode 100644 index 0000000..8eb387c --- /dev/null +++ b/tests/tsx/Dockerfile @@ -0,0 +1,60 @@ +# +# MetaCall Distributable by Parra Studios +# Distributable infrastructure for MetaCall. +# +# Copyright (C) 2016 - 2020 Vicente Eduardo Ferrer Garcia +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +FROM busybox:1.31.1 AS node_test + +# Image descriptor +LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ + copyright.address="vic798@gmail.com" \ + maintainer.name="Vicente Eduardo Ferrer Garcia" \ + maintainer.address="vic798@gmail.com" \ + vendor="MetaCall Inc." \ + version="0.1" + +COPY out/tarball.tar.gz / + +RUN cd / \ + && tar -xzf tarball.tar.gz \ + && rm tarball.tar.gz + +COPY tests/tsx/test.tsx /scripts/ +COPY tests/tsx/tsconfig.json /scripts/ + +# Needed in order to load the tsconfig.json +WORKDIR /scripts/ + +ARG CACHE_INVALIDATE + +RUN echo "Running tests ${CACHE_INVALIDATE}" \ + && export PATH="/gnu/bin:${PATH}" \ + && npm install metacall react react-dom + +RUN export LOADER_SCRIPT_PATH="/scripts/" \ + && export METACALL_PATH="/gnu/store/`ls /gnu/store/ | grep metacall | head -n 1`" \ + && export LOADER_LIBRARY_PATH="${METACALL_PATH}/lib" \ + && export SERIAL_LIBRARY_PATH="${METACALL_PATH}/lib" \ + && export DETOUR_LIBRARY_PATH="${METACALL_PATH}/lib" \ + && export PORT_LIBRARY_PATH="${METACALL_PATH}/lib" \ + && export CONFIGURATIONS_PATH="${METACALL_PATH}/configurations/global.json" \ + && export NODE_ENV=debug \ + && printf 'load ts test.tsx\ninspect\ncall hello("world")\nexit' | ${METACALL_PATH}/metacallcli \ + | grep \ + -e '

Hello world

' + +ENTRYPOINT ["sh", "-c"] diff --git a/tests/tsx/test.tsx b/tests/tsx/test.tsx new file mode 100644 index 0000000..70409f8 --- /dev/null +++ b/tests/tsx/test.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import { renderToString } from 'react-dom/server'; + +export function hello(text: string): string { + return renderToString(

Hello ${text}

); +} diff --git a/tests/tsx/tsconfig.json b/tests/tsx/tsconfig.json new file mode 100644 index 0000000..d51b502 --- /dev/null +++ b/tests/tsx/tsconfig.json @@ -0,0 +1,10 @@ +{ + "include": [ + "templating.tsx" + ], + "compilerOptions": { + "target": "es5", + "jsx": "react", + "lib": ["es2015", "dom"] + } +} diff --git a/tests/typescript/Dockerfile b/tests/typescript/Dockerfile index 058933e..41a7b7a 100644 --- a/tests/typescript/Dockerfile +++ b/tests/typescript/Dockerfile @@ -33,9 +33,7 @@ RUN cd / \ && tar -xzf tarball.tar.gz \ && rm tarball.tar.gz -COPY tests/scripts/ /scripts/ - -COPY tests/node/test.js /scripts/ +COPY tests/scripts/fib.ts /scripts/ ARG CACHE_INVALIDATE