2022-08-25 05:32:46 +00:00
|
|
|
name: CI
|
2020-09-27 11:10:00 +00:00
|
|
|
|
2022-08-25 05:32:46 +00:00
|
|
|
# Run this workflow whenever the build may be affected
|
2020-09-27 11:10:00 +00:00
|
|
|
on:
|
|
|
|
push:
|
2024-01-18 21:49:37 +00:00
|
|
|
branches: [ main, 'wb/*' ]
|
2022-07-05 06:22:29 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'doc/**'
|
2022-08-10 23:42:17 +00:00
|
|
|
- '**.md'
|
2020-09-27 11:10:00 +00:00
|
|
|
pull_request:
|
2023-03-01 22:42:29 +00:00
|
|
|
branches: [ main ]
|
2022-07-05 06:22:29 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'doc/**'
|
2022-08-10 23:42:17 +00:00
|
|
|
- '**.md'
|
2022-08-25 09:34:12 +00:00
|
|
|
|
2020-09-27 11:10:00 +00:00
|
|
|
jobs:
|
2022-08-25 05:32:46 +00:00
|
|
|
build-firmware:
|
2023-01-31 07:42:27 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-05-15 08:50:12 +00:00
|
|
|
container:
|
2022-05-18 19:53:06 +00:00
|
|
|
image: infinitime/infinitime-build
|
2023-01-07 16:15:37 +00:00
|
|
|
outputs:
|
|
|
|
text_size: ${{ steps.output-sizes.outputs.text_size }}
|
|
|
|
data_size: ${{ steps.output-sizes.outputs.data_size }}
|
|
|
|
bss_size: ${{ steps.output-sizes.outputs.bss_size }}
|
|
|
|
env:
|
|
|
|
# InfiniTime sources are downloaded to the current directory.
|
|
|
|
# Override SOURCES_DIR in build.sh
|
|
|
|
SOURCES_DIR: .
|
2020-09-27 11:10:00 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout source files
|
2023-01-07 16:14:05 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-08-14 12:47:00 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
2023-09-21 21:10:38 +00:00
|
|
|
- name: Install resource build dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update
|
|
|
|
apt-get -y install --no-install-recommends python3-pil
|
2022-05-15 08:50:12 +00:00
|
|
|
- name: Build
|
|
|
|
shell: bash
|
2022-05-27 08:36:55 +00:00
|
|
|
run: /opt/build.sh all
|
2023-01-07 16:15:37 +00:00
|
|
|
- name: Output build size
|
|
|
|
id: output-sizes
|
|
|
|
run: |
|
|
|
|
. /opt/build.sh
|
|
|
|
.github/workflows/getSize.sh "$BUILD_DIR"/src/pinetime-app-*.out >> $GITHUB_OUTPUT
|
2022-05-27 08:31:17 +00:00
|
|
|
# Unzip the package because Upload Artifact will zip up the files
|
|
|
|
- name: Unzip DFU package
|
|
|
|
run: unzip ./build/output/pinetime-mcuboot-app-dfu-*.zip -d ./build/output/pinetime-mcuboot-app-dfu
|
2024-11-14 20:59:14 +00:00
|
|
|
- name: Set ref_name, but replace slashes with dashes.
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
ref_name: ${{ github.head_ref || github.ref_name }}
|
|
|
|
run: echo "REF_NAME=${ref_name//\//-}" >> $GITHUB_ENV
|
2022-05-15 08:50:12 +00:00
|
|
|
- name: Upload DFU artifacts
|
2022-05-02 09:26:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-09-27 11:10:00 +00:00
|
|
|
with:
|
2024-11-14 20:59:14 +00:00
|
|
|
name: InfiniTime DFU ${{ env.REF_NAME }}
|
2022-05-27 08:31:17 +00:00
|
|
|
path: ./build/output/pinetime-mcuboot-app-dfu/*
|
2022-05-15 08:50:12 +00:00
|
|
|
- name: Upload MCUBoot image artifacts
|
2022-05-02 09:26:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-09-27 11:10:00 +00:00
|
|
|
with:
|
2024-11-14 20:59:14 +00:00
|
|
|
name: InfiniTime MCUBoot image ${{ env.REF_NAME }}
|
2022-05-27 08:36:55 +00:00
|
|
|
path: ./build/output/pinetime-mcuboot-app-image-*.bin
|
2024-06-21 19:28:29 +00:00
|
|
|
- name: Upload standalone ELF artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2024-11-14 20:59:14 +00:00
|
|
|
name: InfiniTime image ${{ env.REF_NAME }}
|
2024-06-21 19:28:29 +00:00
|
|
|
path: ./build/output/src/pinetime-app-*.out
|
2022-10-11 15:25:40 +00:00
|
|
|
- name: Upload resources artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2024-11-14 20:59:14 +00:00
|
|
|
name: InfiniTime resources ${{ env.REF_NAME }}
|
2022-10-11 15:25:40 +00:00
|
|
|
path: ./build/output/infinitime-resources-*.zip
|
2022-08-25 05:32:46 +00:00
|
|
|
|
|
|
|
build-simulator:
|
2023-01-12 20:04:25 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-08-25 05:32:46 +00:00
|
|
|
steps:
|
2023-09-18 12:22:40 +00:00
|
|
|
- name: Install SDL2 and libpng development package
|
2022-08-25 05:32:46 +00:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2023-09-18 12:22:40 +00:00
|
|
|
sudo apt-get -y install libsdl2-dev libpng-dev
|
2022-08-25 05:32:46 +00:00
|
|
|
|
2023-01-12 20:04:25 +00:00
|
|
|
- name: Install Ninja
|
|
|
|
run: |
|
|
|
|
sudo apt-get -y install ninja-build
|
|
|
|
|
2022-08-25 05:32:46 +00:00
|
|
|
- name: Install lv_font_conv
|
|
|
|
run:
|
|
|
|
npm i -g lv_font_conv@1.5.2
|
|
|
|
|
|
|
|
- name: Checkout source files
|
2023-01-12 20:04:25 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-08-25 05:32:46 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Get InfiniSim repo
|
|
|
|
run: |
|
|
|
|
git clone https://github.com/InfiniTimeOrg/InfiniSim.git --depth 1 --branch main
|
2023-09-18 12:22:40 +00:00
|
|
|
git -C InfiniSim submodule update --init lv_drivers
|
2022-08-25 05:32:46 +00:00
|
|
|
|
2024-01-09 01:40:56 +00:00
|
|
|
- name: Add sunset lib to InfiniSim
|
|
|
|
run: patch -i docker/infinisim-cmake.patch InfiniSim/CMakeLists.txt
|
|
|
|
|
2024-01-16 08:40:54 +00:00
|
|
|
- name: Remove Terminal from InfiniSim
|
|
|
|
run: patch -i docker/infinisim-terminal.patch InfiniSim/littlefs-do-main.cpp
|
|
|
|
|
2024-01-17 02:58:06 +00:00
|
|
|
- name: Remove Digital from InfiniSim
|
|
|
|
run: patch -i docker/infinisim-main.patch InfiniSim/main.cpp
|
|
|
|
|
2022-08-25 05:32:46 +00:00
|
|
|
- name: CMake
|
2022-10-11 20:30:51 +00:00
|
|
|
# disable BUILD_RESOURCES as this is already done when building the firmware
|
2022-08-25 05:32:46 +00:00
|
|
|
run: |
|
2022-10-11 20:30:51 +00:00
|
|
|
cmake -G Ninja -S InfiniSim -B build_lv_sim -DInfiniTime_DIR="${PWD}" -DBUILD_RESOURCES=OFF
|
2022-08-25 05:32:46 +00:00
|
|
|
|
|
|
|
- name: Build simulator executable
|
|
|
|
run: |
|
|
|
|
cmake --build build_lv_sim
|
|
|
|
|
|
|
|
- name: Upload simulator executable
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2024-11-14 20:59:14 +00:00
|
|
|
name: infinisim-${{ env.REF_NAME }}
|
2022-08-25 05:32:46 +00:00
|
|
|
path: build_lv_sim/infinisim
|
2023-01-07 16:15:37 +00:00
|
|
|
|
|
|
|
get-base-ref-size:
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
container:
|
|
|
|
image: infinitime/infinitime-build
|
|
|
|
outputs:
|
|
|
|
text_size: ${{ steps.output-sizes.outputs.text_size }}
|
|
|
|
data_size: ${{ steps.output-sizes.outputs.data_size }}
|
|
|
|
bss_size: ${{ steps.output-sizes.outputs.bss_size }}
|
|
|
|
env:
|
|
|
|
# InfiniTime sources are downloaded to the current directory.
|
|
|
|
# Override SOURCES_DIR in build.sh
|
|
|
|
SOURCES_DIR: .
|
|
|
|
steps:
|
2023-01-27 21:03:37 +00:00
|
|
|
- name: Checkout current base branch files
|
2023-01-07 16:15:37 +00:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
ref: ${{ github.base_ref }}
|
|
|
|
submodules: recursive
|
|
|
|
|
2023-01-27 21:03:37 +00:00
|
|
|
- name: Get base branch SHA
|
|
|
|
id: get-base-sha
|
|
|
|
run: |
|
|
|
|
# Fix for "detected dubious ownership in repository at '/__w/InfiniTime/InfiniTime'"
|
|
|
|
git config --global --add safe.directory /__w/InfiniTime/InfiniTime
|
|
|
|
echo base_sha=$(git rev-parse HEAD) >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Cache build
|
|
|
|
id: cache-build
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ./build
|
|
|
|
key: build-files-${{ steps.get-base-sha.outputs.base_sha }}
|
|
|
|
|
|
|
|
- if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
|
2023-01-07 16:15:37 +00:00
|
|
|
name: Build
|
|
|
|
shell: bash
|
|
|
|
# Only pinetime-app target is needed, but post_build.sh fails
|
|
|
|
run: /opt/build.sh all
|
|
|
|
|
|
|
|
- name: Output build size
|
|
|
|
id: output-sizes
|
|
|
|
run: |
|
|
|
|
. /opt/build.sh
|
|
|
|
.github/workflows/getSize.sh "$BUILD_DIR"/src/pinetime-app-*.out >> $GITHUB_OUTPUT
|
|
|
|
|
2023-01-07 18:17:18 +00:00
|
|
|
compare-build-size:
|
2023-01-07 16:15:37 +00:00
|
|
|
if: github.event_name == 'pull_request'
|
2023-01-31 07:42:27 +00:00
|
|
|
name: 'Compare build size'
|
2023-01-07 16:15:37 +00:00
|
|
|
needs: [build-firmware, get-base-ref-size]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Compare build size
|
|
|
|
id: output-sizes-diff
|
|
|
|
run: |
|
|
|
|
TEXT_SIZE=${{ needs.build-firmware.outputs.text_size }}
|
|
|
|
DATA_SIZE=${{ needs.build-firmware.outputs.data_size }}
|
|
|
|
BSS_SIZE=${{ needs.build-firmware.outputs.bss_size }}
|
|
|
|
|
2023-01-07 18:33:32 +00:00
|
|
|
echo "text_size=$TEXT_SIZE"
|
|
|
|
echo "data_size=$DATA_SIZE"
|
|
|
|
echo "bss_size=$BSS_SIZE"
|
|
|
|
|
2023-01-07 16:15:37 +00:00
|
|
|
echo "text_size=$TEXT_SIZE" >> $GITHUB_OUTPUT
|
|
|
|
echo "data_size=$DATA_SIZE" >> $GITHUB_OUTPUT
|
|
|
|
echo "bss_size=$BSS_SIZE" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
TEXT_SIZE_BASE=${{ needs.get-base-ref-size.outputs.text_size }}
|
|
|
|
DATA_SIZE_BASE=${{ needs.get-base-ref-size.outputs.data_size }}
|
|
|
|
BSS_SIZE_BASE=${{ needs.get-base-ref-size.outputs.bss_size }}
|
|
|
|
|
|
|
|
TEXT_SIZE_DIFF=$((TEXT_SIZE - TEXT_SIZE_BASE))
|
|
|
|
DATA_SIZE_DIFF=$((DATA_SIZE - DATA_SIZE_BASE))
|
|
|
|
BSS_SIZE_DIFF=$((BSS_SIZE - BSS_SIZE_BASE))
|
|
|
|
|
2023-01-07 18:33:32 +00:00
|
|
|
echo "text_diff=$TEXT_SIZE_DIFF"
|
|
|
|
echo "data_diff=$DATA_SIZE_DIFF"
|
|
|
|
echo "bss_diff=$BSS_SIZE_DIFF"
|
|
|
|
|
2023-01-07 16:15:37 +00:00
|
|
|
echo "text_diff=$TEXT_SIZE_DIFF" >> $GITHUB_OUTPUT
|
|
|
|
echo "data_diff=$DATA_SIZE_DIFF" >> $GITHUB_OUTPUT
|
|
|
|
echo "bss_diff=$BSS_SIZE_DIFF" >> $GITHUB_OUTPUT
|
|
|
|
|
2023-01-31 07:42:27 +00:00
|
|
|
- name: Write comment information to files
|
|
|
|
run: |
|
|
|
|
tee comment << EOF
|
|
|
|
Build size and comparison to ${{ github.base_ref }}:
|
|
|
|
| Section | Size | Difference |
|
|
|
|
| ------- | ---- | ---------- |
|
|
|
|
| text | ${{ needs.build-firmware.outputs.text_size }}B | ${{ steps.output-sizes-diff.outputs.text_diff }}B |
|
|
|
|
| data | ${{ needs.build-firmware.outputs.data_size }}B | ${{ steps.output-sizes-diff.outputs.data_diff }}B |
|
|
|
|
| bss | ${{ needs.build-firmware.outputs.bss_size }}B | ${{ steps.output-sizes-diff.outputs.bss_diff }}B |
|
|
|
|
EOF
|
|
|
|
|
|
|
|
- name: Upload comment
|
|
|
|
uses: actions/upload-artifact@v3
|
2023-01-07 16:15:37 +00:00
|
|
|
with:
|
2023-01-31 07:42:27 +00:00
|
|
|
name: comment
|
|
|
|
path: comment
|