-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
119 lines (112 loc) · 3.06 KB
/
.gitlab-ci.yml
File metadata and controls
119 lines (112 loc) · 3.06 KB
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
stages:
- build
- test
- docs
variables:
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
cache:
key: "maven-${CI_COMMIT_REF_SLUG}"
paths:
- .m2/repository/
policy: pull-push
api_docs_job:
stage: build
tags: ["maven"]
image: python:3.13-slim
script:
- mkdir -p artifacts
- python3 scripts/docs/generate_endpoint_table.py > artifacts/api-endpoints.md
artifacts:
when: always
paths:
- artifacts/api-endpoints.md
expire_in: 1 week
verify_job:
stage: test
tags: ["maven"]
image: maven:3.9-jdk-21
script:
- mvn clean verify -B -Dminicdn.admin.token=secret-token
- mkdir -p artifacts
- |
tar -czf artifacts/mini-cdn-submission-servers.tar.gz \
.env.example \
origin/target/origin-*-exec.jar \
edge/target/edge-*-exec.jar \
router/target/router-*-exec.jar \
origin/data \
origin/data-spare \
edge/data \
router/data
artifacts:
when: always
reports:
junit:
- "*/target/surefire-reports/TEST-*.xml"
paths:
- artifacts/mini-cdn-submission-servers.tar.gz
- "*/target/surefire-reports/"
exclude:
- "**/*-sources.jar"
- "**/*-javadoc.jar"
- "**/original-*.jar"
expire_in: never
retry: 1
cli_bundle_job:
stage: test
tags: ["maven"]
image: maven:3.9-jdk-21
needs:
- verify_job
script:
- mvn -pl cli -am clean package -B -DskipTests -Dminicdn.admin.token=secret-token
- mkdir -p artifacts
- |
tar -czf artifacts/mini-cdn-submission-cli.tar.gz \
.env.example \
cli/target/cli-*-exec.jar
artifacts:
when: always
paths:
- artifacts/mini-cdn-submission-cli.tar.gz
expire_in: never
site_job:
stage: docs
tags: ["maven"]
image: maven:3.9-jdk-21
script:
- mvn -B -DskipTests -Dminicdn.admin.token=secret-token site
artifacts:
when: always
paths:
- target/site/
- "*/target/site/"
expire_in: never
wiki_update_job:
stage: docs
tags: ["maven"]
image: curlimages/curl:8.8.0
needs:
- job: api_docs_job
artifacts: true
script:
- test -n "${GITLAB_API_TOKEN}" || { echo "GITLAB_API_TOKEN is not set"; exit 1; }
- export WIKI_TITLE="API Endpoints"
- export WIKI_SLUG="api-endpoints"
- export WIKI_PAGE_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/wikis/${WIKI_SLUG}"
- |
if curl --silent --fail \
--header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" \
"${WIKI_PAGE_URL}" > /dev/null; then
curl --silent --show-error --fail --request PUT \
--header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" \
--data-urlencode "title=${WIKI_TITLE}" \
--data-urlencode "content@artifacts/api-endpoints.md" \
"${WIKI_PAGE_URL}"
else
curl --silent --show-error --fail --request POST \
--header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" \
--data-urlencode "title=${WIKI_TITLE}" \
--data-urlencode "content@artifacts/api-endpoints.md" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/wikis"
fi