-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
75 lines (70 loc) 路 1.79 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
---
stages:
- test
- build
- release
variables:
SEMVER_PREFIX: v
CONTAINER_FILE_LOCATION: "Containerfile"
KANIKO_ARGS: --destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}
.go_template_defaults:
stage: test
.semver_template_defaults:
stage: release
.kaniko_template_defaults:
stage: build
include:
- { project: bonsai-oss/organization/automate/ci-templates, file: templates/language/go.yml }
- { project: bonsai-oss/organization/automate/ci-templates, file: templates/release/semver.yml }
- { project: bonsai-oss/organization/automate/ci-templates, file: templates/release/kaniko.yml }
integration test:
image: golang:1.22
stage: test
needs:
- go test
parallel:
matrix:
- CUSTOM_ENV_CI_JOB_IMAGE:
- debian-12
- ubuntu:latest
CUSTOM_ENV_HCLOUD_SERVER_TYPE:
- auto
CUSTOM_ENV_HCLOUD_SERVER_ARCHITECTURE:
- amd64
- arm64
before_script:
- make build
script:
- ./bin/hmp --version
- ./bin/hmp prepare --job-id "$CI_JOB_ID"
- ./bin/hmp exec <(echo -e '#!/usr/bin/env bash\ncat /etc/os-release') test1
- ./bin/hmp exec <(echo -e '#!/usr/bin/env bash\necho "Hello, World!"') test2 | grep "Hello, World!"
after_script:
- ./bin/hmp cleanup --job-id "$CI_JOB_ID"
build release binaries:
image: golang:1.22
stage: build
parallel:
matrix:
- GOOS: [linux, windows, darwin, freebsd, openbsd]
GOARCH: [amd64, arm64]
script:
- make build
- mv bin/hmp bin/hmp-${GOOS}-${GOARCH}
artifacts:
paths:
- bin/hmp-${GOOS}-${GOARCH}
expire_in: 1 hour
release:
image: alpine:latest
stage: release
rules:
- if: $CI_COMMIT_TAG
needs:
- job: build release binaries
artifacts: true
script:
- ls -l bin
artifacts:
paths:
- bin