Skip to content

Commit cb4d908

Browse files
committed
ci: Add cross builds
1 parent 364a062 commit cb4d908

File tree

1 file changed

+131
-2
lines changed

1 file changed

+131
-2
lines changed

.github/workflows/build.yaml

Lines changed: 131 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: "Linux Build"
33
on: [push]
44

55
jobs:
6-
linux:
7-
name: '${{ matrix.os }}: ${{ matrix.compiler.vendor }}'
6+
native:
7+
name: 'Native: ${{ matrix.os }}: ${{ matrix.compiler.vendor }}'
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
fail-fast: false
@@ -109,3 +109,132 @@ jobs:
109109
export TARGET_WORKSPACE="$(pwd)/projects"
110110
source docs/env.sh
111111
make -j"$(nproc)" TARGET=framebuffer
112+
113+
cross:
114+
name: 'Cross: ${{ matrix.build.toolchain }}: ${{ matrix.build.frontend }}'
115+
runs-on: ubuntu-24.04 # Matches toolchains workflow
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
build:
120+
- { toolchain: arm-riscos-gnueabi, frontend: riscos, pkg-file: netsurf.zip }
121+
- { toolchain: arm-unknown-riscos, frontend: riscos, pkg-file: netsurf.zip }
122+
- { toolchain: i686-w64-mingw32, frontend: windows, pkg-file: netsurf-installer.exe }
123+
# TODO: Figure out ATARI package file names
124+
#- { toolchain: m5475-atari-mint, frontend: atari, pkg-file: }
125+
#- { toolchain: m68k-atari-mint, frontend: atari, pkg-file: }
126+
- { toolchain: m68k-unknown-amigaos, frontend: amiga, pkg-file: netsurf.lha }
127+
- { toolchain: ppc-amigaos, frontend: amiga, pkg-file: netsurf.lha }
128+
- { toolchain: x86_64-w64-mingw32, frontend: windows, pkg-file: netsurf-installer.exe }
129+
130+
steps:
131+
- name: Checkout repository
132+
uses: actions/checkout@v3
133+
with:
134+
fetch-depth: 1
135+
136+
- name: apt-get install packages
137+
run: sudo apt-get update -qq &&
138+
sudo apt-get install --no-install-recommends -y
139+
bison
140+
build-essential
141+
ccache
142+
check
143+
clang
144+
flex
145+
git
146+
gperf
147+
libcurl4-openssl-dev
148+
libgtk-3-dev
149+
libhtml-parser-perl
150+
libjpeg-dev
151+
libpng-dev
152+
librsvg2-dev
153+
llvm
154+
pkg-config
155+
wbritish # Needed for `/usr/share/dict/words`, used by test
156+
157+
- name: ccache
158+
uses: hendrikmuhs/ccache-action@v1.2
159+
with:
160+
key: ${{ github.job }}-${{ matrix.build.toolchain }}
161+
max-size: 128M
162+
163+
# look for toolchain for this branch name first, then default to master
164+
- name: Download toolchain
165+
run: |
166+
set -e
167+
168+
TOOLCHAIN_NAME="${{ matrix.build.toolchain }}"
169+
BRANCH_NAME="${{ github.ref_name }}"
170+
171+
# Function to try downloading toolchain from a specific tag
172+
download_toolchain() {
173+
local ref="$1"
174+
local download_url="https://github.com/netsurf-browser/toolchains/releases/download/${ref}/${TOOLCHAIN_NAME}.tar.gz"
175+
176+
echo "Trying to download toolchain from ref: $ref"
177+
echo "URL: $download_url"
178+
179+
if curl -f -L -o "${TOOLCHAIN_NAME}.tar.gz" "$download_url"; then
180+
echo "Got toolchain with ref: $ref"
181+
return 0
182+
else
183+
echo "Failed to download toolchain with ref: $ref"
184+
return 1
185+
fi
186+
}
187+
188+
# Try branch-specific toolchain first
189+
safe_branch=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9._-]/-/g')
190+
branch_tag="gh-${safe_branch}-unstable"
191+
192+
if download_toolchain "$branch_tag"; then
193+
echo "Downloaded branch-specific toolchain"
194+
elif download_toolchain "gh-master-unstable"; then
195+
echo "Downloaded fallback master toolchain"
196+
else
197+
echo "Failed to download any toolchain variant"
198+
exit 1
199+
fi
200+
201+
- name: Install toolchain
202+
run: |
203+
echo "Installing toolchain: ${{ matrix.build.toolchain }}"
204+
sudo tar -xzf "${{ matrix.build.toolchain }}.tar.gz" -C /
205+
ls -l /opt/netsurf/
206+
207+
- name: Build and install project libs
208+
env:
209+
HOST: ${{ matrix.build.toolchain }}
210+
run: |
211+
export TARGET_WORKSPACE="$(pwd)/projects"
212+
source docs/env.sh
213+
ns-clone -d -s
214+
ns-make-tools install
215+
ns-make-libs install
216+
217+
- name: Build NetSurf
218+
env:
219+
HOST: ${{ matrix.build.toolchain }}
220+
run: |
221+
export TARGET_WORKSPACE="$(pwd)/projects"
222+
source docs/env.sh
223+
make -j"$(nproc)" TARGET=${{ matrix.build.frontend }}
224+
225+
- name: Make package
226+
env:
227+
HOST: ${{ matrix.build.toolchain }}
228+
run: |
229+
export TARGET_WORKSPACE="$(pwd)/projects"
230+
source docs/env.sh
231+
make package TARGET=${{ matrix.build.frontend }}
232+
233+
# Can't avoid `upload-artifact` zipping the package
234+
# https://github.com/actions/upload-artifact/issues/426
235+
- name: Upload artifact
236+
uses: actions/upload-artifact@v4
237+
with:
238+
name: ${{ matrix.build.toolchain }}-${{ matrix.build.frontend }}
239+
path: ${{ matrix.build.pkg-file }}
240+
compression-level: 0 # Avoid pointless recompression

0 commit comments

Comments
 (0)