Fixed repository artifact
[Mograsim.git] / .gitlab-ci.yml
1 # This file is a template, and might need editing before it works on your project.
2
3 # Build JAVA applications using Apache Maven (http://maven.apache.org)
4 # For docker image tags see https://hub.docker.com/_/maven/
5 #
6 # For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
7
8 # This template will build and test your projects
9 # * Caches downloaded dependencies and plugins between invocation.
10 # * Verify but don't deploy merge requests.
11 # * Deploy built artifacts from master branch only.
12
13 variables:
14   GIT_SUBMODULE_STRATEGY: recursive
15   # This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
16   # `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
17   MAVEN_OPTS: "-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"
18   # As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
19   # when running from the command line.
20   # `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
21   MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
22
23 # This template uses jdk11 for verifying and deploying images
24 image: maven:3.6.1-jdk-11  # Maven 3.6.2 will currently NOT WORK!
25
26 # Cache downloaded dependencies and plugins between builds.
27 # To keep cache across branches add 'key: "$CI_JOB_NAME"'
28 cache:
29   key: "$CI_COMMIT_REF_SLUG"
30   paths:
31     - .m2/repository
32
33 stages:
34   - validate
35   - test
36   - package_repo
37
38 default:
39   before_script:
40     - cd TempMavenTychoSnapshotWorkaround
41     - mvn $MAVEN_CLI_OPTS clean # This is only temporary to resolve TYCHO 1.5.0-SNAPSHOT for the main build
42     - cd ..
43
44 validate:
45   stage: validate
46   script:
47     - mvn $MAVEN_CLI_OPTS clean validate
48
49 test:
50   stage: test
51   script:
52     - mvn $MAVEN_CLI_OPTS verify
53   artifacts:
54     when: on_failure
55     expire_in: 1 week
56     reports:
57       junit: tests/*/target/surefire-reports/TEST-*.xml
58
59 package_repo:
60   stage: package_repo
61   when: manual
62   script: 
63     - mvn $MAVEN_CLI_OPTS verify
64   artifacts:
65     paths:
66       - releng/net.mograsim.plugin.updatesite/target/*.zip