Skip to content

Update build-openwrt.yml #74

Update build-openwrt.yml

Update build-openwrt.yml #74

Workflow file for this run

name: Build OpenWRT in Github Actions
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
env:
FORCE_UNSAFE_CONFIGURE: 1
PATH: /usr/lib/ccache:$PATH
CC: ccache gcc
CXX: ccache g++
CONFIG_CCACHE: y
CCACHE_DIR: ${{ github.workspace }}/.ccache
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up environment
run: |
sudo apt update
sudo apt install -y build-essential clang flex bison g++ gawk \
gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev \
python3-setuptools rsync swig unzip zlib1g-dev file wget \
coreutils ccache musl-tools
- name: Configure ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 5G
- name: Cache OpenWRT dl folder
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/dl
key: ${{ runner.os }}-openwrt-dl-v1-${{ hashFiles('feeds.conf.default') }}
restore-keys: |
${{ runner.os }}-openwrt-dl-v1-
- name: Cache OpenWRT build_dir
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/build_dir
key: ${{ runner.os }}-openwrt-build-v1-${{ hashFiles('.config') }}
restore-keys: |
${{ runner.os }}-openwrt-build-v1-
- name: Cache ccache files
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-v1-${{ hashFiles('**/Makefile') }}
restore-keys: |
${{ runner.os }}-ccache-v1-
- name: Update and install feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: Install additional packages
run: |
curl -sSL https://raw.githubusercontent.com/chenmozhijin/turboacc/luci/add_turboacc.sh -o add_turboacc.sh
bash add_turboacc.sh
git clone https://github.com/sirpdboy/netspeedtest.git package/netspeedtest
git clone https://github.com/jerrykuku/luci-theme-argon.git package/luci-theme-argon
- name: Configure OpenWRT
run: |
cp openwrt.config .config
make defconfig
- name: Build OpenWRT
uses: nick-invision/retry@v2
with:
timeout_minutes: 360
max_attempts: 3
retry_wait_seconds: 60
command: |
make -j$(nproc) V=s || make V=s
on_retry_command: |
rm -rf build_dir/target-*
rm -rf build_dir/toolchain-*
- name: Generate build info
if: success()
run: |
echo "Build completed at $(date)" > build_info.txt
echo "OpenWRT Version: $(git describe --tags)" >> build_info.txt
echo "Commit: $(git rev-parse HEAD)" >> build_info.txt
ccache -s >> build_info.txt
- name: Upload firmware
uses: actions/upload-artifact@v4
with:
name: openwrt-firmware-${{ github.sha }}
path: |
bin/targets/**/*
.config
build_info.txt
retention-days: 7
- name: Upload build logs on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: build-logs-${{ github.sha }}
path: |
.config
build_info.txt
logs/
build.log
retention-days: 7