Skip to content

Commit 9f0877c

Browse files
committed
Separate setup step to a dedicated action
The approach is similar to current OT CI. Signed-off-by: Gary Guo <gary@garyguo.net>
1 parent a78b01c commit 9f0877c

File tree

2 files changed

+53
-28
lines changed

2 files changed

+53
-28
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright lowRISC contributors.
2+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Prepare environment
6+
description: Install dependencies and prepare environment
7+
8+
inputs:
9+
verilator-version:
10+
description: Verilator version to install
11+
required: true
12+
default: '4.210'
13+
verilator-path:
14+
description: Path at which to install Veriltator
15+
required: true
16+
default: /tools/verilator
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- uses: astral-sh/setup-uv@v5
22+
with:
23+
version: '0.6.1'
24+
enable-cache: true
25+
cache-dependency-glob: |
26+
python-requirements.txt
27+
28+
- name: Install Python
29+
shell: bash
30+
run: |
31+
uv python install 3.10
32+
# Create a virtual environment for UV
33+
uv venv ~/.local/share/venv
34+
echo "$HOME/.local/share/venv/bin" >> "$GITHUB_PATH"
35+
echo "VIRTUAL_ENV=$HOME/.local/share/venv" >> "$GITHUB_ENV"
36+
37+
- name: Install Python dependencies
38+
shell: bash
39+
run: |
40+
uv pip install -r python-requirements.txt
41+
42+
- name: Install Verilator
43+
run: |
44+
VERILATOR_TAR="verilator-v${{ inputs.verilator-version }}.tar.gz"
45+
VERILATOR_URL="https://storage.googleapis.com/verilator-builds/${VERILATOR_TAR}"
46+
sudo mkdir -p "${{ inputs.verilator-path }}"
47+
curl -sSfL "$VERILATOR_URL" | sudo tar -C "${{ inputs.verilator-path }}" -xvzf -
48+
echo "${{ inputs.verilator-path }}/v${{ inputs.verilator-version }}/bin" >> "$GITHUB_PATH"
49+
shell: bash

.github/workflows/ci.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,8 @@ jobs:
1111
- name: Checkout Muntjac
1212
uses: actions/checkout@v4
1313

14-
- name: Install Verilator
15-
run: |
16-
VERILATOR_VERSION=v4.210
17-
wget https://storage.googleapis.com/verilator-builds/verilator-"$VERILATOR_VERSION".tar.gz
18-
sudo mkdir -p /tools/verilator
19-
sudo chmod 777 /tools/verilator
20-
sudo tar -C /tools/verilator -xvzf verilator-"$VERILATOR_VERSION".tar.gz
21-
echo "/tools/verilator/$VERILATOR_VERSION/bin" >> $GITHUB_PATH
22-
23-
- name: Install Python dependencies
24-
run: pip3 install setuptools wheel
25-
26-
- name: Install FuseSoC
27-
run: pip3 install -r python-requirements.txt
14+
- name: Prepare environment
15+
uses: ./.github/actions/prepare-env
2816

2917
- name: Run lint
3018
run: make lint
@@ -44,20 +32,8 @@ jobs:
4432
- name: Checkout Muntjac
4533
uses: actions/checkout@v4
4634

47-
- name: Install Verilator
48-
run: |
49-
VERILATOR_VERSION=v4.210
50-
wget https://storage.googleapis.com/verilator-builds/verilator-"$VERILATOR_VERSION".tar.gz
51-
sudo mkdir -p /tools/verilator
52-
sudo chmod 777 /tools/verilator
53-
sudo tar -C /tools/verilator -xvzf verilator-"$VERILATOR_VERSION".tar.gz
54-
echo "/tools/verilator/$VERILATOR_VERSION/bin" >> $GITHUB_PATH
55-
56-
- name: Install Python dependencies
57-
run: pip3 install setuptools wheel
58-
59-
- name: Install FuseSoC
60-
run: pip3 install -r python-requirements.txt
35+
- name: Prepare environment
36+
uses: ./.github/actions/prepare-env
6137

6238
- name: Run build
6339
run: make sim-${{ matrix.name }}

0 commit comments

Comments
 (0)