-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy path.gitlab-ci.yml
125 lines (101 loc) · 4.13 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# GitLab CI to build Rust+Mynewt Firmware for PineTime Smart Watch
# Based on https://github.com/lupyuen/pinetime-rust-mynewt/blob/master/.github/workflows/main.yml
# Official language image. Look for the different tagged releases at: https://hub.docker.com/r/library/rust/tags/
image: "rust:latest"
build:
stage: build
#########################################################################################
# Checkout
variables:
# Clone submodules recursively
GIT_SUBMODULE_STRATEGY: recursive
#########################################################################################
# Download and Cache Dependencies
before_script:
# Show files
- set ; pwd ; ls -l
# Install Go
- pushd /tmp
- wget -qO- https://golang.org/dl/go1.14.7.linux-amd64.tar.gz | tar -xz
- popd
- export PATH=$PATH:/tmp/go/bin
- go version
# Install newt
- source scripts/install-version.sh
- pushd /tmp
- git clone --branch $mynewt_version https://github.com/apache/mynewt-newt/
- cd mynewt-newt/
- ./build.sh
- newt/newt version
- popd
- export PATH=$PATH:/tmp/mynewt-newt/newt
- newt version
# Download Mynewt source files
# Ignore Error: Error updating "mcuboot": error: The following untracked working tree files would be overwritten by checkout:
# ext/mbedtls/include/mbedtls/check_config.h
# ext/mbedtls/include/mbedtls/config.h
- export PATH=$PATH:/tmp/mynewt-newt/newt
- newt install -v -f || ls -l repos
# Overwrite MCUBoot with newer version
- source scripts/install-version.sh
- pushd repos
- rm -rf mcuboot
- git clone --branch $mcuboot_version https://github.com/JuulLabs-OSS/mcuboot
# git clone --branch $mynewt_version https://github.com/apache/mynewt-core
# git clone --branch $nimble_version https://github.com/apache/mynewt-nimble
- popd
# Install Rust Target thumbv7em-none-eabihf
- rustup default nightly
- rustup target add thumbv7em-none-eabihf
# Install Embedded Arm Toolchain arm-none-eabi-gcc
- pushd /tmp
- wget -qO- https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 | tar -xj
- popd
- export PATH=$PATH:/tmp/gcc-arm-none-eabi-8-2019-q3-update/bin
- arm-none-eabi-gcc --version
#########################################################################################
# Convert Logo
# Convert Logo from PNG to C
# Run pinetime-graphic in the temp folder to avoid Cargo.toml and .cargo conflicts
- cp -r pinetime-graphic /tmp
- cp pinetime-graphic.png /tmp/pinetime-graphic
# Convert the graphic from PNG to C
- pushd /tmp/pinetime-graphic
- rustup default nightly
- export RUST_BACKTRACE=1
- export TERM=vt100
- cargo run -q pinetime-graphic.png >$CI_PROJECT_DIR/apps/my_sensor_app/src/write_graphic.inc
- popd
#########################################################################################
# Build Rust+Mynewt Application Firmware
script:
# Set PATH
- export PATH=$PATH:/tmp/go/bin:/tmp/mynewt-newt/newt:/tmp/gcc-arm-none-eabi-8-2019-q3-update/bin
# Build Application Firmware
- ./scripts/build-app.sh
# Create Application Firmware Image
- ./scripts/nrf52/image-app.sh
# Copy the Application Firmware Image to top level for uploading
- cp bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.img .
#########################################################################################
# Upload Application Firmware
artifacts:
paths:
# Application Firmware Image for flashing
- my_sensor_app.img
# Other Application Firmware Outputs
- bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.*
#########################################################################################
# Cache Outputs
cache:
paths:
- "*.o"
- /tmp/go
- /tmp/mynewt-newt
- /tmp/gcc-arm-none-eabi-8-2019-q3-update
#########################################################################################
# Run Tests
test:
stage: test
script:
- echo "Done!"