add cache for ci
This commit is contained in:
@@ -10,6 +10,14 @@ env:
|
|||||||
PICO_SDK_REF: 2.2.0
|
PICO_SDK_REF: 2.2.0
|
||||||
TINYUSB_REF: 0.20.0
|
TINYUSB_REF: 0.20.0
|
||||||
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
|
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
|
||||||
|
APT_PACKAGES: >-
|
||||||
|
cmake
|
||||||
|
python3
|
||||||
|
build-essential
|
||||||
|
gcc-arm-none-eabi
|
||||||
|
libnewlib-arm-none-eabi
|
||||||
|
libstdc++-arm-none-eabi-newlib
|
||||||
|
ninja-build
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -22,12 +30,40 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Prepare build dependency cache
|
||||||
|
id: apt-cache
|
||||||
|
run: |
|
||||||
|
mkdir -p "$RUNNER_TEMP/apt-cache/partial"
|
||||||
|
. /etc/os-release
|
||||||
|
package_hash="$(printf '%s' "$APT_PACKAGES" | sha256sum | cut -d ' ' -f 1)"
|
||||||
|
echo "dir=$RUNNER_TEMP/apt-cache" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "os=${ID}-${VERSION_ID}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "package-hash=$package_hash" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Cache build dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ steps.apt-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-apt-${{ steps.apt-cache.outputs.os }}-${{ steps.apt-cache.outputs.package-hash }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ runner.arch }}-apt-${{ steps.apt-cache.outputs.os }}-
|
||||||
|
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt-get update
|
||||||
sudo apt install -y cmake python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib ninja-build
|
sudo apt-get -o Dir::Cache::archives="${{ steps.apt-cache.outputs.dir }}" install --download-only -y $APT_PACKAGES
|
||||||
|
sudo apt-get -o Dir::Cache::archives="${{ steps.apt-cache.outputs.dir }}" install -y $APT_PACKAGES
|
||||||
|
sudo chmod -R a+rX "${{ steps.apt-cache.outputs.dir }}"
|
||||||
|
|
||||||
|
- name: Cache Pico SDK
|
||||||
|
id: cache-pico-sdk
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.PICO_SDK_PATH }}
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-pico-sdk-${{ env.PICO_SDK_REF }}-tinyusb-${{ env.TINYUSB_REF }}
|
||||||
|
|
||||||
- name: Download Pico SDK
|
- name: Download Pico SDK
|
||||||
|
if: steps.cache-pico-sdk.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch "$PICO_SDK_REF" https://github.com/raspberrypi/pico-sdk.git "$PICO_SDK_PATH"
|
git clone --depth 1 --branch "$PICO_SDK_REF" https://github.com/raspberrypi/pico-sdk.git "$PICO_SDK_PATH"
|
||||||
git -C "$PICO_SDK_PATH" submodule update --init --recursive
|
git -C "$PICO_SDK_PATH" submodule update --init --recursive
|
||||||
@@ -48,12 +84,12 @@ jobs:
|
|||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
cp build/standard/ds5-bridge.uf2 artifacts/ds5-bridge.uf2
|
cp build/standard/ds5-bridge.uf2 artifacts/ds5-bridge.uf2
|
||||||
|
|
||||||
- name: Build DSE firmware
|
- name: Build Debug firmware
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B build/dse -G Ninja \
|
cmake -S . -B build/debug -G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DPICO_SDK_PATH="$PICO_SDK_PATH" \
|
-DPICO_SDK_PATH="$PICO_SDK_PATH" \
|
||||||
-DENABLE_DSE=ON
|
-DENABLE_SERIAL=ON
|
||||||
cmake --build build/dse --target ds5-bridge
|
cmake --build build/dse --target ds5-bridge
|
||||||
cp build/dse/ds5-bridge.uf2 artifacts/ds5-bridge-dse.uf2
|
cp build/dse/ds5-bridge.uf2 artifacts/ds5-bridge-dse.uf2
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ env:
|
|||||||
PICO_SDK_REF: 2.2.0
|
PICO_SDK_REF: 2.2.0
|
||||||
TINYUSB_REF: 0.20.0
|
TINYUSB_REF: 0.20.0
|
||||||
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
|
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
|
||||||
|
APT_PACKAGES: >-
|
||||||
|
cmake
|
||||||
|
python3
|
||||||
|
build-essential
|
||||||
|
gcc-arm-none-eabi
|
||||||
|
libnewlib-arm-none-eabi
|
||||||
|
libstdc++-arm-none-eabi-newlib
|
||||||
|
ninja-build
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -25,12 +33,40 @@ jobs:
|
|||||||
ref: ${{ github.event.release.tag_name }}
|
ref: ${{ github.event.release.tag_name }}
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Prepare build dependency cache
|
||||||
|
id: apt-cache
|
||||||
|
run: |
|
||||||
|
mkdir -p "$RUNNER_TEMP/apt-cache/partial"
|
||||||
|
. /etc/os-release
|
||||||
|
package_hash="$(printf '%s' "$APT_PACKAGES" | sha256sum | cut -d ' ' -f 1)"
|
||||||
|
echo "dir=$RUNNER_TEMP/apt-cache" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "os=${ID}-${VERSION_ID}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "package-hash=$package_hash" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Cache build dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ steps.apt-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-apt-${{ steps.apt-cache.outputs.os }}-${{ steps.apt-cache.outputs.package-hash }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ runner.arch }}-apt-${{ steps.apt-cache.outputs.os }}-
|
||||||
|
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt-get update
|
||||||
sudo apt install -y cmake python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib ninja-build
|
sudo apt-get -o Dir::Cache::archives="${{ steps.apt-cache.outputs.dir }}" install --download-only -y $APT_PACKAGES
|
||||||
|
sudo apt-get -o Dir::Cache::archives="${{ steps.apt-cache.outputs.dir }}" install -y $APT_PACKAGES
|
||||||
|
sudo chmod -R a+rX "${{ steps.apt-cache.outputs.dir }}"
|
||||||
|
|
||||||
|
- name: Cache Pico SDK
|
||||||
|
id: cache-pico-sdk
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.PICO_SDK_PATH }}
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-pico-sdk-${{ env.PICO_SDK_REF }}-tinyusb-${{ env.TINYUSB_REF }}
|
||||||
|
|
||||||
- name: Download Pico SDK
|
- name: Download Pico SDK
|
||||||
|
if: steps.cache-pico-sdk.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch "$PICO_SDK_REF" https://github.com/raspberrypi/pico-sdk.git "$PICO_SDK_PATH"
|
git clone --depth 1 --branch "$PICO_SDK_REF" https://github.com/raspberrypi/pico-sdk.git "$PICO_SDK_PATH"
|
||||||
git -C "$PICO_SDK_PATH" submodule update --init --recursive
|
git -C "$PICO_SDK_PATH" submodule update --init --recursive
|
||||||
@@ -51,14 +87,14 @@ jobs:
|
|||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
cp build/standard/ds5-bridge.uf2 "artifacts/ds5-bridge-${{ github.event.release.tag_name }}.uf2"
|
cp build/standard/ds5-bridge.uf2 "artifacts/ds5-bridge-${{ github.event.release.tag_name }}.uf2"
|
||||||
|
|
||||||
- name: Build DSE firmware
|
- name: Build Debug firmware
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B build/dse -G Ninja \
|
cmake -S . -B build/debug -G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DPICO_SDK_PATH="$PICO_SDK_PATH" \
|
-DPICO_SDK_PATH="$PICO_SDK_PATH" \
|
||||||
-DENABLE_DSE=ON
|
-DENABLE_SERIAL=ON
|
||||||
cmake --build build/dse --target ds5-bridge
|
cmake --build build/debug --target ds5-bridge
|
||||||
cp build/dse/ds5-bridge.uf2 "artifacts/ds5-bridge-dse-${{ github.event.release.tag_name }}.uf2"
|
cp build/debug/ds5-bridge.uf2 "artifacts/ds5-bridge-debug-${{ github.event.release.tag_name }}.uf2"
|
||||||
|
|
||||||
- name: Upload UF2 files to release
|
- name: Upload UF2 files to release
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user