-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
121 lines (110 loc) · 3.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# This script requires some pipeline secrets to be configured in Gitlab
# - NPM_FONTAWESOME_KEY: The key to access the npm fontawesome repository
# - S3_ACCESS_KEY: The access key to upload the result
# - S3_SECRET_KEY: The secret key to upload the result
image: node:lts-bullseye
variables:
PROJECT_NAME: "gaslevel"
S3_BUCKET: "webinstaller"
PIO_ENV: "wemos_d1_mini32"
.buildenv:
before_script:
- echo "Running inside $(pwd) - home is $HOME"
- apt update -y && apt -y install python3-pip
- pip3 install -U platformio
- npm config set "@fortawesome:registry" https://npm.fontawesome.com/
- npm config set "//npm.fontawesome.com/:_authToken" "$NPM_FONTAWESOME_KEY"
- if [ ! -d results ]; then mkdir -p results; fi
.uploadenv:
before_script:
- apt update -y && apt -y install s3cmd
- echo "host_base = s3.womolin.de" > ~/.s3cfg
- echo "host_bucket = s3.womolin.de" >> ~/.s3cfg
- echo "bucket_location = de-fra" >> ~/.s3cfg
- echo "use_https = True" >> ~/.s3cfg
- echo "access_key = $S3_ACCESS_KEY" >> ~/.s3cfg
- echo "secret_key = $S3_SECRET_KEY" >> ~/.s3cfg
- echo "signature_v2 = False" >> ~/.s3cfg
cache:
paths:
- /root/.platformio/
- /root/.cache/pip
- .pio
- ui/node_modules
stages:
- build
- upload
build-webui:
stage: build
extends: .buildenv
artifacts:
paths:
- ui/build/
script:
- cd ui
- npm install
- npm run build
build-firmware:
stage: build
extends: .buildenv
dependencies:
- build-webui
needs:
- build-webui
artifacts:
paths:
- results/current-version.json
- results/manifest-update.json
- results/manifest-full.json
- results/firmware.bin
- results/littlefs.bin
- results/partitions.bin
- results/boot_app0.bin
- results/bootloader_dio_80m.bin
- results/esp32-dio-80m-4MB.bin
script:
- pio run -e $PIO_ENV
- pio run -e $PIO_ENV -t buildfs
- if [ $CI_COMMIT_TAG ]; then
TYPE="release";
DEST="${PROJECT_NAME}-${TYPE}";
NAME="${PROJECT_NAME^} stable release";
else
TYPE="latest";
DEST="${PROJECT_NAME}-${TYPE}";
NAME="${PROJECT_NAME^} development release";
fi
- ./tools/webinstaller-manifest-generator.py -f partitions.csv -p ${DEST} -n "${NAME} update" -t update -o manifest-update.json
- ./tools/webinstaller-manifest-generator.py -f partitions.csv -p ${DEST} -n "${NAME} full install" -t full -o manifest-full.json
- cp current-version.json results/
- cp manifest-update.json results/
- cp manifest-full.json results/
- cp .pio/build/$PIO_ENV/firmware.bin results/
- cp .pio/build/$PIO_ENV/littlefs.bin results/
- cp .pio/build/$PIO_ENV/partitions.bin results/
- cp /root/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin results/
- cp /root/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/bin/bootloader_dio_80m.bin results/
- python3 ~/.platformio/packages/tool-esptoolpy/esptool.py --chip esp32
merge_bin -o results/esp32-dio-80m-4MB.bin
--flash_mode dio
--flash_freq 80m
--flash_size 4MB
0x008000 results/partitions.bin
0x010000 results/firmware.bin
0x1A0000 results/firmware.bin
0x330000 results/littlefs.bin
upload:
stage: upload
extends: .uploadenv
dependencies:
- build-firmware
- build-webui
needs:
- build-firmware
- build-webui
script:
- if [ $CI_COMMIT_TAG ]; then DEST=$PROJECT_NAME-release; else DEST=$PROJECT_NAME-latest; fi
- echo "Deploying to $S3_BUCKET/$DEST"
- for file in $(find results/*); do
- s3cmd put $file s3://$S3_BUCKET/$DEST/
- done