This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 169
/
.gitlab-ci.yml
100 lines (94 loc) · 4.23 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
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_BUILDKIT: 1
IMAGE_TAG: shopware/development
GITHUB_IMAGE_TAG: ghcr.io/shopware/development
MAIN_PHP_VERSION: "8.2"
MAIN_NODE_VERSION: "20.10"
stages:
- analyze
- unit
- build
cache:
key: "Eternal static key"
paths:
- .composer
- .npm
default:
image: shopware/development:7.4-composer-2
tags:
- m5.large
before_script:
- composer self-update --2.2
- composer install --ignore-platform-reqs --no-interaction --optimize-autoloader --no-suggest --no-scripts --no-progress
- composer install --ignore-platform-reqs --no-interaction --optimize-autoloader --no-suggest --no-progress --working-dir=dev-ops/analyze
Static Analysis:
image: shopware/development:7.4-composer-2
stage: analyze
only:
refs:
- merge_requests
- trunk
script:
- dev-ops/analyze/vendor/bin/ecs check --config easy-coding-standard.php
- dev-ops/analyze/vendor/bin/phpstan analyze
Unit:
image: shopware/development:7.4-composer-2
stage: unit
only:
refs:
- merge_requests
- trunk
script:
- vendor/bin/phpunit
--configuration dev-ops/analyze
--log-junit build/artifacts/phpunit.junit.xml
--colors=never
artifacts:
reports:
junit: build/artifacts/phpunit.junit.xml
Build:
image: docker:20.10
stage: build
only:
refs:
- trunk
services:
- name: docker:20.10-dind
parallel:
matrix:
- PHP_VERSION: [ "7.4", "8.0" ]
NODE_VERSION: [ "16" ]
- PHP_VERSION: [ "8.1", "8.2" ]
NODE_VERSION: [ "18.15", "20.10" ]
- PHP_VERSION: [ "8.3" ]
NODE_VERSION: [ "20.10" ]
before_script:
- echo "${REGISTRY_PASSWORD}" | docker login -u "${REGISTRY_USERNAME}" --password-stdin
script:
- docker build -t "$IMAGE_TAG:${PHP_VERSION}-composer-2" -t "$IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-2" -t app-base --build-arg "IMAGE_PHP_VERSION=${PHP_VERSION}" --build-arg "IMAGE_NODE_VERSION=${NODE_VERSION}" dev-ops/docker/containers/app
- docker build -t "$IMAGE_TAG:${PHP_VERSION}-composer-1" -t "$IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-1" -t "$IMAGE_TAG:${PHP_VERSION}" --build-arg "IMAGE_PHP_VERSION=${PHP_VERSION}" --build-arg "IMAGE_NODE_VERSION=${NODE_VERSION}" dev-ops/docker/containers/app-composer-1
- docker rmi app-base
- docker push "$IMAGE_TAG:${PHP_VERSION}"
- docker push "$IMAGE_TAG:${PHP_VERSION}-composer-1"
- docker push "$IMAGE_TAG:${PHP_VERSION}-composer-2"
- docker push "$IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-1"
- docker push "$IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-2"
- echo "$GITHUB_TOKEN" | docker login ghcr.io -u $GITHUB_USER --password-stdin
- docker tag "$IMAGE_TAG:${PHP_VERSION}" "$GITHUB_IMAGE_TAG:${PHP_VERSION}"
- docker push "$GITHUB_IMAGE_TAG:${PHP_VERSION}"
- docker tag "$IMAGE_TAG:${PHP_VERSION}-composer-1" "$GITHUB_IMAGE_TAG:${PHP_VERSION}-composer-1"
- docker push "$GITHUB_IMAGE_TAG:${PHP_VERSION}-composer-1"
- docker tag "$IMAGE_TAG:${PHP_VERSION}-composer-2" "$GITHUB_IMAGE_TAG:${PHP_VERSION}-composer-2"
- docker push "$GITHUB_IMAGE_TAG:${PHP_VERSION}-composer-2"
- docker tag "$IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-1" "$GITHUB_IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-1"
- docker push "$GITHUB_IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-1"
- docker tag "$IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-2" "$GITHUB_IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-2"
- docker push "$GITHUB_IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-2"
- >
if [[ $PHP_VERSION = $MAIN_PHP_VERSION ]] && [[ $NODE_VERSION = $MAIN_NODE_VERSION ]]; then
docker tag $IMAGE_TAG:${PHP_VERSION}-node-${NODE_VERSION}-composer-2 $IMAGE_TAG:latest
docker push $IMAGE_TAG:latest
fi