This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
99 lines (77 loc) · 2.67 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
stages:
- setup
- build
- release
variables:
TARGET: NUCLEO_F303K8
TOOLCHAIN: GCC_ARM
GITHUB_REPO: github.com/jojoxd/DXC-22-L
mirror-repository:
image: bitnami/git
stage: setup
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
before_script:
- 'which ssh-agent || ( apt-get update -qy && apt-get install openssh-client -qqy )'
- eval `ssh-agent -s`
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_PUBLIC_KEY" >> ~/.ssh/id_rsa.pub
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- "echo 'TODO: Mirror Repository'"
- git clone --mirror https://${GITHUB_REPO}.git upstream
- cd upstream
- git remote rm origin
- git remote add origin ssh://git@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
- git push --prune --all
- git push --prune --tags
setup:
image: ghcr.io/armmbed/mbed-os-env:mbed-os-6-latest
stage: setup
rules:
- if: $CI_PIPELINE_SOURCE != "schedule"
cache:
key: mbed-libraries
paths:
- lib/
script:
- mbed deploy
build:
image: ghcr.io/armmbed/mbed-os-env:mbed-os-6-latest
stage: build
needs:
- job: setup
parallel:
matrix:
- DXC_TEAM: [1, 2, 3]
cache:
key: mbed-libraries
paths:
- lib/
policy: pull
artifacts:
paths:
- DXC-22-L-${CI_COMMIT_REF_NAME}-TEAM-${DXC_TEAM}.bin
script:
- mbed deploy
- mbed compile -t ${TOOLCHAIN} -m ${TARGET} -D DXC_TEAM=${DXC_TEAM} -D VERSION_STR=${CI_COMMIT_REF_NAME} -D VERSION_COMMIT_SHA=${CI_COMMIT_SHORT_SHA}
- mv BUILD/${TARGET}/${TOOLCHAIN}/DXC-22-L.bin DXC-22-L-${CI_COMMIT_REF_NAME}-TEAM-${DXC_TEAM}.bin
release:
image: ubuntu:latest
stage: release
# Requires Variable GITHUB_TOKEN to be set
needs:
- job: build
artifacts: true
before_script:
- apt-get update
- apt-get install -y curl git
- curl -sL https://github.com/cli/cli/releases/download/v2.5.0/gh_2.5.0_linux_amd64.deb -o gh-cli.deb
- dpkg -i gh-cli.deb
script:
- gh release create release/${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} -R ${GITHUB_REPO} --target "${CI_COMMIT_REF_SLUG}" -t "Release ${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}" --generate-notes
- gh release upload release/${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} -R ${GITHUB_REPO} DXC-22-L-${CI_COMMIT_REF_NAME}-TEAM-1.bin
- gh release upload release/${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} -R ${GITHUB_REPO} DXC-22-L-${CI_COMMIT_REF_NAME}-TEAM-2.bin
- gh release upload release/${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} -R ${GITHUB_REPO} DXC-22-L-${CI_COMMIT_REF_NAME}-TEAM-3.bin