Merge branch '1-add-ci-for-testing' into 'master'

Resolve "Add CI for testing"

Closes #1

See merge request oysteikt/v21-tdt4100!1
This commit is contained in:
Oystein Kristoffer Tveit 2021-03-26 11:55:43 +00:00
commit acf2b751a5
2 changed files with 41 additions and 1 deletions

40
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,40 @@
image: maven:3-openjdk-15-slim
variables:
MAVEN_OPTS: " \
-Dhttps.protocols=TLSv1.2 \
-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN \
-Dorg.slf4j.simpleLogger.showDateTime=true \
-Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version"
cache:
paths:
- .m2/repository
stages:
- build
- test
build:
stage: build
script:
- "mvn clean compile $MAVEN_CLI_OPTS"
artifacts:
paths:
- target/
unittest:
stage: test
needs: [build]
script:
- "mvn package $MAVEN_CLI_OPTS"
artifacts:
paths:
- target/
when: always
reports:
junit:
- target/surefire-reports/TEST-*.xml
- target/failsafe-reports/TEST-*.xml

View File

@ -43,7 +43,7 @@ public class StopWatch {
/** forteller klokken at ticks antall tikk har gått. */ /** forteller klokken at ticks antall tikk har gått. */
public void tick(int ticks) { public void tick(int ticks) {
// this.totalTicks += ticks; this.totalTicks += ticks;
if (this.hasBeenStarted ^ this.hasBeenStopped) if (this.hasBeenStarted ^ this.hasBeenStopped)
this.totalTime += ticks; this.totalTime += ticks;
} }