|
1 | 1 | stages: |
2 | | - - check |
3 | | - - php |
4 | | - - build |
5 | | - - integration-test |
6 | | - - release |
| 2 | + - test |
7 | 3 |
|
8 | | -.go-cache: |
9 | | - variables: |
10 | | - GOPATH: $CI_PROJECT_DIR/.go |
11 | | - before_script: |
12 | | - - mkdir -p .go |
13 | | - - export PATH=$PATH:$GOPATH/bin |
14 | | - cache: |
15 | | - paths: |
16 | | - - .go/pkg/mod/ |
| 4 | +image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/cimg/go:1.25 |
17 | 5 |
|
18 | | -variables: |
19 | | - DOCKER_HOST: tcp://docker:2375 |
20 | | - GIT_DEPTH: 10 |
21 | | - GIT_SUBMODULE_STRATEGY: recursive |
| 6 | +workflow: |
| 7 | + auto_cancel: |
| 8 | + on_new_commit: interruptible |
22 | 9 |
|
23 | | -unit-test-lint: |
24 | | - stage: check |
25 | | - image: cimg/go:1.25 |
26 | | - extends: .go-cache |
27 | | - script: |
28 | | - # Fake some files to avoid the compiler or "typecheck" linter complaining about a missing embedded file. |
29 | | - - touch internal/legacy/archives/php_linux_amd64 internal/legacy/archives/platform.phar internal/config/embedded-config.yaml |
30 | | - - export PATH=$PATH:$GOPATH/bin |
31 | | - - make lint test |
32 | | - coverage: '/total:\s+\(statements\)\s+\d+.\d+%/' |
33 | | - |
34 | | -build-php-linux-x86: |
| 10 | +.go-setup: |
| 11 | + interruptible: true |
35 | 12 | cache: |
36 | | - - key: |
37 | | - files: |
38 | | - - Makefile |
39 | | - paths: |
40 | | - - internal/legacy/archives/php_linux_amd64 |
41 | | - stage: php |
42 | | - image: docker:20.10-git |
43 | | - services: |
44 | | - - docker:20.10-dind |
45 | | - before_script: |
46 | | - - apk add -U make |
47 | | - - mkdir -p internal/legacy/archives |
48 | | - script: |
49 | | - - make php |
50 | | - artifacts: |
| 13 | + key: |
| 14 | + files: |
| 15 | + - go.sum |
51 | 16 | paths: |
52 | | - - internal/legacy/archives/* |
53 | | - expire_in: 1 day |
54 | | - |
55 | | -build-php-linux-arm: |
56 | | - rules: |
57 | | - - if: $CI_COMMIT_TAG |
58 | | - stage: php |
59 | | - image: docker:20.10-git |
60 | | - services: |
61 | | - - docker:20.10-dind |
| 17 | + - ${GOMODCACHE}/ |
| 18 | + variables: |
| 19 | + GOMODCACHE: $CI_PROJECT_DIR/.gomodcache |
62 | 20 | before_script: |
63 | | - - apk add -U make |
64 | | - - mkdir -p internal/legacy/archives |
65 | | - script: |
66 | | - - make php |
67 | | - artifacts: |
68 | | - paths: |
69 | | - - internal/legacy/archives/* |
70 | | - expire_in: 1 day |
71 | | - tags: |
72 | | - - arm-high-cpu |
| 21 | + - mkdir -p ${GOMODCACHE} |
73 | 22 |
|
74 | | -build-php-windows: |
75 | | - rules: |
76 | | - - if: $CI_COMMIT_TAG |
77 | | - stage: php |
78 | | - image: docker:20.10-git |
79 | | - before_script: |
80 | | - - apk add -U make wget |
| 23 | + # Create fake embedded files for lint and test purposes: |
81 | 24 | - mkdir -p internal/legacy/archives |
82 | | - script: |
83 | | - - make php GOOS=windows GOARCH=amd64 |
84 | | - artifacts: |
85 | | - paths: |
86 | | - - internal/legacy/archives/* |
87 | | - expire_in: 1 day |
88 | | - |
89 | | -build-php-macos-arm: |
90 | | - rules: |
91 | | - - if: $CI_COMMIT_TAG |
92 | | - stage: php |
93 | | - before_script: |
94 | | - - export PATH="/opt/homebrew/bin:$PATH" |
95 | | - script: |
96 | | - - make php |
97 | | - artifacts: |
98 | | - paths: |
99 | | - - internal/legacy/archives/* |
100 | | - expire_in: 1 day |
101 | | - tags: |
102 | | - - macos-arm |
103 | | - |
104 | | -build-php-macos-x86: |
105 | | - rules: |
106 | | - - if: $CI_COMMIT_TAG |
107 | | - stage: php |
108 | | - script: |
109 | | - - make php |
110 | | - artifacts: |
111 | | - paths: |
112 | | - - internal/legacy/archives/* |
113 | | - expire_in: 1 day |
114 | | - tags: |
115 | | - - macos-x86 |
116 | | - |
117 | | -build: |
118 | | - stage: build |
119 | | - image: cimg/go:1.25 |
120 | | - extends: .go-cache |
121 | | - script: |
122 | | - - make single |
123 | | - dependencies: |
124 | | - - build-php-linux-x86 |
125 | | - artifacts: |
126 | | - paths: |
127 | | - - dist/ |
128 | | - expire_in: 1 day |
| 25 | + - touch internal/legacy/archives/platform.phar |
| 26 | + - touch internal/legacy/archives/php_windows_amd64 |
| 27 | + - touch internal/legacy/archives/php_linux_amd64 |
| 28 | + - touch internal/legacy/archives/php_linux_arm64 |
| 29 | + - touch internal/legacy/archives/php_darwin_amd64 |
| 30 | + - touch internal/legacy/archives/php_darwin_arm64 |
| 31 | + - touch internal/config/embedded-config.yaml |
| 32 | + |
| 33 | +test: |
| 34 | + stage: test |
| 35 | + extends: .go-setup |
| 36 | + script: |
| 37 | + - go test -v -race -cover ./... |
| 38 | + coverage: '/total:\s+\(statements\)\s+\d+.\d+%/' |
129 | 39 |
|
130 | | -release: |
131 | | - stage: release |
132 | | - rules: |
133 | | - - if: $CI_COMMIT_TAG |
134 | | - extends: .go-cache |
135 | | - script: |
136 | | - - export PATH="/opt/homebrew/bin:$PATH" |
137 | | - - brew install gon wget |
138 | | - - git remote set-url origin https://github.com/platformsh/cli |
139 | | - - make release |
140 | | - dependencies: |
141 | | - - unit-test-lint |
142 | | - - integration-test-linux |
143 | | - - build-php-linux-arm |
144 | | - - build-php-linux-x86 |
145 | | - - build-php-macos-arm |
146 | | - - build-php-macos-x86 |
147 | | - - build-php-windows |
148 | | - tags: |
149 | | - - macos-arm |
| 40 | +golangci-lint: |
| 41 | + stage: test |
| 42 | + extends: .go-setup |
| 43 | + image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golangci/golangci-lint:v2.4 |
| 44 | + script: golangci-lint run --timeout 0 --verbose |
0 commit comments