-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
80 lines (74 loc) · 2.42 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
80 lines (74 loc) · 2.42 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
image: registry.gitlab.com/heybanditoz/mchelper-build-image:java25-postgres18
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
cache:
paths:
- .gradle
- build
stages:
- build
- test
- deploy
package:
stage: build
script:
- ./gradlew shadowJar --no-daemon
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
test:
stage: test
variables:
AVAJE_PROFILES: ci
NO_DOCKER_POSTGRES: true
script:
- rc-service postgresql start
# We love bash so much, this looks crazy, but you're just gonna have to trust me.
- su -c "psql --command 'ALTER USER postgres WITH PASSWORD \$\$postgres\$\$;'" postgres
- ln -s src/main/resources/sql sql
# Run tests!
# DatabaseInitializationTests runs the migrations for us.
- ./gradlew test jacocoTestReport --no-daemon
# Copy COMMANDS file to cache for use in later job to push it to the repo if needed
- cp -v COMMANDS.md build/COMMANDS.md
needs: ["package"]
dependencies:
- package
coverage: '/ - Instruction Coverage: ([0-9.]+)%/'
artifacts:
when: always
paths:
- build/reports/jacoco/test/**
- build/reports/tests/test/**
reports:
junit: build/test-results/test/**/TEST-*.xml
coverage_report:
coverage_format: jacoco
path: build/reports/jacoco/test/jacocoTestReport.xml
create_image:
stage: deploy
image: docker:28.4.0-dind
cache: []
services:
- docker:28.4.0-dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $IMAGE_TAG || true
- docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $IMAGE_TAG -t $IMAGE_TAG .
- docker push $IMAGE_TAG
new_commands:
stage: deploy
script:
- git remote set-url origin $CI_REPOSITORY_URL
- git config user.name "HeyBanditoz"
- git config user.email "noreply@thisbetternotbeadomainname.com"
- git checkout master
- cp -v build/COMMANDS.md COMMANDS.md
- git add COMMANDS.md
- git commit -m "[automated] update command list [ci skip]" || true # this can fail build if no commit
- git push origin master
only:
- master