forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (97 loc) · 2.99 KB
/
build-openwrt.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Build OpenWRT in Github Actions
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
env:
FORCE_UNSAFE_CONFIGURE: 1
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@v3
- name: Set up environment
run: |
echo "/usr/lib/ccache" >> $GITHUB_PATH
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/jerrykuku/luci-theme-argon.git package/luci-theme-argon
- name: Configure OpenWRT
run: |
cp openwrt.config .config
make defconfig
- name: Build OpenWRT
run: |
make -j$(nproc)
- 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