This repository has been archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated and fully working cli project
- Loading branch information
Showing
233 changed files
with
81,575 additions
and
1,625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ example.rb | |
Dockerfile | ||
*.o | ||
*.hi | ||
\#* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
HOSTNAME=codewars | ||
# func was removed due to issues compiling haskell using the latest base image. | ||
# We need to fix that image before we can ever update that image/codebase again :( | ||
#CONTAINERS=dotnet func jvm node python ruby systems | ||
CONTAINERS=dotnet jvm node python ruby systems alt func erlang | ||
|
||
ALL_CONTAINERS=${CONTAINERS} base | ||
|
||
.PHONY: ${ALL_CONTAINERS} clean docker_rm docker_rmi | ||
|
||
all: ${CONTAINERS} | ||
|
||
base: | ||
cp docker/$@.docker ./Dockerfile | ||
docker build -t $(HOSTNAME)/$@-runner . | ||
|
||
${CONTAINERS}: base | ||
cp docker/$@.docker ./Dockerfile | ||
docker build -t $(HOSTNAME)/$@-runner . | ||
|
||
# Push docker containers to registry | ||
push_to_registry: | ||
docker push $(HOSTNAME)/base-runner | ||
echo $(patsubst %, $(HOSTNAME)/%-runner, $(CONTAINERS)) | xargs -n 1 docker push | ||
|
||
# Remove docker processes that have exited cleanly | ||
docker_rm_exited: | ||
[ ! -n "$(shell docker ps -a | grep Exit | cut -d ' ' -f 1)" ] || echo $(shell docker ps -a | grep Exit | cut -d ' ' -f 1) | xargs -n 1 docker rm -f | ||
|
||
# Kill temporary built images might fail if not exited cleanly | ||
docker_rmi_temporary: | ||
[ ! -n "$(shell docker images --no-trunc | grep none | sed -e 's/\s\s*/\t/g' | cut -f3)" ] || docker images --no-trunc | grep none | sed -e 's/\s\s*/\t/g' | cut -f3 | xargs -n 1 docker rmi -f | ||
|
||
# Kill all of the in-flight and exited docker containers | ||
docker_rm: | ||
docker ps -q | xargs docker stop | ||
[ ! -n "$(shell docker ps -a -q)" ] || echo $(shell docker ps -a -q) | xargs -n 1 docker rm -f | ||
|
||
# Kill all docker images | ||
docker_rmi: docker_rm | ||
[ ! -n "$(shell docker images -q)" ] || docker images -q | xargs -n 1 docker rmi -f | ||
|
||
clean: docker_rm_exited docker_rmi_temporary | ||
for i in $(shell for i in $(HOSTNAME)/base $(patsubst %, $(HOSTNAME)/%-runner, $(CONTAINERS)) ; do docker images | grep $$i | sed -e 's/\s\s*/\t/g' | cut -f1; done) ; do docker rmi -f $$i ; done | ||
|
||
deep-clean: docker_rmi | ||
|
||
pull: | ||
docker pull codewars/ruby-runner | ||
docker pull codewars/node-runner | ||
docker pull codewars/python-runner | ||
docker pull codewars/dotnet-runner | ||
docker pull codewars/jvm-runner | ||
docker pull codewars/systems-runner | ||
docker pull codewars/func-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,75 @@ | ||
# runner | ||
|
||
TODO: update documentation | ||
This project is both a command-line utility and server, used by [Codewars](http://www.codewars.com) to execute small sets of code within various languages, using various testing frameworks. | ||
|
||
You can run `node run --help` to view information about which arguments are supported. | ||
|
||
## Purpose | ||
|
||
The purpose of this project is to provide a low level ability to run 'Kata'. It provides a mechanism for executing different configurations of code using various languages and testing frameworks. | ||
|
||
Docker can be utilized in order to sandbox code execution. A server is provided that can accept 'run' requests and execute them within a Docker container. | ||
|
||
## Language Support Status | ||
|
||
Many languages are currently supported in various states of completeness. This list tries to keep track of each. | ||
|
||
**Legend:** `!!!` = Failing Specs, `???` = Status is unknown, `*` = Any | ||
|
||
| Language | solutionOnly | testSuite | Codewars | Strive | Docker Image | Examples | Notes | | ||
|--------------|--------------|----------------|--------------|----------------|----------------|--------------|-------------------------------------------------------------------------| | ||
| Bash | ✓ | | Kumite | | * | | | | ||
| C | ✓ | Failing | ? | | systems-runner | | | | ||
| Clojure | ✓ | clojure.test | clojure.test | clojure.test | func-runner | clojure.test | | | ||
| CoffeeScript | ✓ | cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | | | ||
| CPP | ✓ | | | | systems-runner | | | | ||
| C# | ✓ | nunit | nunit | nunit | dotnet-runner | nunit | | | ||
| Elixir | ✓ | | | | erlang-runner | | | | ||
| Erlang | ✓ | | | | erlang-runner | | | | ||
| F# | ✓ | | Kumite Only | | dotnet-runner | | | | ||
| Go | ✓ | | Kumite Only | | alt-runner | | | | ||
| Groovy | ✓ | | Kumite Only | | jvm-runner | | | | ||
| Haskell | ✓ | hspec!!! | hspec | hspec | func-runner | hspec | An older version is running on CW & Strive that is fully functional | | ||
| Java | ✓ | junit | Yes | Yes | jvm-runner | junit | | | ||
| JavaScript | ✓ | cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | | | ||
| Julia | ✓!!! | Failing | | | | | | | ||
| Lisp | ✓ | | Kumite Only | | func-runner | | | | ||
| Lua | ✓ | | Kumite Only | | alt-runner | | | | ||
| ObjC | ??? | ??? | | | | | | | ||
| OCAML | ✓ | | Kumite Only | | func-runner | | | | ||
| Perl | ✓ | | Kumite Only | | * | | | | ||
| Php | ✓ | | Kumite Only | | alt-runner | | | | ||
| Python 2 | ✓ | cw-2, unittest | cw-2 | cw-2, unittest | python-runner | cw-2 | | | ||
| Python 3 | ✓ | cw-2, unittest | | cw-2, unittest | python-runner | cw-2 | | | ||
| R | ✓ | | | | alt-runner | | | | ||
| Racket | ✓ | | Kumite Only | | func-runner | | | | ||
| Ruby | ✓ | cw-2, rspec | cw-2 | cw-2, rspec | ruby-runner | cw-2 | | | ||
| Rust | ✓ | | | | | | | | ||
| Scala | ✓ | | Kumite Only | | jvm-runner | | | | ||
| Swift | ??? | ??? | | | | | Current contribution designed for OSX, need to move to OS linux version | | ||
| TypeScript | ✓ | mocha | Kumite Only | | node-runner | | TypeScript utilizes `require` instead of concatenating files | | ||
|
||
|
||
## Setup | ||
|
||
You should have Docker installed, if not do that first. Before you can run any of the code | ||
environments you will need to build the proper Docker image. To get started lets work with the | ||
node image. | ||
|
||
Run `make base node` to build the base and node images. This will take a few minutes. | ||
|
||
Once you image is built, you can create a container to work within it. Doing this means you do not | ||
have to worry about having any of the project dependencies loaded directly on your machine. | ||
|
||
Run the following command: | ||
|
||
``` | ||
docker run -it --rm --entrypoint bash -v $(pwd)/lib:/runner/lib -v $(pwd)/frameworks:/runner/frameworks -v $(pwd)/test:/runner/test codewars/node-runner | ||
``` | ||
|
||
This will create a new container and send you into the instance with your project's lib and test directories mounted | ||
as volumes. Mounting as a volume allows you to change files on your local machine and have those changes available to you | ||
from within the container. | ||
|
||
> We do not mount the entire directory because that would overwrite things such as your node_modules directory. If you need | ||
to update these you should `make node` the image to ensure you are always testing against the correct packages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '2' | ||
services: | ||
base: | ||
build: | ||
context: . | ||
dockerfile: base.docker | ||
image: codewars/base-runner | ||
|
||
ruby: | ||
build: | ||
context: . | ||
dockerfile: ruby.docker | ||
image: codewars/ruby-runner | ||
|
||
node: | ||
build: | ||
context: . | ||
dockerfile: node.docker | ||
image: codewars/node-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.