-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
132 lines (120 loc) · 4.61 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# (c) https://github.com/MontiCore/monticore
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dmaven.repo.local=$CI_PROJECT_DIR/.m2"
cache:
paths:
- .gradle/caches
key: ${CI_COMMIT_REF_SLUG}
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
stages:
- build
- test
- check
- deploy
- trigger_languages
- mirror
build:
stage: build
script:
- "gradle assemble --refresh-dependencies $GRADLE_OPTS $ARGS1"
artifacts:
paths:
- "target/"
expire_in: 1 week
# Checks if the links in this repository's Markdown files are valid.
#
# For more information, visit: https://git.rwth-aachen.de/se/infrastructure/mdlinkchecker (Available internally only)
check-links:
# We need a JDK 17+ image for this job since the link checker requires Java 17.
image: eclipse-temurin:17-jdk-alpine
# The check runs parallel to the build since project documentation is not generated.
stage: build
# Allow failure regardless of whether the tool exists with a non-zero error code. We don't currently want to fail the
# pipeline if a link is invalid.
allow_failure: true
before_script:
- 'apk --no-cache add curl'
script:
- 'curl --location --header "PRIVATE-TOKEN: $secibuildinfstrtoken" "https://git.rwth-aachen.de/api/v4/projects/se%2Finfrastructure%2Fmdlinkchecker/jobs/artifacts/master/raw/target/libs/MDLinkCheckerCLI.jar?job=build" --output MDLinkChecker.jar'
- 'java -jar MDLinkChecker.jar -t "$secibuildtoken" -r . -p'
test:
stage: test
dependencies:
- build
script:
- "gradle check $GRADLE_OPTS $ARGS2"
checkMLCs:
stage: check
dependencies:
- build
needs: [ "build" ]
script:
- "gradle checkArtifacts"
artifacts:
name: mlcreports
when: always
paths:
- "target/reports/"
expire_in: 1 week
deploy:
stage: deploy
dependencies:
- build
script:
- "gradle publish $GRADLE_OPTS $ARGS3 -PmavenPassword=$password -PmavenUser=$username"
only:
- dev
# Mirrors this repository's `dev` and `master` branches to GitHub.
#
# The mirror will always be at either HEAD or HEAD+1 (depending on whether cleanup is necessary).
# For more information, visit: https://git.rwth-aachen.de/se/infrastructure/github-mirror-tools (Available internally only)
githubmirror:
# We need a JDK 17+ image for this job since the link checker requires Java 17.
image: eclipse-temurin:17-jdk-alpine
stage: mirror
variables:
# The repository is edited during this job. To make sure that no changes persist, we instruct GitLab to always
# create a fresh clone of the repository instead of caching it and attempting to remove any changes.
#
# See https://docs.gitlab.com/ee/ci/runners/configure_runners.html#git-strategy
GIT_STRATEGY: clone
dependencies: []
needs: [ "deploy" ]
before_script:
- 'apk --no-cache add curl git openssh-client'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SE_CIBUILD_SSH_PRIV_KEY")
- echo "$SE_CIBUILD_SSH_PRIV_KEY" | tr -d '\r' | ssh-add -
- git config --global user.email "[email protected]"
- git config --global user.name "MontiCore Mirroring Bot"
- git checkout "$CI_COMMIT_REF_NAME" # GitLab checks out a commit in detached HEAD mode by default, but we want to commit to the branch and push.
- mkdir -p ~/.ssh
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
script:
- "curl --location --header \"PRIVATE-TOKEN: $secibuildinfstrtoken\" \"https://git.rwth-aachen.de/api/v4/projects/se%2Finfrastructure%2Fgithub-mirror-tools/repository/files/mirror.sh/raw\" --output mirror.sh"
- sh mirror.sh
- rm mirror.sh
- 'curl --location --header "PRIVATE-TOKEN: $secibuildinfstrtoken" "https://git.rwth-aachen.de/api/v4/projects/se%2Finfrastructure%2Fmdlinkchecker/jobs/artifacts/master/raw/target/libs/MDLinkCheckerCLI.jar?job=build" --output MDLinkChecker.jar'
- 'java -jar MDLinkChecker.jar -t "$secibuildtoken" -r . -p -c -i'
- 'rm MDLinkChecker.jar'
- git add --all
# We'll simply ignore failures during commit because there is a chance that no files were changed. In this case the
# remote will be on the same commit as the upstream repository.
- (git commit -m "[Mirror] Replace all internal links and references") || true
- git remote add github [email protected]:MontiCore/object-diagram.git
- git push github $CI_COMMIT_BRANCH --force
only:
- dev
- master
trigger-artifacts-dev:
stage: trigger_languages
except:
- pipelines
trigger:
project: monticore/artifacts/artifacts
branch: dev
strategy: depend
only:
- dev