-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
95 lines (86 loc) · 2.51 KB
/
.gitlab-ci.yml
File metadata and controls
95 lines (86 loc) · 2.51 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
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/README.html#stages
stages: # List of stages for jobs, and their order of execution
- createVersion
- build
- test
- publish
swift-build:
stage: build
tags:
- swift
before_script:
- apt-get -q update
- apt-get -q dist-upgrade -y
- apt-get install -y libsqlite3-dev
- swift package resolve
- swift package update
script:
- swift build --build-tests
- cp -r $(swift build --build-tests --show-bin-path)/VoteServerPackageTests.xctest package.xctest
artifacts:
paths:
- package.xctest
expire_in: 1 hour
swift-unit-test:
stage: test
tags:
- swift
before_script:
- apt-get -q update
- apt-get -q dist-upgrade -y
- apt-get install -y libsqlite3-dev
- swift package resolve
- swift package update
- mkdir -p $(swift build --build-tests --show-bin-path)
- cp -r package.xctest $(swift build --build-tests --show-bin-path)/VoteServerPackageTests.xctest
script:
- swift test --skip-build
needs: ["swift-build"]
build-docker-image:
stage: build
tags:
- dind
script:
- docker build -t $CI_REGISTRY/harcker/voteserver:$CI_COMMIT_REF_SLUG .
- docker save --output voteserver.tar $CI_REGISTRY/harcker/voteserver:$CI_COMMIT_REF_SLUG
artifacts:
paths:
- voteserver.tar
expire_in: 1 hour
publish-docker-image:
stage: publish
tags:
- dind
script:
- docker load --input voteserver.tar
- docker push $CI_REGISTRY/harcker/voteserver:$CI_COMMIT_REF_SLUG
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
needs: ["build-docker-image", "swift-unit-test"]
bump-version:
stage: createVersion
only:
refs:
- web
variables:
- $VERSION =~ /\d+\.\d+\.\d+$/
variables:
VERSION:
description = "X.X.X"
tags:
- shell
script:
- git config user.name "S/M-Bot"
- git config user.email "project8_bot@noreply.git.smkid.dk"
- git clean -f
- git remote set-url origin "https://bot:${PUSH_TOKEN}@${CI_REPOSITORY_URL#*@}"
- git fetch origin
- git reset --hard origin/main
- git branch -D main || true
- git checkout --track origin/main
- rm Sources/App/version.swift || true
- echo "let version = \"$VERSION\"" >> Sources/App/version.swift
- git add -A .
- git commit -am "Bumped version to $VERSION" || echo "No changes, nothing to commit!"
- git tag -f $VERSION
- git push -o ci.skip "https://bot:${PUSH_TOKEN}@${CI_REPOSITORY_URL#*@}" main --tags