u-boot-ingenic #359
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
schedule: | |
# 01:15 PST / Nightly | |
- cron: '00 9 * * *' | |
workflow_dispatch: | |
inputs: | |
tg_disabled: | |
type: boolean | |
description: 'Disable Telegram notifications' | |
required: false | |
default: false | |
tg_scratch: | |
type: boolean | |
description: 'Use TG scratch channel' | |
required: false | |
default: false | |
t31x_only: | |
type: boolean | |
description: 'Only build T31X profile ' | |
required: false | |
default: false | |
env: | |
TAG_NAME: latest | |
TERM: linux | |
TG_TOKEN: ${{secrets.TELEGRAM_TOKEN_BOT_THINGINO}} | |
TG_CHANNEL: ${{secrets.TELEGRAM_CHANNEL_THINGINO_BUILD}} | |
TG_OPTIONS: -s -o /dev/null -w %{http_code} | |
TG_ENABLE: false | |
jobs: | |
build-notify: | |
runs-on: ubuntu-24.04 | |
outputs: | |
start_time: ${{ steps.set_output.outputs.time }} | |
tg_disabled: ${{ steps.set_env.outputs.tg_disabled }} | |
steps: | |
- name: Setup Notify Environment | |
run: | | |
echo "TG_DISABLED=${{ github.event.inputs.tg_disabled || 'false' }}" >> $GITHUB_ENV | |
echo "tg_disabled=${{ github.event.inputs.tg_disabled || 'false' }}" >> $GITHUB_OUTPUT | |
- name: Save workflow start time | |
id: set_output | |
run: echo "time=$(date +%s)" >> $GITHUB_OUTPUT | |
- name: Send build start notifcation | |
if: env.TG_DISABLED == 'false' | |
run: | | |
TG_MSG="u-boot-ingenic build started:\nJob: [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n" | |
TG_ICON="\xF0\x9F\x9A\xA6 GitHub Actions" | |
TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON}) | |
HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendMessage -F parse_mode=MarkdownV2 -F chat_id=${TG_CHANNEL} -F text="${TG_HEADER}" -F disable_web_page_preview=true) | |
echo Telegram response: ${HTTP} | |
build: | |
needs: build-notify | |
runs-on: ubuntu-24.04 | |
container: | |
image: debian:sid | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- u-boot-version: t10n | |
t31x_only: false | |
- u-boot-version: t10l | |
t31x_only: false | |
- u-boot-version: t10n_msc0 | |
t31x_only: false | |
- u-boot-version: t20n | |
t31x_only: false | |
- u-boot-version: t20l | |
t31x_only: false | |
- u-boot-version: t20x | |
t31x_only: false | |
- u-boot-version: t20n_msc0 | |
t31x_only: false | |
- u-boot-version: t21n | |
t31x_only: false | |
- u-boot-version: t21n_msc0 | |
t31x_only: false | |
- u-boot-version: t23n | |
t31x_only: false | |
- u-boot-version: t23n_msc0 | |
t31x_only: false | |
- u-boot-version: t30n | |
t31x_only: false | |
- u-boot-version: t30l | |
t31x_only: false | |
- u-boot-version: t30x | |
t31x_only: false | |
- u-boot-version: t30a | |
t31x_only: false | |
- u-boot-version: t30a1 | |
t31x_only: false | |
- u-boot-version: t30n_msc0 | |
t31x_only: false | |
- u-boot-version: t31n | |
t31x_only: false | |
- u-boot-version: t31l | |
t31x_only: false | |
- u-boot-version: t31lc | |
t31x_only: false | |
- u-boot-version: t31x | |
t31x_only: false | |
- u-boot-version: t31a | |
t31x_only: false | |
- u-boot-version: t31al | |
t31x_only: false | |
- u-boot-version: t31l_msc0 | |
t31x_only: false | |
- u-boot-version: t31n_msc0 | |
t31x_only: false | |
- u-boot-version: t31x_msc0 | |
t31x_only: false | |
- u-boot-version: t31a_msc0 | |
t31x_only: false | |
- u-boot-version: t31al_msc0 | |
t31x_only: false | |
steps: | |
- name: Setup cache directories | |
run: | | |
mkdir -p /tmp/ccache | |
ln -s /tmp/ccache ${HOME}/.ccache | |
- name: Setup ccache | |
uses: actions/cache@v4 | |
if: always() | |
with: | |
path: /tmp/ccache | |
key: ${{ runner.os }}-ccache-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-ccache-$- | |
- name: Update repo sources | |
run: | | |
apt-get update | |
- name: Install dependencies | |
run: | | |
apt-get install -y --no-install-recommends --no-install-suggests build-essential ccache gcc-13 gcc-13-mipsel-linux-gnu libgcc-s1-mipsel-cross lzop u-boot-tools git make ca-certificates curl wget | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: "master" | |
fetch-depth: "1" | |
- name: Download toolchain | |
run: | | |
wget https://github.com/themactep/thingino-firmware/releases/download/toolchain/thingino-toolchain_xburst1_musl_gcc13-linux-mipsel.tar.gz -O ~/thingino-toolchain_xburst1_musl_gcc13-linux-mipsel.tar.gz | |
tar -xf ~/thingino-toolchain_xburst1_musl_gcc13-linux-mipsel.tar.gz -C ~/ | |
- name: u-boot-ingenic Build | |
shell: bash | |
run: | | |
echo "HASH IS" | |
git rev-parse --short ${GITHUB_SHA} | |
export GIT_HASH=$(git rev-parse --short ${GITHUB_SHA}) | |
export GIT_BRANCH=${GITHUB_REF_NAME} | |
echo "GIT_HASH=${GIT_HASH}" >> ${GITHUB_ENV} | |
echo "GIT_BRANCH=${GIT_BRANCH}" >> ${GITHUB_ENV} | |
cp -f .github/scripts/build.sh build-ci.sh | |
VERSION=${{ matrix.u-boot-version }} | |
bash build-ci.sh $VERSION debug | |
TIME=$(date -d @${SECONDS} +%M:%S) | |
echo "TIME=${TIME}" >> ${GITHUB_ENV} | |
- name: Check if compiled u-boot exists | |
run: | | |
FILE=./uboot_build/u-boot-${{ matrix.u-boot-version }}.bin | |
if [ ! -f "$FILE" ]; then | |
echo "File not found exit" | |
exit 1 | |
fi | |
echo "Found file: $FILE" | |
echo "UBOOTFW=$FILE" >> $GITHUB_ENV | |
- name: Upload firmware as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: u-boot-${{ matrix.u-boot-version }}.bin | |
path: ${{ env.UBOOTFW }} | |
- name: Upload ${{ matrix.u-boot-version }} | |
if: github.event_name != 'pull_request' | |
uses: softprops/action-gh-release@master | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
files: ${{ env.UBOOTFW }} | |
- name: Send build alert | |
if: ${{ github.event_name != 'pull_request' && env.UBOOTFW && env.TG_DISABLED == 'false' }} | |
shell: bash | |
run: | | |
if [[ "${{ github.event.inputs.tg_scratch }}" == 'true' ]]; then | |
TG_CHANNEL=${{ env.TG_CHANNEL_SCRATCH }} | |
fi | |
echo "GIT_HASH: ${GIT_HASH}" | |
echo "GIT_BRANCH: ${GIT_BRANCH}" | |
TG_MSG="u-boot-ingenic build finished\nCommit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nTime: ${TIME}\n\n" | |
TG_ICON="\xE2\x9C\x85 GitHub Actions" | |
TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON}) | |
HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendMessage -F chat_id=${TG_CHANNEL} -F text="${TG_HEADER}" -F disable_web_page_preview=true) | |
echo Telegram response: ${HTTP} | |
- name: Send error | |
if: ${{ github.event_name != 'pull_request' && failure() && env.TG_DISABLED == 'false' }} | |
shell: bash | |
run: | | |
if [[ "${{ github.event.inputs.tg_scratch }}" == 'true' ]]; then | |
TG_CHANNEL=${{ env.TG_CHANNEL_SCRATCH }} | |
fi | |
TG_WARN="Error: u-boot-ingenic build failed!\n" | |
TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nhttps://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n\n" | |
TG_ICON="\xE2\x9A\xA0 GitHub Actions" | |
TG_HEADER=$(echo -e ${TG_WARN}${TG_MSG}${TG_ICON}) | |
HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendMessage -F chat_id=${TG_CHANNEL} -F text="${TG_HEADER}" -F disable_web_page_preview=true) | |
echo Telegram response: ${HTTP} |