Skip to content

ci: try to fix cache-path #364

ci: try to fix cache-path

ci: try to fix cache-path #364

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- '*-bpi'
- '*-ci'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
UBOOT_BRANCH: ${{ github.head_ref || github.ref_name }}
ATF_BRANCH: mtk-atf-2026
strategy:
fail-fast: false
matrix:
include:
- board: bpi-r2
boots: "sdmmc"
atf: false
ram8g: false
- board: bpi-r64
boots: "sdmmc emmc"
atf: true
ram8g: false
- board: bpi-r2pro
boots: "sdmmc"
atf: false
ram8g: false
- board: bpi-r3
boots: "sdmmc emmc spi-nand spi-nor ram"
atf: true
ram8g: false
- board: bpi-r3mini
boots: "emmc spi-nand ram"
atf: true
ram8g: false
- board: bpi-r4
boots: "sdmmc emmc spi-nand ram"
atf: true
ram8g: true
- board: bpi-r4lite
boots: "sdmmc emmc spi-nand ram"
atf: true
ram8g: false
- board: bpi-r4pro
boots: "sdmmc emmc spi-nand ram"
atf: true
ram8g: true
steps:
- uses: actions/checkout@v4
# ccache restore
- name: Restore ccache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ matrix.board }}-${{ github.ref_name }}
restore-keys: |
ccache-${{ matrix.board }}-
ccache-
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y \
ccache libssl-dev u-boot-tools \
gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
make python3-pyelftools ccache
- name: Fetch mtk-atf branch
if: matrix.atf == true
run: |
git fetch origin $ATF_BRANCH --depth=1
- name: Build
run: |
set -e
for boot in ${{ matrix.boots }}; do
echo "===================================="
echo "Building ${{ matrix.board }} for $boot"
echo "===================================="
git checkout $UBOOT_BRANCH
echo -e "board=${{ matrix.board }}\ndevice=$boot" > build.conf
bash build.sh importconfig
bash build.sh build
bash build.sh rename
# ATF builds (optional)
if [ "${{ matrix.atf }}" = "true" ]; then
git checkout build.conf
echo "---- ATF build for $boot ----"
git checkout $ATF_BRANCH
echo -e "board=${{ matrix.board }}\ndevice=$boot" > build.conf
# normal ATF build
bash build.sh build
bash build.sh rename
if [[ "$boot" == *"mmc"* ]]; then
bash build.sh createimg non-interactive
fi
if [ "${{ matrix.ram8g }}" == "true" ]; then
echo "extraflags=DDR4_4BG_MODE=1" >> build.conf
bash build.sh build
bash build.sh rename
fi
# optional special NAND/UBI case
if [[ "$boot" =~ nand|nor ]]; then
echo "extraflags=UBI=1" >> build.conf
bash build.sh build
bash build.sh rename
if [ "${{ matrix.ram8g }}" == "true" ]; then
echo "extraflags=UBI=1 DDR4_4BG_MODE=1" >> build.conf
bash build.sh build
bash build.sh rename
fi
fi
# we do not need u-boot.bin for all devices
# only one sdmmc and emmc version (chain loading)
if [[ "$boot" != *"mmc"* ]]; then
rm u-boot*.bin
fi
rm -f build.conf
else
bash build.sh createimg non-interactive
git checkout build.conf
fi
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: uboot-${{ matrix.board }}
path: |
${{ matrix.board }}*_fip.bin
u-boot-${{ matrix.board }}_*.bin
${{ matrix.board }}*_bl2.img
${{ matrix.board }}_*.img.gz
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout (longer history)
uses: actions/checkout@v4
with:
fetch-depth: 50
- name: Setup env
run: |
echo "DT=$(date +'%Y-%m-%d_%H%M')" >> $GITHUB_ENV
echo "UBOOTVER=$(make ubootversion)" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo $BRANCH $UBOOTVER $DT
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Copy files for release
run: |
mkdir release
find artifacts -type f \( -name "*.bin" -o -name "*.img.gz*" -o -name "*.img" \) \
-exec cp {} release/ \;
- name: Generate changelog
run: |
echo -e "# Release\n**Commit:** ${{ github.sha }}\n**Branch:** ${{ env.BRANCH }}\n**Version:** ${{ env.UBOOTVER }}\n\n## Changelog\n" > CHANGELOG.md
git log --pretty=format:"- %h %ad **%s** %d by %an" --date=short --no-merges >> CHANGELOG.md
- name: Create release
if: endsWith(github.ref_name, '-main') || endsWith(github.ref_name, '-ci')
uses: softprops/action-gh-release@v2
with:
files: release/*
body_path: CHANGELOG.md
draft: ${{ endsWith(github.ref, '-ci') }}
tag_name: "CI-BUILD-${{ env.BRANCH }}-${{ env.UBOOTVER }}-${{ env.DT }}"