-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
73 lines (66 loc) · 2.01 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
include:
- project: 'Northern.tech/Mender/mendertesting'
file:
- '.gitlab-ci-check-commits.yml'
- '.gitlab-ci-github-status-updates.yml'
- '.gitlab-ci-check-license.yml'
stages:
- build
- test
variables:
MENDER_MCU_REVISION: v0.3-inventory
IMAGE_VERSION: main
.boards-matrix:
parallel:
matrix:
- MENDER_MCU_BOARD: [
nrf52840dk/nrf52840,
esp32_ethernet_kit/esp32/procpu,
esp32s3_devkitc/esp32s3/procpu,
olimex_esp32_evb/esp32/procpu,
mr_canhubk3,
native_sim
]
.build-template:
tags:
- hetzner-amd-beefy
stage: build
variables:
CONTAINER_TAG: "west-workspace"
build:workspace:
extends: .build-template
services:
- docker:dind
script:
- echo "INFO - Building and Pushing ${CONTAINER_TAG}-${CI_PIPELINE_ID} to the registry ${CI_REGISTRY_IMAGE}"
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker build
--cache-from ${CI_REGISTRY_IMAGE}:${CONTAINER_TAG}-main
--file Dockerfile.ci
--tag ${CI_REGISTRY_IMAGE}:${CONTAINER_TAG}-${CI_COMMIT_BRANCH}
--push
.
- echo "IMAGE_VERSION=$CI_COMMIT_BRANCH" >> image_version.env
rules:
- if: $CI_COMMIT_BRANCH == "main"
# Rebuild the workspace image if the Dockerfile.ci changes
- changes:
paths:
- Dockerfile.ci
compare_to: main
artifacts:
reports:
dotenv: image_version.env
build:board:
extends: .build-template
image: ${CI_REGISTRY_IMAGE}:${CONTAINER_TAG}-${IMAGE_VERSION}
needs:
- job: build:workspace
optional: true
script:
- west update --narrow -o=--depth=1 --path-cache /zephyr-workspace-cache
- echo "Building for ${MENDER_MCU_BOARD} with revision ${MENDER_MCU_REVISION}"
- cd ../modules/mender-mcu && git fetch mender
- git checkout mender/${MENDER_MCU_REVISION} && cd -
- west build --board ${MENDER_MCU_BOARD}
parallel: !reference [.boards-matrix, parallel]