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

marine simpleName 対応 #56

Merged
merged 5 commits into from
Apr 8, 2024
Merged
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
24 changes: 12 additions & 12 deletions contents/sample/book/chapter2.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ ${console}.${log}("Hello World!");

### env

- imageName: givery/track-nodejs-8
- imageName: nodejs

### hint
JavaScript(Node.js)を使用するセクションを作成する際にはDockerイメージとして`givery/track-nodejs-8`を使用します。
JavaScript(Node.js)を使用するセクションを作成する際にはDockerイメージとして`nodejs`を使用します。
Comment on lines -24 to +27
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

チャレンジやブックの imageName の修正


このブックではセクション毎に使用する言語が異なるため各セクションで`env`を指定していますが、通常は1つのブックで扱う言語はひとつだけなので、book.ymlで指定します。

Expand All @@ -51,11 +51,11 @@ ${puts} "Hello World!"
- command: ruby main.rb

### hint
Rubyを使用するセクションを作成する際にはDockerイメージとして`givery/track-ruby-2.5`を使用します。
Rubyを使用するセクションを作成する際にはDockerイメージとして`ruby`を使用します。

### env

- imageName: givery/track-ruby-2.5
- imageName: ruby

## Pythonで「Hello World!」
Pythonで「Hello World!」を出力してみましょう。
Expand All @@ -64,7 +64,7 @@ Pythonで「Hello World!」を出力してみましょう。

```
### remote
- command: python main.py
- command: python3 main.py
```

### main(main.py)
Expand All @@ -74,14 +74,14 @@ ${print}("Hello World!")
```

### remote
- command: python main.py
- command: python3 main.py

### env

- imageName: givery/track-python-3.6
- imageName: python

### hint
Python(Ptyhon3)を使用するセクションを作成する際にはDockerイメージとして`givery/track-python-3.6`を使用します。
Python(Ptyhon3)を使用するセクションを作成する際にはDockerイメージとして`python`を使用します。

`givery/track-python-2.7`を使用してPython2系のブックを書くこともできます。

Expand Down Expand Up @@ -112,15 +112,15 @@ class Main {
```

### hint
Javaを使用するセクションを作成する際にはDockerイメージとして`givery/track-java-8`を使用します。
Javaを使用するセクションを作成する際にはDockerイメージとして`java`を使用します。

### remote
- build: javac Main.java
- command: java Main

### env

- imageName: givery/track-java-8
- imageName: java

## シェルで「Hello World!」
シェルコマンドで「Hello World!」を出力してみましょう。
Expand All @@ -146,10 +146,10 @@ ${echo} "Hello, World!"

### env

- imageName: givery/track-python-3.6
- imageName: python

### hint
シェルコマンドはどのDockerイメージでも動作しますが、ubuntuベースの`givery/track-python-3.6`を使用することをおすすめします。
シェルコマンドはどのDockerイメージでも動作しますが、ubuntuベースの`python`を使用することをおすすめします。

### tips
ブックの各セクションではDockerコンテナは毎回初期化されます。
Expand Down
8 changes: 4 additions & 4 deletions contents/sample/book/chapter5.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

### env

- imageName: givery/track-java-8
- imageName: java

### hint
`ok xxxx`, `not ok xxxxx`という書式は[TAP](https://testanything.org/)というテストプロトコルに基づいたものです。
Expand Down Expand Up @@ -61,7 +61,7 @@ TAPをサポートしたテストフレームワークを使えばもっと簡

### env

- imageName: givery/track-java-8
- imageName: java

## Rubyエクササイズの例
整数除算を行うメソッド`divide`を実装しなさい。
Expand All @@ -76,7 +76,7 @@ TAPをサポートしたテストフレームワークを使えばもっと簡

### env

- imageName: givery/track-ruby-2.5
- imageName: ruby

## Pythonエクササイズの例
整数除算を行うメソッド`divide`を実装しなさい。
Expand All @@ -91,7 +91,7 @@ TAPをサポートしたテストフレームワークを使えばもっと簡

### env

- imageName: givery/track-python-3.6
- imageName: python

## フロントエンドエクササイズの作り方
足し算を行うメソッド`add`を実装しなさい。
Expand Down
2 changes: 1 addition & 1 deletion contents/sample/book/chapter6.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

### env

- imageName: givery/track-java-8
- imageName: java

### hint
ここでは、Main.javaとTest.javaの両方をplaygroundのfileとして指定しているのでどちらも編集可能です。
Expand Down
2 changes: 1 addition & 1 deletion contents/sample/coding-java-2/track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ testcases:
open: 5
secret: 1
envConf:
imageName: givery/track-java-corretto-11.0
imageName: java
4 changes: 2 additions & 2 deletions contents/sample/coding-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ JUnitを使用して、Javaのユニットテスト問題を作成するサン
## 問題作成のポイント
### build.gradle
このサンプルではTestRunnerとしてGradleを使用しています。
[build.gradle](build.grade)はテストの実行結果を[TAP](https://testanything.org/)形式で出力するようにカスタマイズされています。
[build.gradle](build.gradle)はテストの実行結果を[TAP](https://testanything.org/)形式で出力するようにカスタマイズされています。
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo


Java問題を作成する際にはこのbuild.gradleをそのままコピーして使用してください。

Expand All @@ -29,7 +29,7 @@ JUnitを利用したごく普通のユニットテストです。

```
envConf:
imageName: givery/track-java-8
imageName: java
cacheDirs:
- /root/.m2
- /root/.gradle
Expand Down
2 changes: 1 addition & 1 deletion contents/sample/coding-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repositories {
}

dependencies {
testCompile 'junit:junit:4.12'
implementation group: 'junit', name: 'junit', version: '4.+'
}

test {
Expand Down
2 changes: 1 addition & 1 deletion contents/sample/coding-java/track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ testcases:
open: 5
secret: 1
envConf:
imageName: givery/track-java-8
imageName: java
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contents/sample/coding-java/ はコンテンツ作成マニュアルに使用するサンプルですが、notionの方も併せて修正しました。
https://www.notion.so/givery/c71f8d3ba35a45a08c25c73666ed4fc1

また、マニュアルに使用予定の未マージの下記プルリクのイメージも併せて修正しました。

cacheDirs:
- /root/.m2
- /root/.gradle
2 changes: 1 addition & 1 deletion contents/sample/shell/track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ solutions:
- src/script2.sh:solution/script2.sh
- src/script3.sh:solution/script3.sh
envConf:
imageName: givery/track-python-3.9
imageName: python3
initialize:
commands:
- g++ -std=c++11 -o test/judge test/judge.cpp
Expand Down
5 changes: 4 additions & 1 deletion contents/tutorial/coding-csharp-testrunner/src/main.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DOTNET_FRAMEWORK_VERSION Condition=" '$(DOTNET_FRAMEWORK_VERSION)' == '' ">net6.0</DOTNET_FRAMEWORK_VERSION>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(DOTNET_FRAMEWORK_VERSION)</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
Comment on lines +4 to +9
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

チャレンジやブックの C#のcsprojの修正

</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions contents/tutorial/coding-csharp-testrunner/track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ readonly:
build: dotnet build src/main.csproj
test: mocha --exit -R track-reporter
envConf:
imageName: givery/track-cli-dotnet
imageName: dotnet
variables:
APP_COMMAND: dotnet src/bin/Debug/net6.0/main.dll
APP_COMMAND: dotnet src/bin/Debug/main.dll
solutions:
- src/main/App.cs:solution/App.cs
testcases:
Expand Down
2 changes: 1 addition & 1 deletion contents/tutorial/coding-java-testrunner/track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly:
build: javac src/*.java
test: mocha --exit -R track-reporter
envConf:
imageName: givery/track-java-corretto-11.0
imageName: java
variables:
APP_COMMAND: java -classpath src Main
solutions:
Expand Down
141 changes: 106 additions & 35 deletions docs/ja/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,113 @@ envConfには以下のキーが指定できます

すべてのdockerイメージにはclangとnodejsが含まれています。

- givery/track-base2
- givery/track-ruby-2.5
- givery/track-ruby-2.6
- givery/track-ruby-2.7
- givery/track-java-8
- givery/track-java-corretto-11.0
- givery/track-go-1.10
- givery/track-go-1.13
- givery/track-perl-5
- givery/track-python-2.7
- givery/track-python-3.6
- givery/track-python-3.8
- givery/track-php-7.2
- givery/track-php-7.4
- givery/track-scala-2.12
- givery/track-scala-2.13
- givery/track-nodejs-10
- givery/track-nodejs-12.13
- givery/track-nightmare-3.0
- givery/track-mono-5
- givery/track-cpp-googletest
- givery/track-sql
- givery/track-postgres
- givery/track-kotlin
- givery/track-swift-5
- givery/track-swift-5.1
- givery/track-dotnet-2.2
- givery/track-dotnet-3.0
- givery/track-java-corretto-11.0
- givery/track-rust-1.39
- givery/track-haskell-14.11
- givery/track-python3.7-anaconda
- cpp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image リストの修正(env.yml)

- dart
- dotnet
- go
- haskell
- java
- kotlin
- nodejs
- perl
- php
- python
- `python3`でも可能です。どちらも同じ `givery/track-cli-python3` のイメージが使用されます。
- python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pythonとpython3はどちらも同じイメージ(python3)が使われます。
(SimpleNameではpython2はサポートされません)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下の書き方に修正しました。

- python
  - `python3`でも可能です。どちらも同じ `givery/track-cli-python3` のイメージが使用されます。

- ruby
- rust
- scala
- swift
- typescript
- sqlite
- postgres

postgresのイメージを使用する際にはusernameとbaseDirに以下を指定してください
これらのイメージは[DockerHub](https://hub.docker.com/u/givery)で公開されているイメージと次のようにマッピングされています。`cacheDirs`などを含んだマッピングではデフォルトでその設定が反映されます。例えば`java`イメージを使用する時、envConfに`cacheDirs`を記載しなくても、自動で`cacheDirs`に`/root/.m2`の設定が反映されます

```
<details><summary>イメージのマッピング(クリックして展開)</summary>

```yml
cpp:
image: givery/track-cli-cpp
dart:
image: givery/track-cli-dart
dotnet:
image: givery/track-cli-dotnet
go:
image: givery/track-cli-go
workingDir: "/root/src/src/tracks.run/challenge"
cacheDirs:
- /go/pkg
haskell:
image: givery/track-cli-haskell
java:
image: givery/track-cli-java
cacheDirs:
- /root/.m2
kotlin:
image: givery/track-cli-kotlin
cacheDirs:
- /root/.gradle
nodejs:
image: givery/track-cli-nodejs
perl:
image: givery/track-cli-perl
cacheDirs:
- /root/.cpanm
php:
image: givery/track-cli-php
python:
image: givery/track-cli-python3
cacheDirs:
- "/usr/local/lib/python3.11"
python3:
image: givery/track-cli-python3
cacheDirs:
- "/usr/local/lib/python3.11"
ruby:
image: givery/track-cli-ruby
cacheDirs:
- "/usr/local/bundle"
- "/usr/local/lib/ruby/gems/3.2.0"
rust:
image: givery/track-cli-rust
cacheDirs:
- "/root/.cargo/registry"
scala:
image: givery/track-cli-scala
cacheDirs:
- "/root/.ivy2"
- "/root/.sbt"
- "/root/.cache"
swift:
image: givery/track-cli-swift
typescript:
image: givery/track-cli-typescript
sqlite:
image: givery/track-sqlite
postgres:
image: givery/track-postgres
username: "postgres"
baseDir: "/home/postgres"
```
cacheDirs:
- "/var/lib/postgresql/data"
```

</details>

### イメージのバージョンについて
イメージは自動で最新に保たれます。envConfを逐一更新する必要はありません。
Comment on lines +129 to +130
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

バージョンが最新に保たれる(チャレンジを更新しなくても勝手に変わる)旨の追記


#### バージョンの依存について
バージョンに依存するライブラリを利用している場合はご相談ください。
Comment on lines +132 to +133
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet のバージョンに依存するライブラリを利用している場合はこれだけだと動かなくなる可能性があるためご相談ください。

バージョンの依存についても追記しました。

https://givery.slack.com/archives/C39R16W7J/p1695969539480769?thread_ts=1695966255.249269&cid=C39R16W7J


### C#の注意事項
C#に使用するcsprojファイルの`PropertyGroup`には以下の設定を記載してください。バージョンが変わっても動作するようにするためです。
Comment on lines +135 to +136
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C#に関して注意事項の追記

```xml
<DOTNET_FRAMEWORK_VERSION Condition=" '$(DOTNET_FRAMEWORK_VERSION)' == '' ">net6.0</DOTNET_FRAMEWORK_VERSION>
<OutputType>Exe</OutputType>
<TargetFramework>$(DOTNET_FRAMEWORK_VERSION)</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
```
2 changes: 1 addition & 1 deletion docs/ja/how-to-make-book.md
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ book.ymlでenvを定義する代わりに個別のセクションでenvを定義
```
### env

- imageName: givery/track-java-8
- imageName: java
- cacheDirs: /root/.m2
- cacheDirs: /root/.gradle
```
Expand Down