Skip to content

Commit 29bbac5

Browse files
committed
CI: Add composite action for dependency setup
This creates reusable GitHub composite action to unify dependency installation across Linux and macOS runners with integrated caching. - Platform-specific dependency installation (Linux/macOS) - APT package caching for faster Linux builds - RISC-V toolchain caching across platforms - LLVM 18 installation with PATH configuration - Step-level timeouts for reliability
1 parent f9a5e64 commit 29bbac5

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: 'Setup rv32emu Dependencies'
2+
description: 'Install dependencies for building rv32emu on Linux and macOS'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Cache APT packages
8+
if: runner.os == 'Linux'
9+
uses: actions/cache@v4
10+
with:
11+
path: /var/cache/apt/archives
12+
key: ${{ runner.os }}-apt-${{ hashFiles('.ci/*.sh') }}
13+
restore-keys: |
14+
${{ runner.os }}-apt-
15+
16+
- name: Install Linux dependencies
17+
if: runner.os == 'Linux'
18+
shell: bash
19+
run: |
20+
sudo apt-get update -q=2
21+
sudo apt-get install -y -q=2 \
22+
build-essential \
23+
libsdl2-dev \
24+
libsdl2-mixer-dev \
25+
device-tree-compiler \
26+
expect \
27+
bc \
28+
p7zip-full
29+
30+
- name: Install LLVM 18
31+
if: runner.os == 'Linux'
32+
shell: bash
33+
run: |
34+
wget -q https://apt.llvm.org/llvm.sh
35+
sudo chmod +x ./llvm.sh
36+
sudo ./llvm.sh 18
37+
echo "/usr/lib/llvm-18/bin" >> $GITHUB_PATH
38+
39+
- name: Install macOS dependencies
40+
if: runner.os == 'macOS'
41+
shell: bash
42+
run: |
43+
brew install \
44+
make \
45+
dtc \
46+
expect \
47+
sdl2 \
48+
sdl2_mixer \
49+
bc \
50+
e2fsprogs \
51+
p7zip \
52+
llvm@18 \
53+
dcfldd
54+
echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH
55+
56+
- name: Install RISC-V toolchain
57+
shell: bash
58+
run: |
59+
.ci/riscv-toolchain-install.sh
60+
echo "${{ github.workspace }}/toolchain/bin" >> $GITHUB_PATH
61+
62+
- name: Cache RISC-V toolchain
63+
uses: actions/cache@v4
64+
with:
65+
path: toolchain
66+
key: ${{ runner.os }}-${{ runner.arch }}-riscv-toolchain-${{ hashFiles('.ci/riscv-toolchain-install.sh') }}
67+
restore-keys: |
68+
${{ runner.os }}-${{ runner.arch }}-riscv-toolchain-

0 commit comments

Comments
 (0)