Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added algo-run recipe #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cookbook.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
recipes:
- go-github-release
- go-github-release
- algo-run
62 changes: 62 additions & 0 deletions recipes/algo-run/.dunner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
mounts:
- .:/app

tasks:
python27:
steps:
- name: Python 2.7
# Image name that has to be pulled from a registry
image: python:2.7
commands:
- ["python", "-O", "$1.py"]
python34:
steps:
- name: Python 3.4
# Image name that has to be pulled from a registry
image: python:3.4
commands:
- ["python", "-O", "$1.py"]
java8:
steps:
- name: Java 8
# Image name that has to be pulled from a registry
image: openjdk:8
commands:
- ["javac", "$1.java"]
- ["java", "$1"]
gcc:
steps:
- name: gcc 4.8
image: gcc:4.8
commands:
- ["gcc", "-O2", "-lm", "$1.c", "-o", "$1"]
- ["./$1"]
g++:
steps:
- name: g++ 4.8
image: gcc:4.8
commands:
- ["g++", "-O2", "-lm", "-std=c++0x", "$1.cpp", "-o", "$1"]
- ["./$1"]
fpc:
steps:
- name: Free Pascal Compiler 2.6
image: nacyot/pascal-fp_compiler:apt
commands:
- ["fpc", "$1.pas"]
- ["./$1"]
python37:
steps:
- name: Python 3.7
# Image name that has to be pulled from a registry
image: python:3.7
commands:
- ["python", "-O", "$1.py"]
python38:
steps:
- name: Python 3.8
# Image name that has to be pulled from a registry
image: python:3
commands:
- ["python", "-O", "$1.py"]

65 changes: 65 additions & 0 deletions recipes/algo-run/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# algo-run

This is a recipe for algorithmic programming contestants to run their programs with ease in common languages supported by online judeges (mainly [USACO](http://www.usaco.org/index.php?page=instructions/)).

## Setup

Make sure you have `dunner` and `docker`.

Run the following command to get the recipe
```
$ dunner init algo-run
```

This recipe creates a dunner task file `.dunner.yml`. Then you're good to go.

## Usage

The following languages are supported:

### Python 2.7

```
$ dunner do python27 <file_name>
```
This will run `<file_name>.py` with Python2.7

### Python3.4
```
$ dunner do python34 <file_name>
```
This will run `<file_name>.py` with Python3.4

### Free Pascal Compilter 2.6.2
```
$ dunner do fpc <file_name>
```
This will compile `<file_name>.pas` and then execute `./<file_name>`

### gcc 4.8
```
$ dunner do gcc <file_name>
```
This will run `gcc -O2 -lm <file_name>.c -o <file_name>` and then execute `./<file_name>`

### g++ 4.8
```
$ dunner do g++ <file_name>
```
This will run `g++ -O2 -lm -std=c++0x <file_name>.cpp -o <file_name>` and then execute `./<file_name>`

## Extra
I also added the following just for convenience.

### Python 3.7

```
$ dunner do python37 <file_name>
```
This will run `<file_name>.py` with Python3.7

### Python3.8
```
$ dunner do python38 <file_name>
```
This will run `<file_name>.py` with Python3.8
43 changes: 43 additions & 0 deletions recipes/algo-run/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: algo-run
description: "Dunner recipe for running algorithmic programs using intended language"
version: "0.0.1"

preInstallCmd: ""

postInstallMessage: |
This recipe creates a dunner task file `.dunner.yaml`. Run below commands from project root directory to run your program with corresponding language.

Python 2.7
```
$ dunner do python27 <file_name>
```

### Python3.4
```
$ dunner do python34 <file_name>
```

### Free Pascal Compilter 2.6.2
```
$ dunner do fpc <file_name>
```

### gcc 4.8
```
$ dunner do gcc <file_name>
```

### g++ 4.8
```
$ dunner do g++ <file_name>
```

### Python 3.7
```
$ dunner do python37 <file_name>
```

### Python3.8
```
$ dunner do python38 <file_name>
```