ci: Add ci build flow #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci-build | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 2 * * *" | |
env: | |
rv32_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.02.02 | |
rv32_toolchain_file_name: riscv32-glibc-ubuntu-22.04-gcc-nightly-2024.02.02-nightly.tar.gz | |
rv64_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.02.02 | |
rv64_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.02.02-nightly.tar.gz | |
jobs: | |
kernel: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: opensbi-32ilp32 | |
toolchain_tripe: riscv32-unknown-linux-gnu- | |
- name: opensbi-64lp64 | |
toolchain_tripe: riscv64-unknown-linux-gnu- | |
runs-on: ubuntu-22.04 | |
env: | |
CROSS_COMPILE: ${{ matrix.toolchain_tripe }} | |
steps: | |
- name: Install software | |
run: | | |
sudo apt update && \ | |
sudo apt install -y build-essential | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Configure toolchains | |
run: | | |
if [ x"${{ matrix.name }}" = x"opensbi-32ilp32" ]; then | |
wget ${rv32_toolchain}/${rv32_toolchain_file_name} | |
tar -xvf ${rv32_toolchain_file_name} -C /opt | |
rm -v ${rv32_toolchain_file_name} | |
fi | |
if [ x"${{ matrix.name }}" = x"opensbi-64lp64" ]; then | |
wget ${rv64_toolchain}/${rv64_toolchain_file_name} | |
tar -xvf ${rv64_toolchain_file_name} -C /opt | |
rm -v ${rv64_toolchain_file_name} | |
fi | |
- name: Compile | |
run: | | |
export PATH="/opt/riscv/bin:$PATH" | |
make PLATFORM=generic -j | |
mv build/platform/generic/firmware/fw_dynamic.bin ./ | |
mv build/platform/generic/firmware/fw_dynamic.elf ./ | |
git log --oneline -100 > git.log | |
tar czvf ${{ matrix.name }}.tar.gz fw_dynamic.elf fw_dynamic.bin git.log | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.name }}.tar.gz | |
path: ${{ matrix.name }}.tar.gz | |
retention-days: 90 |