-
Notifications
You must be signed in to change notification settings - Fork 9
/
.gitlab-ci.yml
157 lines (130 loc) · 3.53 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
stages:
- lint
- test
- build
- pre-publish
- publish
## SAST -- default linter
###
sast:
stage: lint
include:
- template: Security/SAST.gitlab-ci.yml
## Linting
###
language-linter:
stage: lint
image: python:3.12-alpine
before_script:
- cd src/test/language_validator
- pip install -r requirements.txt
script:
- python validate.py en_US.yml ../../main/resources/language
## Test & Build
###
python-infra-test:
stage: test
image: python:3.12-alpine
before_script:
- cd spigot_page
- pip install -r requirements.txt
script:
- pytest --junitxml=report.xml
artifacts:
expire_in: 30 days
paths:
- spigot_page/report.xml
reports:
junit: spigot_page/report.xml
maven-test:
stage: test
image: maven:3-eclipse-temurin-22
script:
- mvn test -Dpackage_version=ci-test
artifacts:
expire_in: 30 days
paths:
- target/surefire-reports/
reports:
junit: target/surefire-reports/*.xml
maven-package:
stage: build
image: maven:3-eclipse-temurin-22
script:
- |
if [[ -n "$CI_COMMIT_TAG" ]]; then
PACKAGE_VERSION=${CI_COMMIT_TAG}
elif [[ "$CI_COMMIT_REF_NAME" == "master" ]]; then
PACKAGE_VERSION=master-${CI_COMMIT_SHORT_SHA}
else
PACKAGE_VERSION=branch-${CI_COMMIT_SHORT_SHA}
fi
- mvn package -Dpackage_version=${PACKAGE_VERSION}
artifacts:
expire_in: 30 days
paths:
- target/
## Publish
###
gitlab-registry:
stage: pre-publish
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- |
curl \
--header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
--upload-file target/discord_role_sync-${CI_COMMIT_TAG}.jar \
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/discord_role_sync/${CI_COMMIT_TAG}/discord_role_sync-${CI_COMMIT_TAG}.jar
publish-gitlab:
stage: publish
image: python:3.12-alpine
rules:
- if: $CI_COMMIT_TAG
before_script:
- cd ci
- pip install -r requirements.txt
script:
- python publish_gitlab.py
publish-modrinth:
stage: publish
image: python:3.12-alpine
rules:
- if: $CI_COMMIT_TAG
before_script:
- cd ci
- pip install -r requirements.txt
script:
- python publish_modrinth.py
publish-hangar:
stage: publish
image: python:3.12-alpine
rules:
- if: $CI_COMMIT_TAG
before_script:
- cd ci
- pip install -r requirements.txt
script:
- python publish_hangar.py
## Generate Spigot page description
###
generate-spigot-description:
stage: build
image: python:3.12-alpine
before_script:
- cd spigot_page
- pip install -r requirements.txt
script:
- python markdown_to_bbcode.py ../README.md --out ./spigot_page.bb
artifacts:
expire_in: 30 days
paths:
- spigot_page/spigot_page.bb