Build OpenWrt Core #46
This file contains hidden or 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 OpenWrt Core | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build ${{ matrix.model }} Core | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
model: | |
- armv8 | |
- nanopi-r5s | |
- x86_64 | |
tag: | |
- type: rc2 | |
version: openwrt-24.10 | |
steps: | |
- name: Setup variables | |
run: | | |
sudo timedatectl set-timezone 'Asia/Shanghai' | |
git config --global user.name 'actions' | |
git config --global user.email '[email protected]' | |
echo build_dir="/builder" >> "$GITHUB_ENV" | |
- name: Show system | |
run: | | |
echo -e "\n\e[1;32mCPU:\e[0m" | |
echo "$(grep 'model name' /proc/cpuinfo | head -1 | awk -F ': ' '{print $2}') ($(grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F ': ' '{print $2}')MHz) x $(grep processor /proc/cpuinfo | wc -l)" | |
echo -e "\n\e[1;32mMemory:\e[0m" | |
free -h | |
echo -e "\n\e[1;32mStorage:\e[0m" | |
df -Th / /mnt | |
echo -e "\n\e[1;32mSystem:\e[0m" | |
lsb_release -a | |
echo -e "\n\e[1;32mKernel:\e[0m" | |
uname -a | |
echo | |
- name: Free disk space | |
uses: sbwml/actions@free-disk | |
with: | |
build-mount-path: /builder | |
- name: Build System Setup | |
uses: sbwml/actions@openwrt-build-setup | |
- name: Install LLVM | |
uses: sbwml/actions@install-llvm | |
- name: Compile OpenWrt | |
id: compile | |
continue-on-error: true | |
working-directory: /builder | |
env: | |
git_name: private | |
git_password: ${{ secrets.ftp_password }} | |
run: | | |
export KERNEL_CLANG_LTO=y ENABLE_DPDK=y BUILD_FAST=y ENABLE_CCACHE=y ENABLE_OTA=y ENABLE_BPF=y ENABLE_LTO=y ENABLE_LRNG=y USE_GCC15=y ENABLE_MOLD=y MINIMAL_BUILD=y OPENWRT_CORE=y | |
bash <(curl -sS ${{ secrets.script_url_general }}) ${{ matrix.tag.type }} ${{ matrix.model }} | |
- name: Extensive logs after a failed compilation | |
if: steps.compile.outcome == 'failure' | |
working-directory: /builder | |
run: | | |
cd openwrt | |
make V=s IGNORE_ERRORS="n m" | |
- name: Prepare files | |
working-directory: /builder | |
run: | | |
base_name=$(basename ${{ env.build_dir }}/openwrt/*-*.tar.gz) | |
kmod_name=$(echo $base_name | sed 's/~/-/g') | |
mv ${{ env.build_dir }}/openwrt/*-*.tar.gz ${{ env.build_dir }}/openwrt/$kmod_name | |
- name: Release kernel modules | |
uses: ncipollo/[email protected] | |
with: | |
name: kmod-snapshot | |
allowUpdates: true | |
prerelease: true | |
tag: snapshot | |
commit: main | |
replacesArtifacts: true | |
token: ${{ secrets.workflow_token }} | |
artifacts: | | |
${{ env.build_dir }}/openwrt/*-*.tar.gz | |
- name: Sync kernel modules | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.workflow_token }} | |
repository: sbwml/openwrt_core | |
event-type: sync | |
- name: Delete Cached | |
continue-on-error: true | |
working-directory: /builder | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
run: | | |
gh cache delete ${{ matrix.tag.version }}-${{ matrix.model }} || true | |
- name: Save Cached | |
uses: actions/cache/save@v4 | |
with: | |
path: /builder/.ccache | |
key: ${{ matrix.tag.version }}-${{ matrix.model }} |