Add readme for building

This commit is contained in:
Rui Hu 2024-03-14 13:35:49 +08:00
parent 66f05c56bf
commit 6a89285dd6
3 changed files with 41 additions and 5 deletions

View File

@ -2,8 +2,26 @@ image: azul/zulu-openjdk:8-latest
stages:
- test
- analyze
# verify the padlock impl independently
unit-test-padlock-impl:
stage: test
script:
- ./gradlew :padlock-impl:test
unit-test-all:
stage: test
script:
- ./gradlew test
artifacts:
when: always
reports:
junit: build/test-results/test/**/TEST-*.xml
run-performance-analyze:
stage: analyze
needs:
- job: unit-test-all
script:
- ./gradlew runPerformanceAnalyze

View File

@ -48,6 +48,26 @@ You should design the proper architectures for your code.
Last but not least, readability and maintainability are also important.
Take this project as a show off to your designing and coding skills.
## Build
This repo uses Gradle to build and test.
There is a unit test boilerplate and a gradle task configured to
automatically test and evaluate the code when you push your commits.
The `SolutionTestBase` is an abstract class for other tests.
It tests the correctness of your solution and don't care about the run time.
See `SolutionTest` for how to use that.
The `PerformanceAnalyze` is not a unit test, but it do analyze roughly how
fast your solution is. You need to fill in the `solve` method before you run it.
Use `./gradlew test` to run all unit test configured in the project,
and use `./gradlew runPerformanceTest` to get an analysis.
> Note: You don't have to have a local gradle installation.
> The `gradlew` script will download one for you.
> Just install a valid jdk (version >= 8) and very thing should be fine.
## Still have unclear problems?
Feel free to contact Jeffrey Freeman (jeffrey.freeman@cleverthis.com).

View File

@ -7,15 +7,13 @@ import com.cleverthis.interview.padlock.PadlockImpl;
*/
public class PerformanceAnalyze {
private static void solve(PadlockImpl padlock) {
// TODO
new Solution().solve(padlock);
}
private static final String RUN_NAME = "Boilerplate";
private static final int TOTAL_RUN = 50;
private static final int NUMPAD_SIZE = 7;
private static final int TOTAL_RUN = 500;
private static final int NUMPAD_SIZE = 9;
static {
System.out.println("Run name: " + RUN_NAME);
System.out.println("Total run: " + TOTAL_RUN);
System.out.println("Numpad size: " + NUMPAD_SIZE);
}