Skip to content

Commit

Permalink
ci: Add ci build flow
Browse files Browse the repository at this point in the history
Signed-off-by: Guo Ren <[email protected]>
  • Loading branch information
guoren83 committed Feb 21, 2024
1 parent dc0bb19 commit 032c386
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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

0 comments on commit 032c386

Please sign in to comment.