Skip to content

Commit 0a0f42b

Browse files
author
damithc
committed
Merge branch 'full-template'
2 parents 3b83789 + d00eaa3 commit 0a0f42b

File tree

20 files changed

+942
-79
lines changed

20 files changed

+942
-79
lines changed

.github/workflows/gradle.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Java CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
platform: [ubuntu-latest, macos-latest, windows-latest]
10+
runs-on: ${{ matrix.platform }}
11+
12+
steps:
13+
- name: Set up repository
14+
uses: actions/checkout@master
15+
16+
- name: Set up repository
17+
uses: actions/checkout@master
18+
with:
19+
ref: master
20+
21+
- name: Merge to master
22+
run: git checkout --progress --force ${{ github.sha }}
23+
24+
- name: Validate Gradle Wrapper
25+
uses: gradle/wrapper-validation-action@v1
26+
27+
- name: Setup JDK 11
28+
uses: actions/setup-java@v1
29+
with:
30+
java-version: '11'
31+
java-package: jdk+fx
32+
33+
- name: Build and check with Gradle
34+
run: ./gradlew check
35+
36+
- name: Perform IO redirection test (*NIX)
37+
if: runner.os == 'Linux'
38+
working-directory: ${{ github.workspace }}/text-ui-test
39+
run: ./runtest.sh
40+
41+
- name: Perform IO redirection test (MacOS)
42+
if: always() && runner.os == 'macOS'
43+
working-directory: ${{ github.workspace }}/text-ui-test
44+
run: ./runtest.sh
45+
46+
- name: Perform IO redirection test (Windows)
47+
if: always() && runner.os == 'Windows'
48+
working-directory: ${{ github.workspace }}/text-ui-test
49+
shell: cmd
50+
run: runtest.bat

README.md

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,61 @@ This is a project template for a greenfield Java project. It's named after the J
44

55
## Setting up in Intellij
66

7-
Prerequisites: JDK 11, update Intellij to the most recent version.
8-
9-
1. Open Intellij (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project first)
10-
1. Open the project into Intellij as follows:
11-
1. Click `Open`.
12-
1. Select the project directory, and click `OK`.
13-
1. If there are any further prompts, accept the defaults.
14-
1. Configure the project to use **JDK 11** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).<br>
15-
In the same dialog, set the **Project language level** field to the `SDK default` option.
16-
3. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
7+
Prerequisites: JDK 11 (use the exact version), update Intellij to the most recent version.
8+
9+
1. **Ensure Intellij JDK 11 is defined as an SDK**, as described [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk) -- this step is not needed if you have used JDK 11 in a previous Intellij project.
10+
1. **Import the project _as a Gradle project_**, as described [here](https://se-education.org/guides/tutorials/intellijImportGradleProject.html).
11+
1. **Verify the set up**: After the importing is complete, locate the `src/main/java/seedu/duke/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below:
1712
```
13+
> Task :compileJava
14+
> Task :processResources NO-SOURCE
15+
> Task :classes
16+
17+
> Task :Duke.main()
1818
Hello from
1919
____ _
2020
| _ \ _ _| | _____
2121
| | | | | | | |/ / _ \
2222
| |_| | |_| | < __/
2323
|____/ \__,_|_|\_\___|
24+
25+
What is your name?
2426
```
27+
Type some word and press enter to let the execution proceed to the end.
28+
29+
## Build automation using Gradle
30+
31+
* This project uses Gradle for build automation and dependency management. It includes a basic build script as well (i.e. the `build.gradle` file).
32+
* If you are new to Gradle, refer to the [Gradle Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/gradle.html).
33+
34+
## Testing
35+
36+
### I/O redirection tests
37+
38+
* To run _I/O redirection_ tests (aka _Text UI tests_), navigate to the `text-ui-test` and run the `runtest(.bat/.sh)` script.
39+
40+
### JUnit tests
41+
42+
* A skeleton JUnit test (`src/test/java/seedu/duke/DukeTest.java`) is provided with this project template.
43+
* If you are new to JUnit, refer to the [JUnit Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/junit.html).
44+
45+
## Checkstyle
46+
47+
* A sample CheckStyle rule configuration is provided in this project.
48+
* If you are new to Checkstyle, refer to the [Checkstyle Tutorial at se-education.org/guides](https://se-education.org/guides/tutorials/checkstyle.html).
49+
50+
## CI using GitHub Actions
51+
52+
The project uses [GitHub actions](https://github.com/features/actions) for CI. When you push a commit to this repo or PR against it, GitHub actions will run automatically to build and verify the code as updated by the commit/PR.
53+
54+
## Documentation
55+
56+
`/docs` folder contains a skeleton version of the project documentation.
57+
58+
Steps for publishing documentation to the public:
59+
1. If you are using this project template for an individual project, go your fork on GitHub.<br>
60+
If you are using this project template for a team project, go to the team fork on GitHub.
61+
1. Click on the `settings` tab.
62+
1. Scroll down to the `GitHub Pages` section.
63+
1. Set the `source` as `master branch /docs folder`.
64+
1. Optionally, use the `choose a theme` button to choose a theme for your documentation.

build.gradle

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
plugins {
2+
id 'java'
3+
id 'application'
4+
id 'checkstyle'
5+
id 'com.github.johnrengelman.shadow' version '7.1.2'
6+
}
7+
8+
repositories {
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0'
14+
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.0'
15+
}
16+
17+
test {
18+
useJUnitPlatform()
19+
20+
testLogging {
21+
events "passed", "skipped", "failed"
22+
23+
showExceptions true
24+
exceptionFormat "full"
25+
showCauses true
26+
showStackTraces true
27+
showStandardStreams = false
28+
}
29+
}
30+
31+
application {
32+
mainClass.set("seedu.duke.Duke")
33+
}
34+
35+
shadowJar {
36+
archiveBaseName.set("duke")
37+
archiveClassifier.set("")
38+
}
39+
40+
checkstyle {
41+
toolVersion = '10.2'
42+
}
43+
44+
run{
45+
standardInput = System.in
46+
}

0 commit comments

Comments
 (0)