forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (155 loc) · 5.68 KB
/
cross-bootstrap-tools.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
name: Cross-build
# XXX keep paths in sync
on:
push:
branches: [ main, 'stable/14', 'stable/13' ]
paths:
- 'sys/**'
- 'Makefile'
- 'Makefile.inc1'
- '**/cross-bootstrap-tools.yml'
pull_request:
branches: [ main ]
paths:
- 'sys/**'
- 'Makefile'
- 'Makefile.inc1'
- '**/cross-bootstrap-tools.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
setup:
name: setup
runs-on: ubuntu-latest
outputs:
kern_archs: ${{ steps.match.outputs.kern_archs }}
world_archs: ${{ steps.match.outputs.world_archs }}
make_targets: ${{ steps.match.outputs.make_targets }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: paths filter (kernel)
uses: dorny/paths-filter@v3
id: kern_filter
with:
base: ${{ github.ref_name }}
filters: |
amd64:
- 'sys/amd64/**'
i386:
- 'sys/i386/**'
aarch64:
- 'sys/arm64/**'
armv7:
- 'sys/arm/**'
powerpc: &ppc
- 'sys/powerpc/**'
powerpc64:
- *ppc
powerpc64le:
- *ppc
riscv64:
- 'sys/riscv/**'
all:
- '**/cross-bootstrap-tools.yml'
- name: paths filter (world)
uses: dorny/paths-filter@v3
id: world_filter
with:
base: ${{ github.ref_name }}
filters: |
all:
- '**/cross-bootstrap-tools.yml'
- name: match paths
id: match
run: |
all='["amd64", "armv7", "aarch64", "i386", "powerpc", "powerpc64", "powerpc64le", "riscv64"]'
echo ${{ join(steps.kern_filter.outputs.changes,) }}
exit 1
if ${{ steps.kern_filter.outputs.all_count }} -gt 0; then
make_targets="buildkernel"
if ${{ steps.kern_filter.outputs.all }}; then
echo "kern_archs=$all" | tee "$GITHUB_OUTPUT"
else
echo "kern_archs=${{ steps.kern_filter.outputs.changes }}" | tee "$GITHUB_OUTPUT"
fi
fi
if ${{ steps.world_filter.outputs.all_count }} -gt 0; then
make_targets="$make_targets buildworld"
if ${{ steps.world_filter.outputs.all }}; then
echo "world_archs=$all" | tee "$GITHUB_OUTPUT"
else
echo "world_archs=${{ steps.world_filter.outputs.changes }}" | tee "$GITHUB_OUTPUT"
fi
fi
echo "make_targets=$make_targets" | tee "$GITHUB_OUTPUT"
build:
name: ${{ matrix.target_arch }} ${{ matrix.make_target }} on ${{ matrix.os }} (${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
needs: setup
strategy:
fail-fast: false
matrix:
target_arch: ${{ fromJSON(needs.setup.outputs.kern_archs) }}
make_target: ${{ fromJSON(needs.setup.outputs.make_targets }}
os: [ ubuntu-22.04, ubuntu-24.04, macos-latest ]
include:
# TODO: both Ubuntu and macOS have bmake packages, we should try them instead of bootstrapping our own copy.
- os: ubuntu-22.04
compiler: clang-14
cross-bindir: /usr/lib/llvm-14/bin
pkgs: bmake libarchive-dev clang-14 lld-14
- os: ubuntu-24.04
compiler: clang-18
cross-bindir: /usr/lib/llvm-18/bin
pkgs: bmake libarchive-dev clang-18 lld-18
- os: macos-latest
compiler: clang-18
cross-bindir: /opt/homebrew/opt/llvm@18/bin
pkgs: bmake libarchive llvm@18
# Correspoding TARGET for TARGET_ARCH
- target_arch: amd64
target: amd64
- target_arch: armv7
target: arm
- target_arch: aarch64
target: arm64
- target_arch: i386
target: i386
- target_arch: powerpc
target: powerpc
- target_arch: powerpc64
target: powerpc
- target_arch: powerpc64le
target: powerpc
- target_arch: riscv64
target: riscv
steps:
- uses: actions/checkout@v4
- name: install packages (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update --quiet || true
sudo apt-get -yq --no-install-suggests --no-install-recommends install ${{ matrix.pkgs }}
- name: install packages (macOS)
if: runner.os == 'macOS'
run: |
brew update --quiet || true
brew install ${{ matrix.pkgs }} || true
- name: create environment
run: |
echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE"
if [ -n "${{ matrix.cross-bindir }}" ]; then
echo "EXTRA_BUILD_ARGS=--cross-bindir=${{ matrix.cross-bindir }}" >> $GITHUB_ENV
fi
mkdir -p ../build
echo "MAKEOBJDIRPREFIX=${PWD%/*}/build" >> $GITHUB_ENV
# heh, works on Linux/BSD/macOS ...
echo "NPROC=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`" >> $GITHUB_ENV
- name: bootstrap bmake
run: ./tools/build/make.py --debug $EXTRA_BUILD_ARGS TARGET=${{ matrix.target }} TARGET_ARCH=${{ matrix.target_arch }} -n
- name: make kernel-toolchain
run: ./tools/build/make.py --debug $EXTRA_BUILD_ARGS TARGET=${{ matrix.target }} TARGET_ARCH=${{ matrix.target_arch }} kernel-toolchain -s -j$NPROC -DWITH_DISK_IMAGE_TOOLS_BOOTSTRAP
- name: make buildkernel
run: ./tools/build/make.py --debug $EXTRA_BUILD_ARGS TARGET=${{ matrix.target }} TARGET_ARCH=${{ matrix.target_arch }} KERNCONF=GENERIC NO_MODULES=yes buildkernel -s -j$NPROC $EXTRA_MAKE_ARGS