-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
116 lines (104 loc) · 4.72 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
# (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"
MAVEN_CLI_OPTS: "--settings settings.xml --batch-mode"
cache:
paths:
- .gradle/wrapper
key: ${CI_COMMIT_REF_SLUG}
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
stages:
- build
- test
- deploy
build:
stage: build
script:
- "gradle assemble --refresh-dependencies $GRADLE_OPTS $ARGS1"
artifacts:
paths:
- "."
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"
deploy:
stage: deploy
script:
- "gradle publish $GRADLE_OPTS $ARGS3 -PmavenPassword=$pass -PmavenUser=$user"
only:
- develop
checkArtifacts:
stage: test
script:
- "gradle checkArtifactsFeatureDiagram $GRADLE_OPTS $ARGS3 -PmavenPassword=$pass -PmavenUser=$user"
- "gradle checkArtifactsFeatureConfiguration $GRADLE_OPTS $ARGS3 -PmavenPassword=$pass -PmavenUser=$user"
- "gradle checkArtifactsFeatureConfigurationPartial $GRADLE_OPTS $ARGS3 -PmavenPassword=$pass -PmavenUser=$user"
# Mirrors this repository's `develop` 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: deploy
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: []
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/feature-diagram.git
- git push github $CI_COMMIT_BRANCH --force
rules:
- when: never
# trigger_langexp:
# stage: it-test
# trigger:
# project: monticore/langexperiments
# branch: dev
# only:
# - develop