Skip to content

Commit

Permalink
Update to version 0.4.2, improve ts test and add tsx test, not workin…
Browse files Browse the repository at this point in the history
…g yet.
  • Loading branch information
viferga committed Apr 15, 2021
1 parent 3acef30 commit d85749d
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions source/metacall.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
60 changes: 60 additions & 0 deletions tests/tsx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#
# MetaCall Distributable by Parra Studios
# Distributable infrastructure for MetaCall.
#
# Copyright (C) 2016 - 2020 Vicente Eduardo Ferrer Garcia <[email protected]>
#
# 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="[email protected]" \
maintainer.name="Vicente Eduardo Ferrer Garcia" \
maintainer.address="[email protected]" \
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 '<h1>Hello world</h1>'

ENTRYPOINT ["sh", "-c"]
6 changes: 6 additions & 0 deletions tests/tsx/test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import { renderToString } from 'react-dom/server';

export function hello(text: string): string {
return renderToString(<h1>Hello ${text}</h1>);
}
10 changes: 10 additions & 0 deletions tests/tsx/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": [
"templating.tsx"
],
"compilerOptions": {
"target": "es5",
"jsx": "react",
"lib": ["es2015", "dom"]
}
}
4 changes: 1 addition & 3 deletions tests/typescript/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d85749d

Please sign in to comment.