249 lines (206 loc) · 8.34 KB
/
build-u-boot-with-docker.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: Build u-boot with Docker
on:
workflow_dispatch:
workflow_call:
inputs:
runner:
required: true
type: string
include:
required: false
type: string
exclude:
required: false
type: string
uploading:
type: string
destref:
type: string
packagesrepo:
required: false
type: string
secrets:
GPG_KEY1:
required: true
GPG_PASSPHRASE1:
required: true
GPG_KEY2:
required: true
GPG_PASSPHRASE2:
required: true
SCRIPTS_ACCESS_TOKEN:
required: true
SSH_KEY_TORRENTS:
required: true
KNOWN_HOSTS_UPLOAD:
required: true
jobs:
Prepare:
name: targets
runs-on: small
outputs:
matrix: ${{steps.list_dirs.outputs.matrix}}
steps:
- name: Runner prepare
uses: armbian/actions/runner-prepare@main
- run: |
REFERENCE=${{ inputs.destref }}
echo "REFERENCE=${REFERENCE:-"nightly"}" >> $GITHUB_ENV
PACKAGESREPO=${{ inputs.packagesrepo }}
echo "BETA=${PACKAGESREPO:-yes}" >> $GITHUB_ENV
- name: Checkout Armbian build script
uses: actions/checkout@v3.3.0
with:
repository: armbian/build
path: build
ref: ${{ env.REFERENCE }}
fetch-depth: '100'
clean: false
- name: Remove previous artefacts if any
run: |
sudo rm -rf changes 2>/dev/null || true
- name: Download changes
uses: actions/download-artifact@v3.0.2
with:
name: changes
- name: Prepare matrix
id: list_dirs
run: |
MATRIX="cat build/config/target*.conf | grep -v \"^$\" | grep -v \"^#\" | ${{ inputs.include }} ${{ inputs.exclude }} sed 's/\s\s*/ /g' | cut -d' ' -f1,2 | sed 's/ /:/g' | sort | uniq"
[ -s changes ] || unset MATRIX
echo "matrix=$(for x in $(eval $MATRIX); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq -c)" >> $GITHUB_OUTPUT
U-boot:
needs: [ Prepare ]
runs-on: ${{ inputs.runner }}
if: ${{ needs.Prepare.outputs.matrix != '[]' && needs.Prepare.outputs.matrix != '' }}
timeout-minutes: 480
strategy:
fail-fast: false
matrix:
node: ${{fromJson(needs.Prepare.outputs.matrix)}}
steps:
- name: Runner prepare
uses: armbian/actions/runner-prepare@main
- run: |
REFERENCE=${{ inputs.destref }}
echo "REFERENCE=${REFERENCE:-"nightly"}" >> $GITHUB_ENV
PACKAGESREPO=${{ inputs.packagesrepo }}
echo "BETA=${PACKAGESREPO:-yes}" >> $GITHUB_ENV
- name: "Read"
run: |
INPUT_REFERENCE=${{ inputs.destref }}
INPUT_REFERENCE=${INPUT_REFERENCE:-"nightly"}
- name: Checkout Armbian build script
uses: actions/checkout@v3.3.0
with:
repository: armbian/build
path: build
fetch-depth: '100'
ref: ${{ env.REFERENCE }}
clean: false
- name: Checkout support scripts
uses: actions/checkout@v3.3.0
with:
fetch-depth: '100'
repository: armbian/scripts
path: scripts
clean: false
- name: Install SSH key for storage
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY_TORRENTS }}
known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
if_key_exists: replace
- name: Mount upload folders
run: |
# use this only on our runners
if [[ ${{ inputs.runner }} != "ubuntu-latest" ]]; then
# mount deploy target
[[ -z $(command -v sshfs) ]] && sudo apt-get -yy install sshfs
sudo mkdir -p /root/.ssh/
sudo cp ~/.ssh/known_hosts /root/.ssh/
sudo mkdir -p build/output/debs || true
sudo mkdir -p build/output/debs-beta || true
sudo sshfs upload@users.armbian.com:/debs build/output/debs -o IdentityFile=~/.ssh/id_rsa -o reconnect -o allow_other || true
sudo sshfs upload@users.armbian.com:/debs build/output/debs -o IdentityFile=~/.ssh/id_rsa -o reconnect -o nonempty,allow_other || true
sudo sshfs upload@users.armbian.com:/debs-beta build/output/debs-beta -o IdentityFile=~/.ssh/id_rsa -o reconnect -o allow_other || true
sudo sshfs upload@users.armbian.com:/debs-beta build/output/debs-beta -o IdentityFile=~/.ssh/id_rsa -o reconnect -o nonempty,allow_other || true
fi
- name: Sync
run: |
mkdir -p build/userpatches
sudo cp scripts/configs/* build/userpatches/
- name: Pull Docker image
run: |
[[ -z $(command -v docker) ]] && sudo apt-get -yy install docker containerd docker.io
sudo docker kill $(sudo docker ps -q) 2>/dev/null || true
sudo docker image rm $(sudo docker images | grep -v latest"-$(dpkg --print-architecture)" | awk 'NR>1 {print $3}') 2> /dev/null || true
sudo docker pull ghcr.io/armbian/build:latest"-$(dpkg --print-architecture)"
- name: Build
run: |
export TERM=dumb
cd build
#if [[ "${{ env.REFERENCE }}" != "nightly" ]]; then
# OLD="ghcr.io/armbian/build:$(cat VERSION | cut -d"." -f1-2)"-$(dpkg --print-architecture)
# sudo git checkout -f ${{ env.REFERENCE }}
# #sudo cp ../scripts/VERSION .
# sudo docker tag $OLD ghcr.io/armbian/build:$(cat ../scripts/VERSION)-$(dpkg --print-architecture)
#fi
# use local resources if possible
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
sudo rm -rf cache/toolchain/*
sudo mkdir -p cache/toolchain || true
! sudo mountpoint -q cache/toolchain && sudo mount nas:/tank/armbian/toolchain.armbian.com cache/toolchain -o rsize=32768,wsize=32768,timeo=5,retrans=2,actimeo=60,retry=15 || true
fi
CHUNK="${{ matrix.node }}"
BOARD=$(echo $CHUNK | cut -d":" -f1)
BRANCH=$(echo $CHUNK | cut -d":" -f2)
echo "BOARD=$BOARD" >> $GITHUB_ENV
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
sudo sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf
./compile.sh docker \
ARMBIAN_MIRROR="https://github.com/armbian/mirror/releases/download/" \
BOARD="$BOARD" \
PRIVATE_CCACHE="yes" \
BETA="${{ env.BETA }}" \
USE_TORRENT="yes" \
KERNEL_ONLY="no" \
KERNEL_KEEP_CONFIG="no" \
RELEASE="jammy" \
BSP_BUILD="yes" \
BUILD_ALL="yes" \
CLEAN_LEVEL="make,oldcache" \
BUILD_MINIMAL="no" \
BUILD_DESKTOP="no" \
USE_MAINLINE_GOOGLE_MIRROR="yes" \
BRANCH="$BRANCH" \
KERNEL_CONFIGURE="no" \
OFFLINE="no" \
REPOSITORY_INSTALL="armbian-firmware,kernel,armbian-firmware,armbian-config,armbian-zsh" \
EXPERT="yes"
# if we are building rc images, we want to have this in nightly repo
# to do - proper solution is needed when we will push directly to stable
#if [[ "${{ env.REFERENCE }}" != "nightly" ]]; then
#sudo mv output/debs/linux-u-boot-${BRANCH}-${BOARD}* output/debs-beta/ || true
#sudo mv output/debs/armbian-bsp-cli-${BOARD}* output/debs-beta/ || true
#fi
- name: Install SSH key for storage
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY_TORRENTS }}
known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
if_key_exists: replace
- name: upload artefacts
if: ${{ inputs.uploading == true }}
uses: actions/upload-artifact@v3
with:
name: u-boot-${{ env.BOARD }}-${{ env.BRANCH }}
path: |
build/output/debs-beta/*u-boot*
build/output/debs/*u-boot*
if-no-files-found: ignore
- name: Unmount folders
run: |
sudo mountpoint -q build/output/debs && sudo fusermount -u build/output/debs || true
sudo mountpoint -q build/output/debs-beta && sudo fusermount -u build/output/debs-beta || true
sudo mountpoint -q build/cache/toolchain && sudo fusermount -u build/cache/toolchain || true