-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (85 loc) · 4.54 KB
/
build-docker.yml
File metadata and controls
95 lines (85 loc) · 4.54 KB
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
name: Build BlazeNeuro (Docker)
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 360
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/share/boost
sudo apt-get clean
df -h
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download sources
run: |
mkdir -p sources
cd sources
declare -A urls=(
["binutils-2.42.tar.xz"]="https://mirrors.kernel.org/gnu/binutils/binutils-2.42.tar.xz|https://ftpmirror.gnu.org/binutils/binutils-2.42.tar.xz"
["gcc-13.2.0.tar.xz"]="https://mirrors.kernel.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz|https://ftpmirror.gnu.org/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz"
["glibc-2.39.tar.xz"]="https://mirrors.kernel.org/gnu/glibc/glibc-2.39.tar.xz|https://ftpmirror.gnu.org/glibc/glibc-2.39.tar.xz"
["linux-6.7.4.tar.xz"]="https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz|https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz"
["bash-5.2.21.tar.gz"]="https://mirrors.kernel.org/gnu/bash/bash-5.2.21.tar.gz|https://ftpmirror.gnu.org/bash/bash-5.2.21.tar.gz"
["coreutils-9.4.tar.xz"]="https://mirrors.kernel.org/gnu/coreutils/coreutils-9.4.tar.xz|https://ftpmirror.gnu.org/coreutils/coreutils-9.4.tar.xz"
["findutils-4.9.0.tar.xz"]="https://mirrors.kernel.org/gnu/findutils/findutils-4.9.0.tar.xz|https://ftpmirror.gnu.org/findutils/findutils-4.9.0.tar.xz"
["grep-3.11.tar.xz"]="https://mirrors.kernel.org/gnu/grep/grep-3.11.tar.xz|https://ftpmirror.gnu.org/grep/grep-3.11.tar.xz"
["gzip-1.13.tar.xz"]="https://mirrors.kernel.org/gnu/gzip/gzip-1.13.tar.xz|https://ftpmirror.gnu.org/gzip/gzip-1.13.tar.xz"
["tar-1.35.tar.xz"]="https://mirrors.kernel.org/gnu/tar/tar-1.35.tar.xz|https://ftpmirror.gnu.org/tar/tar-1.35.tar.xz"
["xz-5.4.6.tar.xz"]="https://github.com/tukaani-project/xz/releases/download/v5.4.6/xz-5.4.6.tar.xz|https://tukaani.org/xz/xz-5.4.6.tar.xz"
["util-linux-2.39.3.tar.xz"]="https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.3.tar.xz|https://www.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.3.tar.xz"
["e2fsprogs-1.47.0.tar.gz"]="https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.0/e2fsprogs-1.47.0.tar.gz|https://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.47.0/e2fsprogs-1.47.0.tar.gz"
["grub-2.12.tar.xz"]="https://mirrors.kernel.org/gnu/grub/grub-2.12.tar.xz|https://ftpmirror.gnu.org/grub/grub-2.12.tar.xz"
)
for file in "${!urls[@]}"; do
[ -f "$file" ] && echo "$file exists, skipping" && continue
IFS='|' read -ra MIRRORS <<< "${urls[$file]}"
echo "Downloading $file"
success=0
for mirror in "${MIRRORS[@]}"; do
if wget --continue --tries=3 --timeout=20 --waitretry=2 "$mirror" -O "$file" 2>&1; then
success=1
break
fi
echo "Failed from $mirror, trying next..."
rm -f "$file"
done
[ $success -eq 0 ] && { echo "All mirrors failed for $file"; exit 1; }
if [[ "$file" == *.xz ]]; then
xz -t "$file" || { echo "Corrupt: $file"; rm -f "$file"; exit 1; }
elif [[ "$file" == *.gz ]]; then
gzip -t "$file" || { echo "Corrupt: $file"; rm -f "$file"; exit 1; }
fi
done
ls -lh
- name: Build Docker image
run: |
docker build -t blazeneuro-builder . || exit 1
- name: Extract build artifact
run: |
docker create --name blazeneuro blazeneuro-builder
docker cp blazeneuro:/blazeneuro-rootfs.tar.gz . || exit 1
docker rm blazeneuro
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: build-logs
path: logs/
retention-days: 7
if-no-files-found: warn
- name: Upload system image
if: success()
uses: actions/upload-artifact@v4
with:
name: blazeneuro-system
path: blazeneuro-rootfs.tar.gz
retention-days: 30