|
3 | 3 | # Based on https://github.com/JF002/InfiniTime/blob/master/doc/buildAndProgram.md
|
4 | 4 | # and https://github.com/JF002/InfiniTime/blob/master/bootloader/README.md
|
5 | 5 |
|
6 |
| -# Name of this Workflow |
7 | 6 | name: Build PineTime Firmware
|
8 | 7 |
|
9 |
| -# When to run this Workflow... |
10 | 8 | on:
|
11 |
| - |
12 |
| - # Run this Workflow when files are updated (Pushed) in the "master" and "develop" Branch |
13 | 9 | push:
|
14 | 10 | branches: [ master, develop ]
|
15 |
| - |
16 |
| - # Also run this Workflow when a Pull Request is created or updated in the "master" and "develop" Branch |
17 | 11 | pull_request:
|
18 | 12 | branches: [ master, develop ]
|
19 | 13 |
|
20 |
| -# Steps to run for the Workflow |
21 | 14 | jobs:
|
22 | 15 | build:
|
23 |
| - |
24 |
| - # Run these steps on Ubuntu |
25 | 16 | runs-on: ubuntu-latest
|
26 |
| - |
| 17 | + container: |
| 18 | + image: infinitime/infinitime-build |
27 | 19 | steps:
|
28 |
| - |
29 |
| - ######################################################################################### |
30 |
| - # Download and Cache Dependencies |
31 |
| - |
32 |
| - - name: Install cmake |
33 |
| - uses: lukka/get-cmake@v3.18.3 |
34 |
| - |
35 |
| - - name: Check cache for Embedded Arm Toolchain arm-none-eabi-gcc |
36 |
| - id: cache-toolchain |
37 |
| - uses: actions/cache@v2 |
38 |
| - env: |
39 |
| - cache-name: cache-toolchain-9-2020-q2 |
40 |
| - with: |
41 |
| - path: ${{ runner.temp }}/arm-none-eabi |
42 |
| - key: ${{ runner.os }}-build-${{ env.cache-name }} |
43 |
| - restore-keys: ${{ runner.os }}-build-${{ env.cache-name }} |
44 |
| - |
45 |
| - - name: Install Embedded Arm Toolchain arm-none-eabi-gcc |
46 |
| - if: steps.cache-toolchain.outputs.cache-hit != 'true' # Install toolchain if not found in cache |
47 |
| - uses: fiam/arm-none-eabi-gcc@v1.0.4 |
48 |
| - with: |
49 |
| - # GNU Embedded Toolchain for Arm release name, in the V-YYYY-qZ format (e.g. "9-2019-q4") |
50 |
| - release: 9-2020-q2 |
51 |
| - # Directory to unpack GCC to. Defaults to a temporary directory. |
52 |
| - directory: ${{ runner.temp }}/arm-none-eabi |
53 |
| - |
54 |
| - - name: Check cache for nRF5 SDK |
55 |
| - id: cache-nrf5sdk |
56 |
| - uses: actions/cache@v2 |
57 |
| - env: |
58 |
| - cache-name: cache-nrf5sdk |
59 |
| - with: |
60 |
| - path: ${{ runner.temp }}/nrf5_sdk |
61 |
| - key: ${{ runner.os }}-build-${{ env.cache-name }} |
62 |
| - restore-keys: ${{ runner.os }}-build-${{ env.cache-name }} |
63 |
| - |
64 |
| - - name: Install nRF5 SDK |
65 |
| - if: steps.cache-nrf5sdk.outputs.cache-hit != 'true' # Install SDK if not found in cache |
66 |
| - run: | |
67 |
| - cd ${{ runner.temp }} |
68 |
| - curl https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip -o nrf5_sdk.zip |
69 |
| - unzip nrf5_sdk.zip |
70 |
| - mv nRF5_SDK_15.3.0_59ac345 nrf5_sdk |
71 |
| -
|
72 |
| - - name: Check cache for MCUBoot |
73 |
| - id: cache-mcuboot |
74 |
| - uses: actions/cache@v2 |
75 |
| - env: |
76 |
| - cache-name: cache-mcuboot |
77 |
| - with: |
78 |
| - path: ${{ runner.temp }}/mcuboot |
79 |
| - key: ${{ runner.os }}-build-${{ env.cache-name }} |
80 |
| - restore-keys: ${{ runner.os }}-build-${{ env.cache-name }} |
81 |
| - |
82 |
| - - name: Install MCUBoot |
83 |
| - if: steps.cache-mcuboot.outputs.cache-hit != 'true' # Install MCUBoot if not found in cache |
84 |
| - run: | |
85 |
| - cd ${{ runner.temp }} |
86 |
| - git clone --branch v1.7.2 https://github.com/mcu-tools/mcuboot |
87 |
| -
|
88 |
| - - name: Install imgtool dependencies |
89 |
| - run: | |
90 |
| - pip3 install --user -r ${{ runner.temp }}/mcuboot/scripts/requirements.txt |
91 |
| -
|
92 |
| - - name: Install adafruit-nrfutil |
93 |
| - run: | |
94 |
| - pip3 install --user wheel |
95 |
| - pip3 install --user setuptools |
96 |
| - pip3 install --user adafruit-nrfutil |
97 |
| -
|
98 |
| - ######################################################################################### |
99 |
| - # Checkout |
100 |
| - |
| 20 | + # This workaround fixes the error "unsafe repository (REPO is owned by someone else)". |
| 21 | + # See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766 |
| 22 | + # The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current |
| 23 | + # commit hash, for example). |
| 24 | + - name: Workaround permission issues |
| 25 | + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
101 | 26 | - name: Checkout source files
|
102 | 27 | uses: actions/checkout@v2
|
103 | 28 | with:
|
104 | 29 | submodules: recursive
|
105 |
| - |
106 |
| - - name: Show files |
107 |
| - run: set ; pwd ; ls -l |
108 |
| - |
109 |
| - ######################################################################################### |
110 |
| - # CMake |
111 |
| - |
112 |
| - - name: CMake |
113 |
| - run: | |
114 |
| - mkdir -p build |
115 |
| - cd build |
116 |
| - cmake -G Ninja -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../ |
117 |
| -
|
118 |
| - ######################################################################################### |
119 |
| - # Make and Upload DFU Package |
120 |
| - # pinetime-mcuboot-app.img must be flashed at address 0x8000 in the internal flash memory with OpenOCD: |
121 |
| - # program image.bin 0x8000 |
122 |
| - |
123 |
| - # For Debugging Builds: Remove "make" option "-j" for clearer output. Add "--trace" to see details. |
124 |
| - # For Faster Builds: Add "make" option "-j" |
125 |
| - |
126 |
| - - name: Make pinetime-mcuboot-app |
127 |
| - run: | |
128 |
| - cmake --build build --target pinetime-mcuboot-app |
129 |
| -
|
| 30 | + - name: Build |
| 31 | + shell: bash |
| 32 | + env: |
| 33 | + SOURCES_DIR: . |
| 34 | + run: /opt/build.sh all |
| 35 | + # Unzip the package because Upload Artifact will zip up the files |
130 | 36 | - name: Unzip DFU package
|
131 |
| - run: | |
132 |
| - # Unzip the package because Upload Artifact will zip up the files |
133 |
| - unzip build/src/pinetime-mcuboot-app-dfu*.zip -d build/src/pinetime-mcuboot-app-dfu |
134 |
| -
|
135 |
| - - name: Upload DFU package |
136 |
| - uses: actions/upload-artifact@v2 |
| 37 | + run: unzip ./build/output/pinetime-mcuboot-app-dfu-*.zip -d ./build/output/pinetime-mcuboot-app-dfu |
| 38 | + - name: Upload DFU artifacts |
| 39 | + uses: actions/upload-artifact@v3 |
137 | 40 | with:
|
138 |
| - name: pinetime-mcuboot-app-dfu |
139 |
| - path: build/src/pinetime-mcuboot-app-dfu/* |
140 |
| - |
141 |
| - ######################################################################################### |
142 |
| - # Make and Upload Standalone Firmware |
143 |
| - |
144 |
| - - name: Make pinetime-app |
145 |
| - run: | |
146 |
| - cmake --build build --target pinetime-app |
147 |
| -
|
148 |
| - - name: Upload standalone firmware |
149 |
| - uses: actions/upload-artifact@v2 |
| 41 | + name: InfiniTime DFU ${{ github.head_ref }} |
| 42 | + path: ./build/output/pinetime-mcuboot-app-dfu/* |
| 43 | + - name: Upload MCUBoot image artifacts |
| 44 | + uses: actions/upload-artifact@v3 |
150 | 45 | with:
|
151 |
| - name: pinetime-app.out |
152 |
| - path: build/src/pinetime-app*.out |
153 |
| - |
154 |
| - ######################################################################################### |
155 |
| - # Make but don't Upload the Recovery Firmware to be sure it builds correctly |
156 |
| - |
157 |
| - - name: Make pinetime-recovery |
158 |
| - run: | |
159 |
| - cmake --build build --target pinetime-recovery |
160 |
| -
|
161 |
| - ######################################################################################### |
162 |
| - # Finish |
163 |
| - |
164 |
| - - name: Find output |
165 |
| - run: | |
166 |
| - find . -name "pinetime-app.*" -ls |
167 |
| - find . -name "pinetime-mcuboot-app.*" -ls |
168 |
| -
|
169 |
| -# Embedded Arm Toolchain and nRF5 SDK will only be cached if the build succeeds. |
170 |
| -# So make sure that the first build always succeeds, e.g. comment out the "Make" step. |
| 46 | + name: InfiniTime MCUBoot image ${{ github.head_ref }} |
| 47 | + path: ./build/output/pinetime-mcuboot-app-image-*.bin |
0 commit comments