Skip to content

CI: Add a CI to build ELF #606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Build Spike and run a couple of debug tests.

name: Build ELF

env:
RV32_TOOLCHAIN_URL: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.01.20/riscv32-elf-ubuntu-24.04-gcc-nightly-2025.01.20-nightly.tar.xz
RV64_TOOLCHAIN_URL: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.01.20/riscv64-elf-ubuntu-24.04-gcc-nightly-2025.01.20-nightly.tar.xz

on:
# Run on merges to master to populate the cache with entities that are
# accessible by every pull request.
push:
workflow_dispatch:
# There is some commented out code below that would be useful in adding this
# workflow to other repos. Ideally we can come up with something that would
# leave this file almost identical between repos, so they can all easily run
# this test suite.

jobs:
Build:
name: Build ELF on Ubuntu
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Get the toolchain from cache (if available)
id: cache-restore-toolchain
uses: actions/cache/restore@v4
with:
path: /opt/riscv
key: "toolchain-${{env.RV64_TOOLCHAIN_URL}}"

- if: ${{ steps.cache-restore-toolchain.outputs.cache-hit != 'true' }}
name: Download RV32 Toolchain (if not cached)
run: |
mkdir -p /opt/riscv/rv32toolchain
wget --progress=dot:giga $RV32_TOOLCHAIN_URL -O /tmp/rv32toolchain.tar.gz

- if: ${{ steps.cache-restore-toolchain.outputs.cache-hit != 'true' }}
name: Download RV64 Toolchain (if not cached)
run: |
mkdir -p /opt/riscv/rv64toolchain
wget --progress=dot:giga $RV64_TOOLCHAIN_URL -O /tmp/rv64toolchain.tar.gz

- if: ${{ steps.cache-restore-toolchain.outputs.cache-hit != 'true' }}
name: Install Toolchain (if not cached)
run: |
tar xvf /tmp/rv32toolchain.tar.gz --strip-components=1 -C /opt/riscv/rv32toolchain
tar xvf /tmp/rv64toolchain.tar.gz --strip-components=1 -C /opt/riscv/rv64toolchain

- name: Save the toolchain to the cache (if necessary)
id: cache-save-toolchain
uses: actions/cache/save@v4
with:
path: /opt/riscv
key: "toolchain-${{env.RV64_TOOLCHAIN_URL}}"

- name: Build ELFs
run: |
export PATH=/opt/riscv/rv64toolchain/bin:/opt/riscv/rv32toolchain/bin:$PATH
mkdir results
autoupdate
autoconf
./configure --prefix=$(pwd)/riscv-tests/results
make
make install

- name: Archive ISA
uses: actions/upload-artifact@v4
with:
name: ISA-${{ github.sha }}
path: riscv-tests/results/share/riscv-tests/isa

- name: Archive Benchmarks
# Proceed even if there was a failed test
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: Benchmarks-${{ github.sha }}
path: riscv-tests/results/share/riscv-tests/benchmarks