-
Notifications
You must be signed in to change notification settings - Fork 36
165 lines (146 loc) · 5.32 KB
/
ci.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Build OpenWrt
run-name: Build OpenWrt ${{ github.event.inputs.branch }}
on:
workflow_dispatch:
inputs:
branch:
description: 'your local repo branch'
required: true
default: 23.05
type: choice
options:
- master
- 23.05
targets:
description: 'target devices'
required: true
default: "['amlogic-meson8b', 'x86-64']"
type: choice
options:
- "['amlogic-meson8b']"
- "['amlogic-meson8b', 'x86-64']"
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
target: ${{ fromJSON(github.event.inputs.targets) }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
swap-size-mb: 1024
temp-reserve-mb: 512
root-reserve-mb: 4608
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Init build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-get -qq update
sudo /bin/bash -c "$(curl -sL https://git.io/vokNn)"
sudo -E apt-fast -y -qq install asciidoc bash bcc bin86 binutils bison bzip2 clang file flex g++ g++-multilib gawk gcc gcc-multilib gettext git gzip help2man intltool libboost-dev libelf-dev libncurses-dev libncurses5-dev libssl-dev libthread-queue-any-perl libusb-dev libxml-parser-perl make patch perl-modules python3-dev python3-pip python3-pyelftools python3-setuptools rsync sharutils swig time unzip util-linux wget xsltproc zlib1g-dev zip
sudo -E apt-fast -y -qq install android-sdk-libsparse-utils dos2unix dwarves quilt
pip3 install --user -U pylibfdt --break-system-packages
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo -E git config --global user.name 'GitHub Actions' && git config --global user.email '[email protected]'
df -h
- name: Clone OpenWrt
run: |
git clone https://github.com/openwrt/openwrt.git
- name: Get variable
working-directory: ./openwrt
id: var
run: |
case ${{ github.event.inputs.branch }} in
master)
_release_tag=snapshot-r$(date +%g.%j)
_prerelease=true
;;
23.05)
_release_tag=$(git tag --sort=taggerdate --list 'v23.*' | tail -1)
git checkout $_release_tag
_prerelease=false
;;
*)
echo "Can't get local/upstream's branch/tags"
;;
esac
case ${{ matrix.target }} in
amlogic-meson8b) _device=onecloud ;;
x86-64) _device=x86-64 ;;
*) echo "wrong devices" ;;
esac
_artifact=${{ matrix.target }}
_artifact_path=openwrt/bin/targets/${_artifact/-//}
echo "release_tag=$_release_tag" >> $GITHUB_OUTPUT
echo "prerelease=$_prerelease" >> $GITHUB_OUTPUT
echo "device=$_device" >> $GITHUB_OUTPUT
echo "artifact=$_artifact_path" >> $GITHUB_OUTPUT
- name: Fetch Other repos
run: |
./scripts/00_init.sh other-repos
- name: Feeds update & install
working-directory: ./openwrt
run: |
./scripts/feeds update -a && ./scripts/feeds install -a
- name: Customize Packages
working-directory: ./openwrt
run: |
cp -L ../scripts/${{ steps.var.outputs.device }}_customization.sh .
cp ../scripts/01_customize_packages.sh .
/bin/bash ${{ steps.var.outputs.device }}_customization.sh
- if: matrix.target == 'x86-64'
name: FullCone Nat
run: |
./scripts/00_init.sh patch-fullconenat
- name: Convert Translation
working-directory: ./openwrt
run: |
cp ../scripts/02_convert_translation.sh .
/bin/bash 02_convert_translation.sh
- name: Get cache toolchain
uses: HiGarfield/cachewrtbuild@main
with:
prefix: ${{ github.workspace }}/openwrt
mixkey: ${{ matrix.target }}
- name: Make Config
working-directory: ./openwrt
run: |
cp ../config/${{ steps.var.outputs.device }}_defconfig .config
make defconfig
- name: Make Download
working-directory: ./openwrt
run: |
make download -j`nproc`
- name: Compile OpenWrt
working-directory: ./openwrt
run: |
make -j`nproc` || make -j1 V=s
- name: Assemble Artifact
run: |
ls ${{ steps.var.outputs.artifact }}
cat ${{ steps.var.outputs.artifact }}/config.buildinfo
rm -rf ${{ steps.var.outputs.artifact }}/{packages,*.buildinfo,*.json,*.manifest,*kernel.bin,*-rootfs.*,sha256sums}
- if: matrix.target == 'amlogic-meson8b'
name: Assemble burn firmware
run: |
./scripts/00_init.sh burn-onecloud
- name: Upload Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
target_commitish: ${{ github.event.inputs.branch }}
prerelease: ${{ steps.var.outputs.prerelease }}
tag_name: ${{ steps.var.outputs.release_tag }}
files: ${{ steps.var.outputs.artifact }}/*