forked from freifunk-berlin/firmware
-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (168 loc) · 8 KB
/
build-firmware.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
166
167
168
169
170
171
172
173
174
175
176
name: Build Firmware
on:
push:
branches: [ master, next, nightly/* ]
pull_request:
branches: [ master, next ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target: [ath79-generic, ath79-mikrotik, ath79-tiny, ramips-mt7620, mvebu-cortexa9]
fail-fast: false
env:
IS_BUILDBOT: yes
BUILD_LOG_DIR: logs
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: sudo apt-get --quiet --assume-yes --no-install-recommends --no-show-upgraded install git build-essential libncurses5-dev zlib1g-dev gawk time unzip libxml-perl flex wget gawk gettext quilt python libssl-dev
- name: setup build-environment
run: |
mkdir logs
echo "MAKE_OPTS= -j$(nproc) TARGET=${{matrix.target}} IS_BUILDBOT=${IS_BUILDBOT} " >>$GITHUB_ENV
echo "next_buildstep=config" >>$GITHUB_ENV
df -h
echo "building branch (full): " ${GITHUB_REF}
echo "building branch (short):" ${GITHUB_REF##*/}
echo "building branch (prefix stripped):" ${GITHUB_REF#"refs/heads/"}
echo "building branch (replaced):"
echo ${GITHUB_REF} | sed -e 's#^[a-zA-Z]*/[a-zA-Z]*/##; s#/#_#g;'
# this sets env BRANCHNAME_normalized by removing the 1st two elements from $GITHUB_REF
# These elements are usually "refs/heads/"
# in addition replace all / by _
var=$(echo ${GITHUB_REF} | sed -e 's#^[a-zA-Z]*/[a-zA-Z]*/##; s#/#_#g;')
echo helper-var: ${var}
echo "BRANCHNAME_normalized=${var}" >>$GITHUB_ENV
- name: change storage paths
run: |
echo "GITHUB_WORKSPACE is ${GITHUB_WORKSPACE}"
echo "setting download and bin folder to /mnt (as there are 9GB space and WORKSPACE is too small for ath79-generic)"
sudo mkdir -m 777 /mnt/build
mkdir "/mnt/build/bin"
mkdir "/mnt/build/downloads"
echo >>configs/common-autobuild.config 'CONFIG_BINARY_FOLDER="/mnt/build/bin"'
echo >>configs/common-autobuild.config 'CONFIG_DOWNLOAD_FOLDER="/mnt/build/downloads"'
cat configs/common-autobuild.config
# symlink the original folders to the new localtions, to satisfy "common" scripts
mkdir openwrt
ln -s /mnt/build/downloads openwrt/dl
ln -s /mnt/build/bin openwrt/bin
- name: OpenWrt ${{ env.next_buildstep }}
run: |
echo "debug ${{ env.BRANCHNAME_normalized }}"
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-config)
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: OpenWrt-config to artifacts
run: cp openwrt/.config logs/openwrt.config
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: openwrt ${{ env.next_buildstep }}
if: ${{ env.next_buildstep != null }}
run: |
echo "running: make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}"
make -f Makefile.autobuild ${MAKE_OPTS} ${next_buildstep}
nextstep=$(make -f Makefile.autobuild next-buildstep-for-${next_buildstep})
echo "next_buildstep=${nextstep}" >>$GITHUB_ENV
- name: Archive build logs
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v1
with:
name: ${{matrix.target}}_logs
path: logs
- name: prepare upload of imagebuilder and sdk
run: |
mkdir -p tmp_build-tools
find openwrt/bin/ -name *imagebuilder*.tar.xz -exec mv '{}' tmp_build-tools/ \;
find openwrt/bin/ -name *sdk*.tar.xz -exec mv '{}' tmp_build-tools/ \;
- name: Archive imagebuilder and sdk
if: ${{ !cancelled() }}
continue-on-error: true
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.target }}_build-tools
path: tmp_build-tools
- name: Archive binaries
if: ${{ !cancelled() }}
continue-on-error: true
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.target }}_bins
path: openwrt/bin/
- run: df -h
if: ${{ !cancelled() }}
- name: upload
if: github.event_name == 'push'
env:
SSH_KEY: ${{ secrets.OPENWRT_BUILDUPLOAD_PRIVATE }}
run: |
# create file-structure for target
mkdir "tmp_build-tools/${{ env.BRANCHNAME_normalized }}"
mv tmp_build-tools/*.tar.xz "tmp_build-tools/${{ env.BRANCHNAME_normalized }}/"
eval "$(ssh-agent -s)"
ssh-add - <<< "${SSH_KEY}"
scp -r -o StrictHostKeyChecking=no -P ${{ secrets.OPENWRT_BUILDUPLOAD_PORT }} tmp_build-tools/* [email protected]:../upload/