Skip to content

Commit

Permalink
feat: add ci build
Browse files Browse the repository at this point in the history
Signed-off-by: Han Gao <[email protected]>
  • Loading branch information
RevySR committed Feb 28, 2024
1 parent 3325b96 commit b40ddfd
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: mkimg-k230-ci

on:
push:
tags:
- '*'
branches:
- '*'
pull_request:
workflow_dispatch:

env:
xuantie_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1698113812618
toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.8.0-20231018.tar.gz
mainline_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.10.18
mainline_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2023.10.18-nightly.tar.gz
wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0'
ARCH: riscv
CROSS_COMPILE: riscv64-unknown-linux-gnu-
KBUILD_BUILD_USER: builder
KBUILD_BUILD_HOST: revyos-riscv-builder
KDEB_COMPRESS: xz
KDEB_CHANGELOG_DIST: unstable
OUTPUT: output


jobs:
mkrootfs:
strategy:
fail-fast: false
matrix:
model: [cammv, evb]
distro: [revyos, debian]

runs-on: ubuntu-22.04
env:
BOARD: ${{ matrix.model }}
DISTRO: ${{ matrix.distro }}

steps:
- name: Create Timestamp
run: |
echo "BUILD_ID=$(date +%Y%m%d_%H%M%S)" >> $GITHUB_ENV
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
- name: Install Software
run: |
sudo apt update && \
sudo apt install -y gdisk dosfstools build-essential autoconf automake autotools-dev ninja-build make \
libncurses-dev gawk flex bison openssl libssl-dev tree \
gcc-riscv64-linux-gnu gfortran-riscv64-linux-gnu libgomp1-riscv64-cross \
qemu-user-static binfmt-support mmdebstrap genimage
wget https://mirror.iscas.ac.cn/revyos/revyos-addons/pool/main/r/revyos-keyring/revyos-keyring_2023.06.12_all.deb
sudo apt install ./revyos-keyring_2023.06.12_all.deb
${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name}
tar -xvf ${mainline_toolchain_file_name} -C /opt
rm -rf ${mainline_toolchain_file_name}
export PATH="/opt/riscv/bin:$PATH"
echo "PATH=${PATH}" >> $GITHUB_ENV
- name: Checkout qemu
uses: actions/checkout@v4
with:
repository: revyos/qemu
path: qemu
ref: ab8f84892a89feea60f1bb24432ff58ce6d2885c # TODO: remove this line

- name: build qemu
run: |
pushd qemu
./configure \
--prefix=$HOME/qemu-install \
--static \
--target-list=riscv64-linux-user \
--disable-system \
--disable-pie \
--interp-prefix=/etc/qemu-binfmt/%M
make -j$(nproc)
make install
sudo cp -fv $HOME/qemu-install/bin/qemu-riscv64 /usr/bin/qemu-riscv64-static
popd
ls -al /usr/bin/qemu-riscv64-static
sudo dpkg-reconfigure binfmt-support
- name: Checkout Repo
uses: actions/checkout@v4

- name: Make Image
run: |
# make revyos-release on CI
echo "BUILD_ID=${{ env.BUILD_ID }}" >> revyos-release
echo "BUILD_DATE=${{ env.BUILD_DATE }}" >> revyos-release
echo "RELEASE_ID=${{ github.ref_name }}" >> revyos-release
echo "COMMIT_ID=${{ github.sha }}" >> revyos-release
echo "RUNNER_ID=${{ github.run_id }}" >> revyos-release
sudo -E bash ./build.sh build all
sudo mv *.img k230-sdcard-${{ env.DISTRO }}-${{ env.BOARD }}.img
- name: Make Checksum file & Compress files
run: |
pushd ${OUTPUT}
sha256sum *.img > SHA256SUMS
sha512sum *.img > SHA512SUMS
zstd *.img
popd
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
retention-days: 30
name: k230-sdcard-${{ env.DISTRO }}-${{ env.BOARD }}
path: |
${{ env.OUTPUT }}/*.img.zst
${{ env.OUTPUT }}/SHA256SUMS
${{ env.OUTPUT }}/SHA512SUMS
- name: 'Create release by tag'
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${OUTPUT}/*.img.zst
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit b40ddfd

Please sign in to comment.